I've been following lynda.com's AWS essential training and I've successfully set up an EC2 instance but when I try to put it behind a load balancer I can not access it through the ELB's public DNS.

On the AWS Load Balancer console it says the status of my instance is OutOfService. As per the tutorial I set up the a health check for the load balancer with a path of /heartbeat.php.

I also have two security groups set up. The first one is named Load Balancer - Prod which allows HTTP traffic on port 80 in from anyone. My Load balancer belongs to this security group. Additionally I have a security group called Web Tier - Prod which only allows HTTP traffic on port 80 from the Load Balancer - Prod security group and my own IP, SSH on my IP and MYSQL traffic from itself, the Web Tier - Prod security group.

I can access the instance with it's own public DNS and I can SSH into it, I just can't access it via the load balancers public DNS.

When I ssh into it and chack the NGINX access logs, I see this logged many times.

172.??.??.?? - - [26/Aug/2015:16:43:46 +0000] "GET /heartbeat.php HTTP/1.1" 401 203 "-" "ELB-HealthChecker/1.0"

I should be seeing a 200 status code instead of 401 203 I guess. I tried changing permissions on /var/www/ to 777 recursively as a test but that made no difference.

1 Answer 1


If the status check is returning a 401, AWS sees the instance as unhealthy and takes it out of the ELB. Since you have no healthy instances, the ELB is down.

Note that AWS accesses /heartbeat.php via IP, not via DNS name. Check the response using curl -I http://<your instance IP>/heartbeat.php and adjust your server config if it's not being served by the default virtualhost.

  • 1
    Thanks for the suggestion, I forgot I had HTTP Auth on, using the curl command helped me spot it thanks :)
    – Holly
    Aug 27, 2015 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.