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. The closest matching container-instance container-instance-id has insufficient CPU units available." How can I resolve this error?
You can get this error if your closest matching container instance for task placement doesn't have enough CPU units to meet the requirements of the task definition.
Note: If you didn't receive the preceding error message, choose an article based on one of the following error messages that you received:
Check the remaining CPU units on your container instance
- Open the Amazon ECS console.
- Choose the cluster where you want to place the task, and then choose the ECS Instances tab.
- Choose the container instance with the container instance ID that was returned in your error message.
- To check the remaining CPU units on the Details tab of your instance, look for the CPU row of the table that lists the Registered and Available number of CPU units.
Note: You can also view CPU units by describing the container instance with the awscli.
Make adjustments to meet the CPU requirements
- Modify your task size to meet the CPU requirements.
Note: Optionally, you can specify the total amount of cpu used for the task. The total amount is separate from the cpu and memory values at the container definition level. The total amount of CPU is a hard limit that can't be exceeded. If you don't set CPU units at the task level, then the CPU settings specified in the container definition are used for scheduling.
- Modify your container definition parameters to meet the CPU requirements.
Note: You can modify the value of the cpu property in the container definition section of your task definition. This property corresponds to the number of CPU units that the ECS container agent reserves for your task. The amount of CPU units remaining on the EC2 instance must at least equal the amount at the container definition level. The amount of CPU units an EC2 instance can have varies by instance type used in the cluster.
- Add an additional container instance to the cluster.
Note: You might need to add a larger instance type to your container. A larger instance type provides more CPU units per instance for larger tasks. For more information on CPU availability by instance type, see Amazon EC2 Instance Types.
Launching an Amazon ECS Container Instance
Task Definition Parameters