Route Tables and Subnet Associations
What you'll learn: How route tables control traffic flow between subnets and external networks to enforce network security boundaries.
The Core Concept
A route table is like a GPS map for network packets—it contains rules (routes) that determine where traffic goes when it leaves a subnet. Every subnet in your VPC must be associated with exactly one route table, which dictates whether traffic stays within your VPC, flows to the internet, or reaches other private networks.
Think of route tables as traffic directors at intersections. When a packet leaves a subnet, the route table examines its destination IP and matches it against configured routes (most-specific match wins), then forwards it to the specified target: an internet gateway, NAT gateway, virtual private gateway, or another subnet within the VPC.
Security Implications
Route tables are critical security controls because they enforce network segmentation:
- Public subnet route tables typically include a route to an internet gateway (
0.0.0.0/0 → igw-xxxxx), allowing instances to communicate directly with the internet - Private subnet route tables omit internet gateway routes, preventing direct inbound access from the internet
- Isolated subnet route tables may only contain local VPC routes, completely blocking external connectivity
Key Security Patterns
Defense-in-depth: Use route table associations alongside security groups and NACLs. Even if security group rules are misconfigured, a private subnet without an internet gateway route prevents direct external exposure.
Least privilege routing: Only add routes that are strictly necessary. Don't associate a public subnet route table with a database subnet that should never touch the internet.
Audit trail: Route table changes should be logged and monitored—an unauthorized route to an internet gateway could expose sensitive resources.
Key Takeaway: Route tables act as foundational network access controls by explicitly defining where traffic can flow, making subnet association decisions a critical security architecture choice that complements but operates independently from security groups and NACLs.