Topic lessonTopic: VPC: address and connectivity design
VPC subnet design: plan Availability Zones, CIDRs and routes
A subnet assigns part of a VPC’s address space to one Availability Zone (AZ). A “public” or “private” name does not configure connectivity. Work through a two-AZ application example, separating address allocation, route tables and traffic permissions.
Allocate non-overlapping subnets across AZs and use their actual route-table associations to explain public routing and outbound access.
Know what CIDR ranges, VPCs, AZs, route tables and security groups mean. The example uses IPv4 with ordinary AWS address reservations. No AWS login or resource creation is required.
A subnet connects an AZ, an address range and a purpose
An internet gateway (IGW) supports traffic between a VPC and the internet; route tables determine which traffic is sent there. A security group controls traffic at the resource, while a network ACL controls traffic at the subnet boundary. Neither replaces routing.
A VPC belongs to a Region; a subnet belongs entirely to one AZ. One subnet cannot span two AZs. A multi-AZ design therefore needs separate subnets. Record the AZ, CIDR, intended resources and route-table association as distinct decisions.
| Term | What it defines | What it does not establish |
|---|---|---|
| VPC CIDR | An address range associated with the VPC | Which subnets can reach external destinations |
| Subnet | An address allocation within one AZ | Application health or security |
| Route table | Where matching destination traffic is sent | SG, NACL or application permissions |
| Public / private | Classification by direct routing to an IGW | A change produced by a name or tag alone |
Worked design: four subnets in two AZs
Use 10.64.0.0/16 for this synthetic VPC. AZ-A and AZ-B are explanatory labels, not actual AWS AZ names. Allocate one /24 for ingress resources and another /24 for applications in each AZ. “Ingress” describes a purpose; the next section defines routing. This example creates no applications or load balancers.
10.64.0.0/16AZ-A
Separate ingress and application address ranges.
AZ-B
Use ranges that do not overlap with AZ-A.
Boxes show placement and address allocations, not traffic paths. Review route tables in the following table.
The boxes show placement and address containment, not a traffic sequence. All four /24 ranges are inside 10.64.0.0/16 and do not overlap. Unallocated space remains, but this diagram alone does not prove compatibility with future services or connected networks.
Route tables: inspect associations rather than names
Each subnet uses one route table at a time. Without an explicit association it uses the VPC’s main route table. Several subnets may share a table. Renaming a subnet changes neither its association nor its routes.
| Associated subnets | Table | Destination → target | What this establishes |
|---|---|---|---|
| Ingress A and B | rt-ingress | 10.64.0.0/16 → local; 0.0.0.0/0 → IGW | A direct default route to the IGW |
| Application A | rt-app-a | 10.64.0.0/16 → local | No default route outside the VPC in this table |
| Application B | rt-app-b | 10.64.0.0/16 → local | No default route outside the VPC in this table |
The ingress subnets are public in this example, but that does not prove an EC2 instance is reachable from the internet. An IPv4 instance using the IGW also needs a public IPv4 address and suitable SG, NACL, OS and listening-service settings. Application subnets have no direct IGW route; even traffic matching local routes can still be denied by controls.
Choose an option to see the result and explanation.
Address capacity: /24 does not mean 256 instances
In an ordinary AWS IPv4 subnet, AWS reserves the first four addresses and the last address. A /24 contains 256 addresses, normally leaving 251 assignable addresses. In 10.64.16.0/24, .0–.3 and .255 are reserved. This is an address count, not a promise of 251 EC2 instances. Allow for multiple addresses and service-managed network interfaces. BYOIP exceptions are outside this example.
| Area | What to review in this example |
|---|---|
| Normal operation | Count ENIs and addresses, including resources other than EC2 |
| Scaling and replacement | Allow for old and new resources to overlap during changes |
| An AZ failure | Plan for added resources and address demand in the remaining AZ |
| Future connections | Record ranges that do not overlap with other VPCs or corporate networks |
Choose an option to see the result and explanation.
When outbound access is needed, identify destinations first
A NAT gateway translates source addresses for connections initiated inside. A VPC endpoint provides VPC-side connectivity to supported services or other supported destinations. They are not interchangeable exits for every destination: select the type that fits the traffic.
The application route tables have no outbound default route. If the workload needs updates or AWS APIs, identify the destinations and purpose. Suitable NAT architecture can support general IPv4 internet egress; supported AWS services may be reached through VPC endpoints. These choices have different scope and cost, so making every application subnet public is not a substitute for a design.
Review placement and routing together
- Check overlaps with planned VPC and corporate connections. Ensure subnets are inside the VPC range and do not overlap.
- Record each subnet’s AZ and purpose. Two AZ boxes alone do not establish resilience.
- Record actual route-table associations; inspect the main table when there is no explicit association.
- For each destination, separate routing, address family, SG/NACL controls and service permissions.
- Estimate address use and costs during normal operation, updates and failures; fix missing conditions without broadly increasing exposure.
Check, then explain in your own words
- Explain why the four subnet ranges fit without overlap.
- Identify Application A’s route table and whether it provides external routing.
- List the additional conditions needed to reach an EC2 instance in Ingress A.
Check your understanding: If Application B is renamed public-app, does it gain external connectivity?
A name change does not provide connectivity; inspect the associated route table and required traffic conditions.
The example’s rt-app-b contains only a local route. Design routing, addressing, controls and destination requirements for the intended traffic, then validate the changed environment separately.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- Subnet basicsChecked:
Scope and conditionsOne AZ per subnet; address families and route-based public/private/isolated classification, distinct from traffic permission.
Used in this lessonA subnet connects an AZ, an address range and a purpose Worked design: four subnets in two AZs Route tables: inspect associations rather than names When outbound access is needed, identify destinations first
- VPC subnet CIDR blocksChecked:
Scope and conditionsAWS subnet size restrictions and reserved addresses differ from generic arithmetic
Used in this lessonWorked design: four subnets in two AZs Address capacity: /24 does not mean 256 instances
- Subnet route tablesChecked:
Scope and conditionsSubnet associations, implicit main-table use, destinations, targets and IPv4/IPv6 distinction.
Used in this lessonA subnet connects an AZ, an address range and a purpose Route tables: inspect associations rather than names When outbound access is needed, identify destinations first
Scope and conditionsInternet-gateway attachment/routing and public IPv4 for the selected direct-internet IPv4 method. Not a complete end-to-end connection guarantee.
Used in this lessonA subnet connects an AZ, an address range and a purpose Route tables: inspect associations rather than names
- Security group rulesChecked:
Scope and conditionsAllow-rule fields, associated-rule aggregation and effects of changes; not universal application reachability.
Used in this lessonA subnet connects an AZ, an address range and a purpose Route tables: inspect associations rather than names
- Network ACL rulesChecked:
Scope and conditionsDirection, protocol, port, peer CIDR and first matching rule in ascending order.
Used in this lessonA subnet connects an AZ, an address range and a purpose Route tables: inspect associations rather than names
- NAT gatewaysChecked:
Scope and conditionsInitiated outbound connections; public/private NAT connectivity, IPv4 translation and IPv6 DNS64/NAT64 boundaries. Zonal placement is distinguished from regional mode.
Used in this lessonWhen outbound access is needed, identify destinations first
- Gateway endpointsChecked:
Scope and conditionsS3/DynamoDB gateway routes and prefix-list specificity, supported IP/DNS modes and controls; not PrivateLink; no additional gateway endpoint charge.
Used in this lessonWhen outbound access is needed, identify destinations first
Scope and conditionsService-supported interface endpoint ENIs, subnet/AZ choice, private DNS prerequisites, SGs and hourly/processing charges.
Used in this lessonWhen outbound access is needed, identify destinations first