Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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,

  • Protocol: HTTP
  • Path: /healthcheck.html
  • Port: traffic port
  • Healthy threshold: 3
  • Unhealthy threshold: 2
  • Timeout: 5
  • Interval: 10
  • Success codes: 200

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

like image 890
Awadhesh Kumar Avatar asked Dec 12 '17 06:12

Awadhesh Kumar


People also ask

What action will be taken when load balancer detect unhealthy instance?

When the load balancer determines that an instance is unhealthy, it stops routing requests to that instance. The load balancer resumes routing requests to the instance when it has been restored to a healthy state.

How do I fix an unhealthy instance in AWS?

On the Amazon EC2 console navigation pane, under Auto Scaling, choose Auto Scaling Groups, and then select the instance's group. Choose the Details view and note the Health Check Type. Choose Edit and select ELB for Health Check Type, and then choose Save.

What happens when an EC2 instance that is being served traffic from an ELB becomes unhealthy?

9: What happens when an EC2 instance that is being served traffic from an ELB becomes unhealthy? The ELB will stop serving traffic to it and divert it's traffic to a healthy instance – as this is all it can do. It is Auto Scaling which can take an unhealthy instance, terminate it, and replace it with a new instance.


1 Answers

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)
like image 105
John Rotenstein Avatar answered Oct 07 '22 15:10

John Rotenstein