I am trying to set up Elastic Load Balancing (ELB) in AWS to split the requests between multiple instances. I have created several images of my webserver based on the same AMI, and I am able to ssh into each individually and access the site via each distinct public DNS.
I have added each of my instances to the load balancer, but they all come back with the Status: Out of Service
because they failed the health check. I'm mostly confused because I can access each instance from its public DNS, but I get a timeout whenever I visit the load balancer DNS name.
I've been trying to read through all the docs and googling it, but I'm stuck. Any pointers or links in the right direction would be greatly appreciated.
I got the same error, in my case had to copy the particular html file from s3 bucket to "/var/www/html" location. The same html referenced in load balancer path.
The issue resolved after copying html file.
Adding this because I've spent hours trying to figure it out...
If you configured your health check endpoint but it still says
Out of Service
, it might be because your server is redirecting the request (i.e. returning a301
or302
response).For example, if your endpoint is supposed to be
/app/health/
but you only enter/app/health
(no trailing slash) into the health check endpoint field on your ELB, you will not get a 200 response, so the health check will fail.In my case, the rules on security groups assigned to the instance and the load balancer were not allowing traffic to pass between the two. This caused the health check to fail.
I was working on the AWS Tutorial on hosting a web app and ran into this problem. Step 7b states the following:
They could have put the forward slash in quotations like this "/". Make sure you have that in your health checks and not this "/." .
I contacted AWS support about this same issue. Apparently their system doesn't know how to handle cases were all of the instances behind the ELB are stopped for an extended amount of time. AWS support can manually refresh the statuses, if you need them up immediately.
The suggested fix it to de-register the ec2 instances from the ELB instead of just stopping them and re-register them when you start again.