# AWS NWD4: Route Table

A **Route Table** in Amazon Virtual Private Cloud is a set of rules that determines **where network traffic should be directed** inside a VPC. It acts like a navigation map that tells AWS **which path a packet should follow** to reach its destination.

Every route table contains **routes**, and each route has two main parts:

*   **Destination**: The IP range where traffic is going
    
*   **Target**: The resource that should receive the traffic
    

## Why Route Tables Are Important

Route tables are responsible for **controlling the flow of network traffic** between:

*   Subnets
    
*   The internet
    
*   Other VPCs
    
*   On-premise networks
    

Without route tables, AWS resources inside a VPC **would not know how to reach other networks**.

## Example Route Table

| Destination | Target | Meaning |
| --- | --- | --- |
| 10.0.0.0/16 | local | Internal VPC communication |
| 0.0.0.0/0 | Internet Gateway | Send internet traffic outside |

Explanation:

*   `local` means traffic stays inside the VPC
    
*   `0.0.0.0/0` means **all internet traffic**
    

## Types of Route Tables

### Main Route Table

Every VPC automatically has a **main route table**.  
Subnets use this table **unless another route table is explicitly associated with them**.

### Custom Route Table

You can create additional route tables and attach them to specific subnets to control traffic differently.

## How Route Tables Work

When a packet enters a VPC:

1.  AWS checks the **destination IP address**
    
2.  The **VPC router** looks at the subnet's route table
    
3.  It matches the destination with the correct route
    
4.  The packet is forwarded to the **target resource**
    

## Common Route Targets

Route tables can send traffic to:

*   Internet Gateway (internet access)
    
*   NAT Gateway (internet access for private subnets)
    
*   VPC Peering connections
    
*   VPN gateways
    
*   Transit gateways
    
*   Local VPC network
    

The route table decides **which subnet or gateway should receive the packet next**.

## Key Points for Interviews and AWS Exams

*   Route tables control **traffic routing inside a VPC**
    
*   Each subnet must be associated with **one route table**
    
*   A route consists of **destination and target**
    
*   The **main route table** is used by default
    
*   Custom route tables allow **fine-grained traffic control**
    

## One Line Definition

A route table is a **set of routing rules that determines how network traffic flows within and outside a VPC**.
