Why are properly functioning Amazon ECS tasks registered to ELB marked as unhealthy and replaced?
Last updated: 2019-06-20
Elastic Load Balancing is repeatedly flagging properly functioning Amazon Elastic Container Service (Amazon ECS) tasks as unhealthy. These incorrectly flagged tasks are stopped and new tasks are started to replace them. How can I troubleshoot this?
Some Amazon ECS tasks have several dependencies and lengthy bootstrapping processes that can exceed the ELB health check grace period, even when functioning as intended. When Amazon ECS tasks don’t respond to ELB health checks within the grace period, they're flagged as unhealthy. To increase the health check grace period for your service:
- Open the AWS Management Console.
- In the navigation bar, choose Services, and then select ECS from the list.
- Select your service from the Service Name list.
- Choose Update.
- Choose Next step.
- On the Step 2: Configure network page, change the Health check grace period to an appropriate time period for your service (maximum is 7,200 seconds).
Caution: To prevent delayed replacement of legitimately unhealthy Amazon ECS tasks, carefully estimate the grace period required for your lengthiest known tasks. When setting your grace period, consider all relevant factors such as bootstrap time and time to pull container images.
- Choose Next step, and then choose Update Service.
You can also increase the grace period: