{
  "id": "aws/ecs-task-stopped-resource-cpu",
  "signature": "service unable to place tasks: reason: resource CPU was insufficient",
  "signature_zh": "服务无法放置任务：原因：CPU资源不足",
  "regex": "resource CPU was insufficient",
  "domain": "aws",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "ECS cluster or capacity provider does not have enough available CPU units to run the task definition's CPU reservation.",
  "root_cause_type": "generic",
  "root_cause_zh": "ECS集群或容量提供者没有足够的可用CPU单元来运行任务定义中预留的CPU资源。",
  "versions": [
    {
      "version": "ECS 1.62.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "AWS CLI 2.15.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase task CPU reservation in task definition",
      "why_fails": "Increasing CPU reservation makes the problem worse, as it requires even more CPU from the cluster.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set service desired count to 0 and back to original",
      "why_fails": "Recycling the service does not create new capacity; the underlying resource shortage remains.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add more memory without adding CPU capacity",
      "why_fails": "Memory is separate from CPU; the error is explicitly about CPU, so memory adjustments don't help.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Scale out the ECS cluster by adding more EC2 instances or increasing Auto Scaling group size:\naws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --desired-capacity 10 --min-size 5 --max-size 20",
      "success_rate": 0.75,
      "how": "Scale out the ECS cluster by adding more EC2 instances or increasing Auto Scaling group size:\naws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --desired-capacity 10 --min-size 5 --max-size 20",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use Fargate launch type or Fargate capacity provider with automatic scaling:\naws ecs create-service --cluster my-cluster --service-name my-service --task-definition my-task --launch-type FARGATE --network-configuration ...",
      "success_rate": 0.85,
      "how": "Use Fargate launch type or Fargate capacity provider with automatic scaling:\naws ecs create-service --cluster my-cluster --service-name my-service --task-definition my-task --launch-type FARGATE --network-configuration ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reduce CPU reservation in the task definition to fit within available cluster resources:\n{\n  \"family\": \"my-task\",\n  \"containerDefinitions\": [{\n    \"name\": \"my-container\",\n    \"cpu\": 256,\n    \"memory\": 512\n  }]\n}",
      "success_rate": 0.7,
      "how": "Reduce CPU reservation in the task definition to fit within available cluster resources:\n{\n  \"family\": \"my-task\",\n  \"containerDefinitions\": [{\n    \"name\": \"my-container\",\n    \"cpu\": 256,\n    \"memory\": 512\n  }]\n}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "通过增加更多EC2实例或扩展Auto Scaling组来扩展ECS集群：\naws autoscaling update-auto-scaling-group --auto-scaling-group-name my-asg --desired-capacity 10 --min-size 5 --max-size 20",
    "使用Fargate启动类型或Fargate容量提供者并启用自动扩展：\naws ecs create-service --cluster my-cluster --service-name my-service --task-definition my-task --launch-type FARGATE --network-configuration ...",
    "在任务定义中减少CPU预留以适应集群可用资源：\n{\n  \"family\": \"my-task\",\n  \"containerDefinitions\": [{\n    \"name\": \"my-container\",\n    \"cpu\": 256,\n    \"memory\": 512\n  }]\n}"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-04-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}