Default Routes and Local Routes
What you'll learn: How default routes send traffic to the internet and local routes handle communication within your VPC.
Every route table in a virtual network contains at least two types of routes that control where traffic goes: local routes and default routes.
Local Routes
A local route is automatically created when you build a VPC. It enables resources within your VPC (across all subnets) to talk to each other directly.
Think of it like an internal phone system in an office building—employees can dial each other's extensions without going through an outside operator. If your VPC uses the CIDR block 10.0.0.0/16, the local route says: "Any traffic destined for an IP address in the 10.0.0.0/16 range stays inside this VPC."
Key characteristic: You cannot delete or modify local routes—they're permanent and managed by the cloud provider.
Default Routes
A default route (often shown as 0.0.0.0/0) handles traffic headed outside your VPC, typically to the internet. It's like the building's front door—if the address isn't inside the building, you exit here.
For a subnet to become a public subnet, you attach an Internet Gateway to your VPC and add a default route pointing to it. Without this default route, instances have no path to reach the internet.
How They Work Together
When your VM sends a packet, the route table checks:
- Does the destination match the local route? → Send it to another resource in the VPC
- Does it match the default route (0.0.0.0/0)? → Send it through the Internet Gateway
Key Takeaway: Local routes keep traffic inside your VPC automatically, while default routes (pointing to an Internet Gateway) enable internet access for public subnets.