Lesson 2 of 3 Deployment Strategies and Troubleshooting

Preventing Deployment Failures from Subnet Size, Capacity and Quotas

This lesson explains deployment failures unrelated to the code: networks that run out of IP addresses, AWS capacity that runs out, and accounts that reach a quota. The exam guide names subnet sizing explicitly.

Learning outcomes

After completing this lesson, you will be able to:

  • Size subnets, accounting for reserved addresses.
  • Distinguish insufficient capacity from quota errors.
  • Resolve ENI failures for VPC-connected Lambda functions.

Subnet sizing

AWS reserves five IP addresses in every subnet: the network address, the VPC router (.1), the DNS server (.2), one reserved for future use (.3) and the broadcast address. A /28 subnet therefore offers 11 usable addresses, a /24 offers 251. Many services consume IP addresses: each EC2 instance's network interfaces, ALB nodes (which need free addresses to scale, at least 8 per subnet), NLBs, interface endpoints, NAT gateways, Lambda functions in a VPC (Hyperplane ENIs shared per subnet and security group combination), RDS instances, ECS tasks in awsvpc mode, and EKS pods with the VPC CNI. When a subnet runs out, launches fail with errors such as InsufficientFreeAddressesInSubnet, ECS tasks stay pending, and Lambda invocations fail with EC2ThrottledException or ENI errors.

A subnet's CIDR cannot be changed after creation. The fixes are to add new, larger subnets (adding a secondary CIDR block to the VPC if the primary range is exhausted), update Auto Scaling groups, ECS services and Lambda configurations to use them, and plan future addressing with VPC IPAM, which monitors IP utilisation and alerts on subnets nearing exhaustion.

Subnet sizeTotal addressesUsable
/281611
/266459
/24256251
/204,0964,091

The following diagram shows the addresses of a /28 subnet.

Usable addresses in a /28 subnet. Of its 16 addresses, AWS reserves five: the network address, the VPC router at .1, the DNS server at .2, one for future use at .3, and the broadcast address. Only 11 remain for instances, load balancer nodes, interface endpoints, Lambda ENIs and other consumers.
The CIDR is illustrative. Plan subnets for the services that will consume addresses, not only instances.
Fill in the value

Usable addresses

Exam skills 3.1.3 · 5.1.1

Calculate usable IPv4 addresses in subnets.

Log in to try this activity Interactive activities are free with an account.

Capacity and quotas

Two different limits are often confused. Insufficient capacity (InsufficientInstanceCapacity) means AWS does not currently have enough of an instance type in an AZ; it is temporary and resolved by trying other AZs or instance types, waiting, or using On-Demand Capacity Reservations for capacity that must be guaranteed. Service quotas (VcpuLimitExceeded, LimitExceededException) are limits on your account, such as running On-Demand vCPUs per instance family, Elastic IPs per Region, VPCs per Region or Lambda concurrency. The Service Quotas console and API show quotas and usage, request increases and publish usage metrics to CloudWatch so that alarms can warn before a quota is reached. Quota increases can take time, so DR Regions should have matching quotas in advance.

Troubleshooting scenario

Deployments that run out

Exam skills 3.1.3

Fix deployments that fail because of capacity or quotas.

Log in to try this activity Interactive activities are free with an account.
Worked example

Lambda functions failing in a VPC

After traffic grows, a VPC-connected Lambda function begins failing with Lambda was unable to create an ENI. Its two /27 subnets are almost full because they also host an EKS node group whose pods take IPs from the same ranges. The operator adds a secondary CIDR block to the VPC, creates two /22 subnets dedicated to Lambda, updates the function's VPC configuration and creates an IPAM alarm on subnet utilisation above 80%.

Check yourself

How many usable addresses does a /28 subnet have?

Show answer

11, because AWS reserves five addresses in every subnet.

Exam Tips

Remember for the exam

  • AWS reserves five IPs per subnet; a /28 has 11 usable addresses.
  • Subnets cannot be resized; add subnets or a secondary VPC CIDR.
  • InsufficientInstanceCapacity is AWS capacity; VcpuLimitExceeded is a quota.
  • Use Service Quotas to monitor usage and request increases; match quotas in DR Regions.
  • Capacity Reservations guarantee capacity in an AZ.