Search code examples
amazon-web-servicesamazon-elb

ELB health check behavior - Health Threshold


In the dialog for setting up ELB health check it states:

If an instance fails the health check, it is automatically removed from the load balancer. Customize the health check to meet your specific needs.

I get that will remove the instance from behind the ELB when a health check fails. My question is around the "Healthy Threshold" setting. When you hover over the help there it says:

Number of consecutive health check successes before declaring an EC2 instance healthy.

If the instance is declared healthy, is it pulled back into the load balancing group?


Solution

  • This depends somewhat on how you've configured your environment.

    For example, if you manually registered your EC2 instance with your ELB... it will display a status of "InService" or "OutOfService" depending on the result of your health check. No action is taken at this point, other than the decision to route traffic to the EC2 instance or not. If it is "OutOfService", it can automatically become "InService" again by passing your defined healthy threshold.

    In this situation, your "OutOfService" instance is still associated with the load balancer, but the load balancer won't be using it until it returns to a healthy state. The load balancer will continue to ping your instance until you manually remove the instance from the load balancer, or fix the issue that caused the instance to go out of service.

    There are other situations where the load balancer won't have the opportunity to continue pinging your instance indefinitely, though:

    • If your unhealthy instance is a member of an autoscaling group that has specified ELB health checks, it will be scheduled for replacement. This will terminate the existing instance, and launch a new instance to be associated with your ELB.

    • If your instance is OutOfService for an extremely long period of time, it may not be able to return to service. A simple fix for this is to de-register the instance from the load balancer, and then re-register it.