How do I troubleshoot Amazon ECS tasks on Fargate that stop unexpectedly?
Last updated: 2020-12-17
My Amazon Elastic Container Service (Amazon ECS) tasks on AWS Fargate stop unexpectedly.
Your tasks can stop when your Amazon ECS container exits due to application issues, resource constraints, or other issues.
Note: If your Fargate tasks are failing to launch and are stopping due to network configuration or resource constraint issues, see Stopped tasks error codes.
To identify why your tasks stopped, try the following troubleshooting options:
- Check for diagnostic information in the service event log.
- Check stopped tasks for errors.
Note: You can see stopped tasks in the returned results for at least one hour.
- To check your logs for application issues, use log configuration options in your task definition to send logs to a custom log driver for the container. For example, you can send logs to Amazon CloudWatch or use a supported log driver.
Note: By default, captured logs show the command output that you see in an interactive terminal if you run the container locally, in the STDOUT and STDERR I/O streams. The awslogs log driver passes these logs from Docker to Amazon CloudWatch Logs.
- If the awslogs log driver is configured in your task definition, then check CloudWatch Logs for the container from the Amazon ECS console.