Subnet Route Table Associations
What you'll learn: How to link route tables to specific subnets so you can control where their traffic goes.
The Core Idea
In the previous lessons, you learned that route tables contain rules (routes) that tell traffic where to go, and subnets are subdivisions of your virtual network. Now here's the crucial connection: every subnet must be associated with exactly one route table to determine its routing behavior.
Think of it like assigning a specific GPS navigation system to each neighborhood in a city. Each neighborhood (subnet) needs to know which set of directions (route table) to follow when sending traffic somewhere. Without this assignment, the subnet wouldn't know where to send packets.
How It Works
When you create a subnet, it automatically gets associated with your network's main/default route table unless you specify otherwise. However, you often want different subnets to behave differently:
- Your public subnet needs a route to the internet gateway
- Your private subnet should NOT have that internet route
To achieve this, you:
- Create a custom route table with the routes you need
- Associate that route table with your chosen subnet(s)
- The subnet now follows those routing rules exclusively
Multiple subnets can share the same route table if they need identical routing behavior. But remember: one subnet = one route table at a time. If you change the association, the new route table takes over immediately.
Why This Matters
Route table associations are how you implement network segmentation and security. By controlling which route table a subnet uses, you control whether instances in that subnet can reach the internet, access other networks, or remain isolated.
Key Takeaway: Subnet route table associations connect each subnet to a specific set of routing rules, giving you precise control over traffic flow for different parts of your network.