- Newest
- Most votes
- Most comments
To troubleshoot your ECS deployment failure on EC2, you'll need to gather more detailed information since the console is showing only generic error messages.
Here are steps to diagnose the issue:
- Check CloudWatch Logs:
- Open the Amazon ECS console
- Navigate to Clusters > Your Cluster > Tasks tab
- Select the Task ID of the failed task
- Check the "Stopped Status" for more details
- Review the logs for specific errors (note that logs are only available for about an hour after the task stops)
-
Use the DescribeTasks API to get more detailed information about the task's
stoppedReason -
Verify your container instance configuration:
- Confirm that your cluster has active instances
- Ensure the task's CPU/memory requirements don't exceed the container instance's capacity
- Check if there are any port conflicts with existing tasks
- Check IAM permissions:
- Verify that your container instance role has the necessary permissions
- Ensure the task execution role has the proper permissions to pull images from ECR (if you're using ECR)
- The IAM policy "AmazonECSTaskExecutionRolePolicy" should be attached to the task execution role
- Verify network configuration:
- Check security groups and network settings
- Ensure the task has proper network connectivity
- Check for compatibility issues:
- Ensure the task definition launch type matches the cluster capacity type
- Verify that your container image URI is correct and accessible
- Look for deployment circuit breaker errors:
- If the deployment circuit breaker was triggered, it indicates repeated failures
- This could be due to failed health checks, missing ECR images, or resource constraints
Since you've already verified that resources are sufficient, the issue might be related to permissions, network configuration, or container image access. Creating and properly configuring the container instance role and task execution role is particularly important for EC2 launch type.
Sources
ECS deployment task failed (deployed on EC2) | AWS re:Post
Troubleshoot my failed Amazon ECS deployments | AWS re:Post
Troubleshoot Amazon ECS deployment failures with an activated circuit breaker | AWS re:Post
Troubleshooting Amazon ECS TaskFailedToStart errors - Amazon Elastic Container Service
Troubleshoot schedule issues for Amazon ECS tasks on EC2 instances | AWS re:Post
Relevant content
- asked 4 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a year ago
