Amazon EC2 Auto Scaling
User Guide

Using Elastic Load Balancing Health Checks with Auto Scaling

An Auto Scaling group periodically checks the health status of each instance. It can use Amazon EC2 status checks only, or EC2 status checks plus Elastic Load Balancing health checks. If it determines that an instance is unhealthy, it replaces the instance.

If you configure an Auto Scaling group to determine health status using EC2 status checks only (the default), the instance is unhealthy if it fails the EC2 status checks. However, if you have attached one or more load balancers or target groups to the Auto Scaling group and a load balancer reports that an instance is unhealthy, the instance is not considered unhealthy. Therefore, the instance is not replaced.

If you configure your Auto Scaling group to determine health status using both EC2 status checks and Elastic Load Balancing health checks, it considers the instance unhealthy if it fails either the status checks or the health check. If you attach multiple load balancers to an Auto Scaling group, all of them must report that the instance is healthy in order for it to consider the instance healthy. If one load balancer reports an instance as unhealthy, the Auto Scaling group replaces the instance, even if other load balancers report it as healthy.

For more information, see Health Checks for Auto Scaling Instances.

Adding Health Checks Using the Console

Use the following procedure to add an ELB health check with a grace period of 300 seconds to an Auto Scaling group with an attached load balancer.

To add health checks using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. On the navigation pane, under Auto Scaling, choose Auto Scaling Groups.

  3. Select your group.

  4. On the Details tab, choose Edit.

  5. For Health Check Type, select ELB.

  6. For Health Check Grace Period, enter 300.

  7. Choose Save.

  8. On the Instances tab, the Health Status column displays the results of the newly added health checks.

Adding Health Checks Using the AWS CLI

Use the following update-auto-scaling-group command to create a health check with a grace period of 300 seconds:

aws autoscaling update-auto-scaling-group --auto-scaling-group-name my-lb-asg --health-check-type ELB --health-check-grace-period 300