CloudConsole

service was unable to place a task because no container instance met all of its requirements

Updated 16 November 2026 · How we write and check guides

Short answer

The ECS scheduler couldn't find an EC2 container instance in the cluster with enough free CPU, memory, ports or network interfaces for the task, or one that satisfies its placement constraints. The rest of the message names the closest instance and what it lacked. Add capacity (ideally with a capacity provider using managed scaling), make tasks smaller, or remove the conflict such as a fixed host port.

Fix it for good, in 4 steps: 1. Use a capacity provider with managed scaling; 2. Right-size reservations; 3. Spread or…
The diagnosis and fix steps from this page, in the order to try them; commands and details are below.

Read the full service event

service api was unable to place a task because no container instance met all of its requirements.
The closest matching container-instance 5c1f… has insufficient memory available.

This message applies to the EC2 launch type and EC2 capacity providers, where tasks run on instances you manage. Fargate has its own capacity errors. Get recent events with:

aws ecs describe-services --cluster prod --services api \
  --query 'services[0].events[:5].message' --output text

What the closest-instance reason means

ReasonCauseFix
insufficient memory available / insufficient CPU units availableTask's CPU or memory reservation exceeds what's free on every instanceAdd instances, use larger types, or reduce the task size
is already using a port required by your taskBridge or host networking with a fixed hostPort: one task per instance per portUse dynamic host ports (hostPort 0) behind a load balancer, or awsvpc networking
ENI or network interface limitsawsvpc tasks each take an ENI; instances support a limited numberEnable ENI trunking, use larger instance types, or fewer tasks per instance
does not match the required attribute / constraintsPlacement constraints (instance type, AZ, custom attributes) exclude every instanceRelax the constraint or add matching instances
No container instancesCluster empty, or agents disconnectedCheck the Auto Scaling group and the agent

Check what's free

aws ecs list-container-instances --cluster prod --status ACTIVE

aws ecs describe-container-instances --cluster prod \
  --container-instances 5c1f… \
  --query 'containerInstances[].{id: ec2InstanceId, agent: agentConnected, running: runningTasksCount,
           free: remainingResources[?name==`CPU` || name==`MEMORY`].[name,integerValue]}'

Compare free CPU and memory with the task definition's reservations. Remember that a task with 2 vCPU (2048 units) can't fit on an instance with 1,500 units free, even if the cluster as a whole has plenty spread across many instances; that fragmentation is common with large tasks.

Also check agentConnected: instances whose ECS agent has disconnected can't receive tasks, which often happens after a broken AMI update or an instance role change.

Fix it for good

  • Use a capacity provider with managed scaling on the Auto Scaling group. ECS then scales the group out when tasks can't be placed, instead of leaving them pending.
  • Right-size reservations. Set task CPU and memory from observed usage plus headroom; oversized reservations waste capacity and cause this error first.
  • Spread or binpack deliberately. binpack on memory fills instances fully and leaves room for large tasks elsewhere; spread across AZs improves resilience.
  • Deployment headroom. Rolling deployments with a maximum percent of 200% need room for the new tasks before old ones stop. Lower it or keep spare capacity.

If you don't need to manage instances, moving the service to Fargate removes this whole class of placement problem.

Questions

What does unable to place a task mean in ECS?

No registered EC2 container instance had enough free resources, ports or network interfaces, or met the placement constraints, for the task. The message names the closest instance and its shortfall.

Why is my ECS deployment stuck with tasks unable to be placed?

Rolling deployments start new tasks before stopping old ones. If the cluster has no spare room, the new tasks can't be placed. Add capacity or lower the deployment's maximum percent.

Does this error happen on Fargate?

No. This message is for EC2-based capacity. Fargate reports its own errors when it can't provide capacity.

CloudConsole ECS service screen on a phone, for following up on service was unable to place a task because no container…
When this happens away from your desk

Placement failures leave a service below its desired count, which is the moment you want to know about. CloudConsole, a phone app for AWS, is built to show running versus desired tasks and the service's events on your phone.

Did it start after a deploy? What changed? on the app’s alarm screen lists the deploys and configuration changes from the hour before the alarm fired.

About the app → · Download on the App Store

Sources