Key Concepts
| Term | Description |
|---|---|
| VPC | Virtual Private Cloud — logically isolated section of AWS network |
| Route Table | A set of rules (routes) that determine where traffic for a subnet is directed |
| Subnet Association | Each subnet must be explicitly or implicitly associated with a route table |
| Main Route Table | The default route table automatically associated with all subnets unless overridden |
| Custom Route Table | Manually created route table for specific subnets or routing domains |
| Target | The next hop for a route (e.g. Internet Gateway, NAT Gateway, Transit Gateway) |
How Routing Works in AWS
Identify Source Subnet
When an instance sends a packet, AWS identifies which subnet the instance belongs to
Example: Default Route Table
| Destination | Target | Purpose |
|---|---|---|
10.0.0.0/16 | local | Routes traffic within the VPC (always present) |
Every VPC has an implicit local route that enables internal communication between subnets.
Example Route Tables
- Public Subnet
- Private Subnet
- Hybrid / VPN
localallows private communication within the VPC0.0.0.0/0sends all non-local traffic to the Internet Gateway- Subnets associated with this table become public subnets
Peering & Transit Gateway Routes
| Scenario | Route Example | Target | Purpose |
|---|---|---|---|
| VPC Peering | 10.2.0.0/16 | pcx-0abc9fgh | Enables routing to peer VPC |
| Transit Gateway (TGW) | 10.3.0.0/16 | tgw-0xyz1234 | Central routing hub for multi-VPC or hybrid networks |
| Direct Connect | 172.31.0.0/16 | dxvif-0de12345 | Private connection to on-premises environment |
Route Propagation
AWS can automatically propagate routes from:- VPN connections
- Direct Connect gateways
- Transit Gateways
Enable Route Propagation
Subnet Types and Route Tables
| Subnet | CIDR | Route Table | Internet Access | Description |
|---|---|---|---|---|
Public-A | 10.0.1.0/24 | rtb-public | ✅ | Internet via IGW |
Private-A | 10.0.2.0/24 | rtb-private | ❌ | NATGW via Public subnet |
VPN-Subnet | 10.0.3.0/24 | rtb-hybrid | 🔄 | VPN via VGW |
TGW-Subnet | 10.0.4.0/24 | rtb-tgw | 🔄 | Transit Gateway |
Security & Best Practices
Least Privilege Routing
Only add routes that are needed
Separation of Environments
Use separate route tables for prod/dev/test
Audit Regularly
Periodically review with
aws ec2 describe-route-tablesAvoid IGW on Private Subnets
Prevents accidental Internet exposure
Tag Route Tables
Use consistent tags (e.g.,
Environment, SubnetType)CLI Commands
- List & View
- Create & Modify
- Associate