How do I resolve the "[AWS service] was unable to place a task because no container instance met all of its requirements" error in Amazon ECS?
Last updated: 2019-07-03
When I try to place a task in Amazon Elastic Container Service (Amazon ECS), I receive the following error: "[AWS service] was unable to place a task because no container instance met all of its requirements." How can I resolve this error?
Short Description
You can receive this error due to one of the following issues:
- No container instances were found in your cluster
- The port needed by the task is already in use
- Not enough memory for your tasks
- Not enough CPU units for your container instance
- Not enough available elastic network interface (ENI) attachment points
- A required attribute is missing for your container instance
For more information on these issues, see Service Event Messages.
Note: If you didn't receive the preceding error message, choose an article based on one of the following error messages that you received:
- [AWS service] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id has insufficient CPU units available.
- [AWS service] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id encountered error "AGENT".
Resolution
To resolve the error, choose a resolution based on one of the following issues:
- If there are no container instances registered in your cluster, then add container instances to your cluster.
- If the port required by the task is in use, then add container instances to your cluster, or reduce your number of desired tasks.
Note: If possible, consider using dynamic port mapping to allow your tasks to use any available port on a container instance. - If the container instance doesn't have enough memory for your tasks, then reduce the amount of memory in your task definition, or launch more container instances in your cluster.
Note: For more information, see the Not enough memory section in Service Event Messages. - If the container instance doesn't have enough CPU units, then adjust the CPU required by the tasks, or launch more container instances in your cluster.
Note: For more information, see the Not enough CPU section in Service Event Messages. Or, refer to How do I resolve "the closest matching container-instance container-instance-id has insufficient CPU units available" error in Amazon ECS? - If the container instance doesn't have any available ENI attachment points, then add more container instances to your cluster.
Note: For more information, see the Not enough available ENI attachment points section in Service Event Messages. If the issue persists, consider using awsvpcTrunking. This will increase ENI density on your EC2 instances. - If the container instance is missing a required attribute, then refer to the Container instance missing required attribute section in Service Event Messages. To find the missing attributes, use the ecs-cli check-attributes command.
Note: For more information on the attributes required for specific task definition parameters and agent configuration variables, see Task Definition Parameters and Amazon ECS Container Agent Configuration.
Related Information
Did this article help you?
Anything we could improve?
Need more help?