Skip to main content
This lesson demonstrates AWS VPC route tables: how to inspect them, how subnets are associated, and how route evaluation works (including longest-prefix matching). It covers the basic concepts and common operations you’ll use when managing VPC routing.

1) Create a VPC (with IPv6 enabled)

Start by creating a demo VPC (for example, named vpcdemo) and enable IPv6 if you need dual-stack addressing.
A screenshot of the AWS Management Console on the "Create VPC" page showing VPC settings and form fields for resources to create, name tag, IPv4/IPv6 CIDR blocks, and tenancy. The "VPC only" option is selected and the name tag is set to "vpcdemo."

2) Create subnets in the VPC

Create two subnets inside the VPC. For example:
  • Subnet A: 10.0.1.0/24 (with corresponding IPv6 block if using IPv6)
  • Subnet B: 10.0.2.0/24
Availability Zone selection does not affect routing behavior — routing is decided at the subnet level.
Screenshot of the AWS VPC Management Console on the "Create Subnet" page, showing a subnet named "subnet1" with IPv4 CIDR 10.0.1.0/24, an IPv6 block, tag fields, and the "Create subnet" button. The browser header shows the N. Virginia region.

3) Inspect the main route table

When a VPC is created, AWS automatically creates a main (default) route table for that VPC. Any subnet without an explicit association uses this main route table implicitly. Open the main route table to view its default entries. You will typically see:
  • The VPC-local IPv4 route (example: 10.0.0.0/16)
  • The VPC-local IPv6 prefix (if IPv6 is enabled)
These “local” routes are always present and are used to route traffic between subnets in the same VPC.
A screenshot of the Amazon Web Services VPC console on the Route tables page. It shows a selected route table (rtb-067e...) with two local routes—an IPv6 prefix and 10.0.0.0/16—both marked Active.

4) Subnet associations and implicit behavior

If you view the subnet associations for the main route table, AWS will show any subnets that are implicitly associated. These subnets inherit all routes from the main route table until you explicitly associate them with a different route table. When an instance sends a packet, VPC routing looks up the route table associated with that subnet and selects a route using longest-prefix (most specific) match based on the destination IP. Example of prefix specificity:
  • 10.0.1.0/24 is more specific than 10.0.0.0/16, so traffic destined for 10.0.1.5 will match the /24 route first.

5) Create a custom route table and associate subnets

To apply custom routing behavior to a particular subnet, create a new route table for the VPC (for example, my-route-table-01) and then associate a subnet with it.
Screenshot of the AWS VPC Management Console on the "Create route table" page. It shows the Route table settings with the name "my-route-table-01", a VPC dropdown, tags section, and a "Create route table" button.
After creating the route table, it will have no subnet associations initially. Use Edit subnet associations to choose which subnets should use this route table.
A screenshot of the AWS VPC console on the "Edit subnet associations" page. It lists two subnets (subnet1 and subnet2) with their Subnet IDs, IPv4/IPv6 CIDRs and route table associations, and shows a "Save associations" button.
Example: associate subnet1 with my-route-table-01. From that point, instances in subnet1 use my-route-table-01 for routing decisions. You can create and share route tables across multiple subnets — a 1:1 relationship is not required.

6) Common route edits and targets

Key points:
  • VPC local routes are created automatically and cannot be removed.
  • To enable internet access from subnets, add these routes:
    • IPv4 default route: Destination 0.0.0.0/0 -> target Internet Gateway (igw-...)
    • IPv6 default route: Destination ::/0 -> target Internet Gateway (or other IPv6-capable target)
  • Other common targets: NAT Gateway, Virtual Private Gateway (VGW), VPC peering connection, Transit Gateway (TGW), Network Interface (ENI), or an instance (via instance ID in very specific scenarios).
Use the VPC console or APIs to add/modify routes. Changes apply immediately to any subnet associated with that route table. Table: Common route targets and use cases

7) Important note

A subnet can be associated with only one route table at a time. If a subnet has no explicit association, it uses the VPC’s main route table. Route selection uses the most specific (longest-prefix) match for the destination IP.

8) Cleanup (avoid charges)

When you finish the demo, delete the VPC to avoid ongoing charges. Deleting a VPC will also remove many associated resources (subnets, route tables created for that VPC, etc.). Always review the deletion confirmation to verify which resources will be removed.
Deleting a VPC is destructive and irreversible. Confirm which resources (NAT gateways, VPNs, peering connections, EC2 instances) will be deleted or remain before you proceed.
That covers the basics: inspecting route tables, understanding implicit and explicit subnet associations, creating custom route tables, and adding routes for common targets.

Watch Video