View a markdown version of this page

Use ConfigureHealthCheck with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ConfigureHealthCheck with a CLI

The following code examples show how to use ConfigureHealthCheck.

CLI
AWS CLI

To specify the health check settings for your backend EC2 instances

The following configure-health-check example specifies the health check settings used to evaluate the health of your backend EC2 instances.

aws elb configure-health-check \ --load-balancer-name my-load-balancer \ --health-check Target=HTTP:80/png,Interval=30,UnhealthyThreshold=2,HealthyThreshold=2,Timeout=3

Output:

{ "HealthCheck": { "HealthyThreshold": 2, "Interval": 30, "Target": "HTTP:80/png", "Timeout": 3, "UnhealthyThreshold": 2 } }

For more information, see Health checks for the instances for your Classic Load Balancer in the Classic Load Balancers User Guide.

PowerShell
Tools for PowerShell V4

Example 1: This example configures the health check settings for the specified load balancer.

Set-ELBHealthCheck -LoadBalancerName my-load-balancer ` >> -HealthCheck_HealthyThreshold 2 ` >> -HealthCheck_UnhealthyThreshold 2 ` >> -HealthCheck_Target "HTTP:80/ping" ` >> -HealthCheck_Interval 30 ` >> -HealthCheck_Timeout 3

Output:

HealthyThreshold : 2 Interval : 30 Target : HTTP:80/ping Timeout : 3 UnhealthyThreshold : 2
Tools for PowerShell V5

Example 1: This example configures the health check settings for the specified load balancer.

Set-ELBHealthCheck -LoadBalancerName my-load-balancer ` >> -HealthCheck_HealthyThreshold 2 ` >> -HealthCheck_UnhealthyThreshold 2 ` >> -HealthCheck_Target "HTTP:80/ping" ` >> -HealthCheck_Interval 30 ` >> -HealthCheck_Timeout 3

Output:

HealthyThreshold : 2 Interval : 30 Target : HTTP:80/ping Timeout : 3 UnhealthyThreshold : 2