7

I have set up a Docker container running on port 5566 with a small Django application. The Docker image is uploaded into the ECR and later used by Fargate container(s).
I have set up an ECS cluster with a VPC.
After creating the Task Definition and Service, the Service starts up 2 tasks (as it is supposed to):

Fargate Service Running

Here's the Service's Network Access (with health check grace period on 300s):

enter image description here

I also set up an Application Load Balancer (with DNS) with a target group for the service, but the health checks seem to be failing:

enter image description here

Here's the health check configuration:

enter image description here

Because the health checks are failing the tasks are terminated and new ones are started after ~every 5 minutes.

Here's the container's port mapping:

enter image description here

As one cannot access the Fargate container (via SSH for example) and the logs are empty, how should I troubleshoot the issue?

I have tried to follow every step in the Troubleshoot Your Application Load Balancer.

Feel free to ask additional information.

E. Muuli
  • 3,940
  • 5
  • 22
  • 30
  • What is your healthCheckGracePeriodSeconds defined in Service Definition? May be your application is taking time to load and in between ALB is checking the health and reporting the target health is 'unhealthy'. Try increasing the 'healthCheckGracePeriodSeconds' https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service_definition_parameters.html – Haran May 31 '19 at 16:24
  • The health check grace period for the service was 0, I changed to 300 (5 minutes). This didn't change anything, though. Also edited the post with the service's network access. – E. Muuli Jun 03 '19 at 07:54

1 Answers1

0

can you confirm once, your application is working on port 5566 inside docker?

you can check logs in cloudwatch. you'll get the link in cluster -> service -> tasks -> your task.

enter image description here

Can you post your ALB configuration? your Target group port?

Abhishek Kumar
  • 417
  • 7
  • 17
  • In my case I can see that my docker application runs correctly by going over the logs. It runs on port 5000 and I'm also exposing the port but still cannot seem to hit the endpoint with http://public-ip:5000. Request from postman times out. Any idea what else can I do? – Paras Thakur Apr 02 '22 at 18:58
  • @ParasThakur it seems 5000 is the port your docker container is running, try to check from load balancer and target group, at which port it is mapped. then try to open the load balancer dns:port – Abhishek Kumar Apr 03 '22 at 19:10
  • 1
    I was able to fix it. So the problem was my service's security group did not have an ingress rule to allow port 5000 and that's why the requests were timing out. Added that and it worked like a charm! – Paras Thakur Apr 05 '22 at 17:57