AWS ELB Connection to the instances has timed out
“Timed out “This error normally occurs when you are registering EC2 instance to your load balancer.Health check requests from your load balancer to your EC2 instances are timing out or failing intermittently.
Step1:
First, verify the issue by connecting directly with the instance. Connect to your instance from within the network using the private IP address of the instance.
Use the following command for a TCP connection:
telnet private-IP-address-of-the-instance
port
Use the following command for an HTTP or HTTPS connection:
curl –I private-IP-address-of-the-instance
:port
/health-check-target-page
Step2:
If you are using an HTTP/HTTPS connection and getting a non-200 response Check below
No target page is configured on the instance.Create a target page on each registered instance and specify its path as the ping path.
Its always better to configure health check page just simple as much as possible . Ex:HTTP:80/index.html.
EX:Test the URL locally http://172.31.113.4/index.html . If this is works within network , mostly your instance side configuration is good. Connectivity and configuration part could be the issue mostly.
Try to avoid using your actual application complex URL configuring as a health check test page . Its just to ensure your Instance is good to receive traffic.
Dont use https URL for health check page .
Step3:
The application is not configured to receive requests from the load balancer or to return a 200 response code.
Check the security group of EC2 instance has proper entry to receive the request from ELB and check the application return response method.
Step4:
The instance is failing to respond within the configured response timeout period.Adjust the response timeout settings in your load balancer health check configuration.In health check setting page increase timeout time . Ex from 10 to 20 .
Step5:
The instance is under significant load and is taking longer than your configured response timeout period to respond .Check the CPU and memory load of the instance.