# 实例容量不足：您请求的可用区当前没有足够的容量

- **ID:** `aws/ec2-insufficient-instance-capacity`
- **领域:** aws
- **类别:** resource_error
- **错误码:** `InsufficientInstanceCapacity`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

指定可用区中的 AWS EC2 实例集群缺乏所请求实例类型的可用计算容量，通常是由于高需求或资源限制。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ec2-2024-01-01 | active | — | — |
| aws-cli/2.17.0 | active | — | — |

## 解决方案

1. ```
   更改实例类型为类似但不太流行的类型（例如，从 t3.medium 改为 t3.large 或 t4g.medium）并重新启动。
   ```
2. ```
   使用不同的可用区，或在 Auto Scaling 组中启用“无首选可用区”。对于 CLI：`aws ec2 run-instances --placement AvailabilityZone=us-east-1b`
   ```
3. ```
   使用按需容量预留或 Savings Plans 提前预留容量。创建预留：`aws ec2 create-capacity-reservation --instance-type t3.medium --availability-zone us-east-1a --instance-count 5`
   ```

## 无效尝试

- **Retry the same request repeatedly without changes** — AWS capacity is per-AZ and per-instance-type; retrying the same request won't allocate new capacity if it's exhausted across that AZ. (95% 失败率)
- **Increase the instance count in the same request expecting partial fulfillment** — The error is a hard capacity check; AWS rejects the entire launch request if any instance cannot be placed, not a partial fulfillment. (90% 失败率)
