The Elastic Load Balancing documentation says an Application Load Balancer sends each registered target a health check every 30 seconds by default and expects the success code 200. Two consecutive failures mark a target unhealthy. If every target in a target group is unhealthy, the load balancer fails open and routes requests to all of them.
What are the default health check settings?
The protocol is HTTP or HTTPS, using the GET method, and the default is HTTP. The default port is the port on which the target receives traffic. The default path is /.
The interval defaults to 30 seconds and the timeout to 5 seconds for instance and IP targets. The healthy threshold defaults to 5 consecutive successes and the unhealthy threshold to 2 consecutive failures.
The matcher, called success codes in the console, defaults to 200. Values from 200 to 499 are allowed, as a list such as 200,202 or a range such as 200-299. A health page that answers with any code outside the matcher fails the check.
What happens when every target is unhealthy?
Each load balancer node normally routes only to healthy targets in its enabled Availability Zones. If a target group contains only unhealthy targets, the load balancer routes to all of them regardless of health status. AWS calls this failing open.
A wrong health check path can therefore mark every target unhealthy while users still get answers. The status values help to tell cases apart: unhealthy means the target failed or did not answer the check, and unused means the target is not registered, its target group is not in a listener rule, it is stopped or terminated, or it is in an Availability Zone that is not enabled for the load balancer.
What does the Auto Scaling health check grace period do?
When an Auto Scaling group uses Elastic Load Balancing health checks, it replaces instances that fail them. The grace period is the minimum time a new instance is kept in service before it can be terminated for being unhealthy. It stops the group from terminating instances that are still initializing.
The default depends on how the group is created: 300 seconds in the console, 0 seconds with the AWS CLI or an SDK. A value of 0 turns the grace period off. With the CLI, pass --health-check-grace-period.
The grace period applies to newly launched instances, instances returned from standby and instances attached by hand. It does not cover an instance that leaves the running state: a stopped instance is marked unhealthy and replaced at once. If launch lifecycle hooks do the initialization, the grace period can be 0.
Where the exam catches people
Believing any 2xx or a redirect passes the health check: the default matcher is 200 only.
Believing a target group with no healthy targets drops all traffic: the load balancer fails open and routes to every registered target.
Assuming the 300-second grace period when creating a group with the CLI or an SDK: the default there is 0.
Reading unused as a failed health check: it means the target is not in use, for example its Availability Zone is not enabled for the load balancer.
Believing one failed check removes a target: by default it takes 2 consecutive failures, and 5 consecutive successes to return.