Search code examples
amazon-web-servicesamazon-ec2amazon-ecshealth-monitoringelastic-load-balancer

Health check on container port and host port in ECS + ALB


I have a problem with my deployment in ECS.

I try to deploy 4 instances of 2 docker images on 2 EC2 instances with an ALB in front.

So in my tasks definitions, I use the dynamic port mapping (2 Nginx on container port 80).

This creates a trouble in the Health check of my target group. In fact, for each instance, I have a health check on the dynamics port (that is ok) and on the container port (80).

So the dynamic port says, it's ok. And the container port, logically says unhealthy ... (Like in my screenshot) enter image description here

So can you help me ton find why I have that type of error (this error make my server terminated each 5 minutes....)

Thanks in advance for your help :D


Solution

  • I found the solution with the AWS support.

    So there are two problems here:

    1. To disable the health which kill the EC2 instance, go to the auto scaling group and switch health check to "EC2" type

    2. To remove the health check on port 80, go to the auto scaling group, and under "Target groups" section, removes the target groups managed by ECS