3

I've got an EC2 instance behind a load balancer which is failing the health check. When I look at the target group / targets, the instance says Status: unhealthy, Status details: Health checks failed.

The instance itself is fine. How do I troubleshoot / debug this problem?

  1. The load balancer does route requests to the instance on port 8081, and they work. The app is running ok. My guess is that is because a load balancer will "fail open".

  2. The health check url is http://my_host_name:8082/healthcheck. When I go directly to that url (with an IP address as hostname), bypassing the load balancer, I get a 200 OK.

  3. Target group health check settings: HTTP, port: 8082, path: /healthcheck. All correct, so far as I know.

  4. The request logs on the instance do not show that it is receiving a call to /healthcheck at all.

  5. I'm using the default VPC security group, which has the default rule of all traffic from another instance in the security group is allowed. I have checked that both the instance and the load balancer are in the security group. Both are in the same VPC.

  6. The instance is in Availability Zone us-east-2c. I confirmed that the load balancer includes that zone. (I can't tell what zone the load balancer itself is in. The arn just says us-east-2.)

  7. The load balancer forwards to the correct target group.

I'm guessing that it has something to with the fact that the app is on :8081 and the healthcheck is on :8082, but I really think I configured it correctly.

What am I missing here? How do I debug this?

Shef
  • 243
  • 2
  • 12

1 Answers1

0

Healthchecks initiate from load balancer. If your load balancer security group has no outbound rules, or existing outbound rules do not allow connecting to EC2 traffic port, your target group health checks will fail.

Make your your load balancer security group has at least 1 outbound rule which allows traffic to the EC2 instance port 8082.

Halil
  • 115
  • 1
  • 5