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?
I want to place a task in Amazon Elastic Container Service (Amazon ECS). However, I receive the following error: "[AWS service] was unable to place a task because no container instance met all of its requirements."
Short description
You can receive this error due to one or more of the following reasons:
- 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 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, then 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
Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.
To resolve the error, choose a resolution based on your use case:
- 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. For more information, see the Not enough memory section in Service event messages. This section is located under: service (service-name) was unable to place a task because no container instance met all of its requirements.
- 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.
For more information, see the Not enough CPU section in Service event messages. This section is located under service (service-name) was unable to place a task because no container instance met all of its requirements. 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 elastic network interface attachment points, then add more container instances to your cluster. For more information, see the Not enough available ENI attachment points section in Service event messages. This section is located under service (service-name) was unable to place a task because no container instance met all of its requirements. If the issue persists, consider using awsvpcTrunking to increase elastic network interface density on your Amazon Elastic Compute Cloud (Amazon 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. This section is located under service (service-name) was unable to place a task because no container instance met all of its requirements. To find the missing attributes, run the ecs-cli check-attributes command:
ecs-cli check-attributes --task-def Task_Definition --container-instances Container_Instance --cluster Cluster_Name
Note: For Task_Definition Name, enter the name of your task definition. For Container_Instance, enter the name of your container instance. For Cluster_Name, enter the name of your cluster.
- You can configure an Amazon ECS service to run on a subnet that's different from the subnet for the container instance. In this case, the output of the ecs-cli-check-attributes command shows None for missing attributes, even though the task fails with the missing attribute error. Be sure that the subnets for your service and the container instance match. To do this, recreate the Amazon ECS service in the subnet where the container instance exists. For more information, see Task definition parameters and Amazon ECS container agent configuration.
For example, if you run the following command:
ecs-cli check-attributes --task-def task:1 --container-instances 650cf1df296749e1bce1b9e0cebb588a --cluster test-cluster
The output looks similar to:
Container Instance Missing Attributes tes-cluster None
For more information, run the command:
ecs-cli --help
Related information

Relevanter Inhalt
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor einem Jahr