I have an Application load balancer that is configured to forward requests to EC2 instances inside a target group. Also, I have an autoscaling group attached to the same target group which is increasing the number of instances based on the server load.
Healthchecks are configured inside the target group and are working okay. However, sometimes when the load is increased and the autoscaling group creates a new instance, I see an exception being raised on the new EC2 instance when the healthcheck is invoked by the ELB.
Usually, my instances need around 30 seconds to install some libraries after they are spinned up. That's why I have quite a generous Health Check Grace Period configured inside the autoscaling group.
The problem, that is bugging me is that it seems the load balancer is sometimes requesting the healthcheck endpoint (even though I have configured 5 mins Interval inside the target group) before the instance has been installed the needed libraries. This causes an exception to be thrown and I receive a notification for that, which is very annoying.
It seems that Health Check Grace Period inside Auto Scaling does not stop the ELB from sending healthcheck requests to the new instance. Do you have an idea how to make the ELB healthcheck to wait some time after autoscaling creates a new instance?