Search code examples
javaamazon-web-servicesnetflix-eurekaamazon-ecselastic-load-balancer

Eureka server health check fails in AWS Application Load Balancer


I have configures a eureka server in ECS cluster, and used an application load balancer for it's service. The eureka is configured to accept authentication using the property file as below.

security.user.name=xxxxx
security.user.password=yyyy

In the load balancer i created a target group for eureka on port 8761. And i gave the '/' url for the health check. But the load balancer's health check fails with the following error.

Health checks failed with these codes: [401]

This specifies that the ALB fails to pass the health check because of the authentication. (Removing the authentication part works but it causes some other errors). Is there a way to pass the health check in ALB ?


Solution

  • The URLs used with ALB health checks must return a value between 200 and 399. Also, your ALB must be configured with the acceptable response values.

    Source: http://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html

    Anything else will result in a failure:

    • 401 will result in failure.
    • 301 with ALB not configured for 301 being OK, will result in failure.

    To pass an ALB health check, you must provide a URL that can return an acceptable status code. It can be a path dedicated for the health check, such as /System/Check/.