aws
resource_error
ai_generated
partial
service unable to place tasks: reason: capacity is unavailable at this time.
ID: aws/ecs-task-stuck-pending-capacity
85%Fix Rate
87%Confidence
1Evidence
2024-09-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| ecs-2024-06 | active | — | — | — |
| fargate-1.4.0 | active | — | — | — |
| ecs-cli-2.0.0 | active | — | — | — |
Root Cause
ECS cluster lacks sufficient EC2 or Fargate capacity to launch the task, often due to instance type unavailability in the AZ.
generic中文
ECS 集群缺乏足够的 EC2 或 Fargate 容量来启动任务,通常由于可用区中的实例类型不可用。
Official Documentation
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages.htmlWorkarounds
-
85% success Change the task placement strategy to spread across multiple AZs: `aws ecs update-service --cluster my-cluster --service my-service --placement-strategy type=spread,field=attribute:ecs.availability-zone`
Change the task placement strategy to spread across multiple AZs: `aws ecs update-service --cluster my-cluster --service my-service --placement-strategy type=spread,field=attribute:ecs.availability-zone`
-
75% success Use a different instance type or Fargate platform version: update the task definition to use `FARGATE` or a different CPU/memory combination.
Use a different instance type or Fargate platform version: update the task definition to use `FARGATE` or a different CPU/memory combination.
中文步骤
更改任务放置策略以跨多个可用区分布:`aws ecs update-service --cluster my-cluster --service my-service --placement-strategy type=spread,field=attribute:ecs.availability-zone`
使用不同的实例类型或 Fargate 平台版本:更新任务定义以使用 `FARGATE` 或不同的 CPU/内存组合。
Dead Ends
Common approaches that don't work:
-
90% fail
Restarting the ECS service doesn't free capacity; the underlying resource shortage persists.
-
80% fail
Increasing task count makes the problem worse by requesting more unavailable capacity.