Search code examples
amazon-web-servicesaws-elb

ELB health check failing


an instance was taken out of service in response to a ELB system health check failure.

I hit the health check endpoint with my browser and it returns fine, but I'm getting the above message.

How can I debug this?

I've looked at instant settings => Get System Logs and nginx logs,

  • edit

nginx has

- [27/Mar/2020:05:35:42 +0000] "GET /littlehome/heartbeat/ HTTP/1.1" 200 2 2.920 2.920 "-" "ELB-HealthChecker/2.0" - [27/Mar/2020:05:35:42 +0000] "GET /littlehome/heartbeat/ HTTP/1.1" 200 2 2.858 2.856 "-" "ELB-HealthChecker/2.0"

it returned 200 for sure..

and still aws think it received 502

{
    "Target": {
        "Id": "i-085e8dffe8781f876",
        "Port": 80
    },
    "HealthCheckPort": "80",
    "TargetHealth": {
        "State": "unhealthy",
        "Reason": "Target.ResponseCodeMismatch",
        "Description": "Health checks failed with these codes: [502]"
    }
},

enter image description here


Solution

  • Based on the comments, the issue was that grace period in Auto Scaling Group was too short. The solution was to increase it.