How do I troubleshoot load balancer errors for Amazon ECS tasks on Fargate?
Last updated: 2021-01-11
I'm getting load balancer errors with my Amazon Elastic Container Service (Amazon ECS) task on AWS Fargate.
Check AWS Identity and Access Management (IAM) permissions
The ecsServiceRole role allows Amazon ECS services to register Amazon ECS containers on Fargate with the load balancer.
Confirm that you have the correct ElasticLoadBalancer permissions. For more information, see Service Scheduler IAM Role.
Check your container security group ingress rules
If your container is mapped to port 80, then your container security group must allow inbound traffic on port 80 for the load balancer health checks to pass.
Configure your load balancer for all the Availability Zones of the service
Configure your load balancer to use all the Availability Zones in an AWS Region, or at least all the Availability Zones for your containers.
If a service uses a load balancer and starts a task located in an Availability Zone that the load balancer isn't configured to use, then the task never passes the health check and the task is stopped.
Check if your load balancer health check is configured correctly
The load balancer health check parameters can be too restrictive or point to resources that don't exist. Unhealthy tasks are removed from the load balancer.
Confirm that the following parameters are configured correctly for your service load balancer:
- Ping Port
- Ping Path
- Response Timeout
- Health Check Interval
- Unhealthy Threshold
For more information, review the Elastic Load Balancing load balancer health check misconfigured section of Troubleshooting service load balancers.
For more information on health check failures caused by load balancers, see How do I troubleshoot health check failures for Amazon ECS tasks on Fargate?