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%修复率
87%置信度
1证据数
2024-09-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| ecs-2024-06 | active | — | — | — |
| fargate-1.4.0 | active | — | — | — |
| ecs-cli-2.0.0 | active | — | — | — |
根因分析
ECS 集群缺乏足够的 EC2 或 Fargate 容量来启动任务,通常由于可用区中的实例类型不可用。
English
ECS cluster lacks sufficient EC2 or Fargate capacity to launch the task, often due to instance type unavailability in the AZ.
官方文档
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages.html解决方案
-
更改任务放置策略以跨多个可用区分布:`aws ecs update-service --cluster my-cluster --service my-service --placement-strategy type=spread,field=attribute:ecs.availability-zone`
-
使用不同的实例类型或 Fargate 平台版本:更新任务定义以使用 `FARGATE` 或不同的 CPU/内存组合。
无效尝试
常见但无效的做法:
-
90% 失败
Restarting the ECS service doesn't free capacity; the underlying resource shortage persists.
-
80% 失败
Increasing task count makes the problem worse by requesting more unavailable capacity.