Awadhesh Kumar
Awadhesh Kumar

Reputation: 420

EC2 instance attached to a load balancer is showing Unhealthy status

I created a load balancer and assigned it one of the running EC2 instance. After creation, I navigated to Target Group section in the AWS Console under Load Balancing and when I selected the target group that was assigned to the load balancer, it shows registered instance status as "Unhealthy" and there was a message above registered instance pane that says "None of these Availability Zones contains a healthy target. Requests are being routed to all targets". While creating the load balancer, I selected all the subnets (availability zones). settings I used for health check are mentioned below,

So why does my registered instance status as "Unhealthy" and how can I rectify/resolve that to change the status to "In-service"?

Upvotes: 17

Views: 80164

Answers (5)

Pramod
Pramod

Reputation: 41

Make sure outbound rules ports are opened for (Elastic Load Balancer) ELB security group.

Upvotes: 4

choice best
choice best

Reputation: 1

Search firewall on the search box to the left of your PC, select inbound, create new rules to allow the port you use for the load balancer

Upvotes: 0

AditYa
AditYa

Reputation: 897

In my case health check configuration on ALB is / with https.

I resolved with below steps.

  1. Check the security groups - whether we have opened the required ports from ALB SG to EC2 SG.
  2. Login to server and check does IIS server's default site has 443 port opened if your health-check is on 443. (whatever port you are using for health checks).

Use the curl command to troubleshoot the issue.

  1. If you would like to check on HTTPS use the below command to check the response. Use -k or --insecure to ignore the SSL issue.

    curl https://[serverIP] -k

  2. For HTTP test use the below command.

    curl http://[serverIP]

Upvotes: 2

If you are sharing the load balancer among several EC2 instances that run similar services, make sure each of your services run in a different port otherwise your service won't be reachable and therefore your health check won't pass

Upvotes: 0

John Rotenstein
John Rotenstein

Reputation: 269111

Unhealthy indicates that the health check is failing for the instance.

Things to check:

  • Check that the instance is running a web server
  • Check that the web page at healthcheck.html responds with a valid 200 response
  • Check that instance has a security group that permits access on Port 80 (HTTP)

Upvotes: 23

Related Questions