Subnet exhausted — no more IP addresses to launch
run-instances fails: There aren't enough IP addresses available in subnet
Focused incident mode — strips away everything but this runbook.
Symptoms
- run-instances fails: There aren't enough IP addresses available in subnet
- ASG can't scale out even though CPU says it should
- New ENIs fail to attach to instances
AWS reserves 5 addresses per subnet for infrastructure. AvailableIpAddressCount already excludes them, so treat 0 as truly 0. Fix IP exhaustion at the subnet/CIDR layer — not by shrinking instance sizes.
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Available IP count
aws ec2 describe-subnets --subnet-ids <SUBNET-ID> --query 'Subnets[0].{Cidr:CidrBlock,Available:AvailableIpAddressCount}'Scaling failure output
aws autoscaling describe-scaling-activities --auto-scaling-group-name <ASG-NAME> --max-items 5
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- AvailableIpAddressCount is 0 while instances maxed out the ASG
- Subnet /28-/24 in a dense AZ
Confirm before fixing
aws ec2 describe-subnets --subnet-ids <SUBNET-ID> --query 'Subnets[0].{Cidr:CidrBlock,Available:AvailableIpAddressCount}'Confirm size vs availability
Fix
aws ec2 create-subnet --vpc-id <VPC-ID> --cidr-block <NEW-LARGER-CIDR> --availability-zone <AZ>Create a larger subnet in the same AZ and add it to the ASG
Expected: subnet-...
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
aws ec2 describe-subnets --subnet-ids <SUBNET-ID> --query 'Subnets[0].{Cidr:CidrBlock,Available:AvailableIpAddressCount}'Confirm exhaustion level
aws ec2 create-subnet --vpc-id <VPC-ID> --cidr-block <NEW-CIDR> --availability-zone <AZ>Provision replacement capacity in the same AZ
aws autoscaling update-auto-scaling-group --auto-scaling-group-name <ASG-NAME> --vpc-zone-identifier "<EXISTING-SUBNET>,<NEW-SUBNET>"Add the new subnet to the ASG
aws autoscaling set-desired-capacity --auto-scaling-group-name <ASG-NAME> --desired-capacity <N>Trigger or allow scale-out to use the new capacity
Prevention
- Size subnets for peak fleet + 20% (start /22 or larger for autoscaled tiers).
- Alert when AvailableIpAddressCount drops below 10.
- Separate lambda/LB/NAT into their own subnets so app scaling never starves them.
Related runbooks
Same stack, same failure family — worth a skim.
ec2 run-instances returns InsufficientInstanceCapacity
Load climbs but instance count stays flat
Instances in private subnets cannot reach package repos or APIs
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.