Adding Elastic Load Balancing health checks to an Auto Scaling group - Amazon EC2 Auto Scaling

Adding Elastic Load Balancing health checks to an Auto Scaling group

The default health checks for an Auto Scaling group are EC2 status checks only. If an instance fails these status checks, it is marked unhealthy and will be terminated while Amazon EC2 Auto Scaling launches a new instance in replacement.

You can attach one or more target groups (Application Load Balancers and Network Load Balancers), one or more load balancers (Classic Load Balancers), or both to your Auto Scaling group. However, by default, the group does not consider an instance unhealthy and replace it if it fails the health checks provided by Elastic Load Balancing.

To ensure that the group can determine an instance's health based on additional tests provided by the load balancer, you can configure the Auto Scaling group to use Elastic Load Balancing (ELB) health checks. The load balancer periodically sends pings, attempts connections, or sends requests to test the EC2 instances. These tests are called health checks.

If you configure the Auto Scaling group to use ELB health checks, it considers the instance unhealthy if it fails either the EC2 status checks or the ELB health checks. If you attach multiple load balancer target groups or Classic Load Balancers to the group, all of them must report that the instance is healthy in order for it to consider the instance healthy. If any one of them reports an instance as unhealthy, the Auto Scaling group replaces the instance, even if other ones report it as healthy.

See the following topics:

The following procedures show how to add ELB health checks to your Auto Scaling group.

Adding health checks (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

  1. Open the Amazon EC2 console at

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

  3. Select the check box next to an existing group.

    A split pane opens up in the bottom part of the Auto Scaling groups page, showing information about the group that's selected.

  4. On the Details tab, choose Health checks, Edit.

  5. For Health check type, select Enable ELB health checks.

  6. For Health check grace period, enter 300.

  7. Choose Update.

  8. On the Instance management tab, under Instances, you can view the health status of instances. The Health Status column displays the results of the newly added health checks.

Adding health checks (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