Archive note: This article reflects AWS terminology and behavior at the time it was published in 2019.
Here is a small but important tip for anyone working with an Application Load Balancer (ALB) and Auto Scaling groups in AWS.
By default, an Auto Scaling group uses EC2 health checks. As long as the instance and its operating system are running, the group considers the EC2 instance healthy. The ALB, by contrast, uses a separate health check that you define. Typically, it requests a resource over HTTP or HTTPS and expects a successful status code such as 200.
What happens when a load balancer has unhealthy instances—for example, when the site goes down and the EC2 instances stop returning 200 responses? The load balancer drains connections from those instances because it considers them unhealthy. You would normally want the Auto Scaling group to replace them, but that will not happen if its EC2 health checks still pass. The load balancer may therefore be left without any healthy targets, and the site will remain unavailable to customers.
Solution: configure the Auto Scaling group to use ELB health checks when it runs behind an ALB.


cloud / systems