0
0
AWScloud~10 mins

Route tables configuration in AWS - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Route tables configuration
Create VPC
Create Subnets
Create Route Table
Add Routes to Route Table
Associate Route Table with Subnet
Traffic follows routes for subnet
This flow shows how to create a route table, add routes, and associate it with a subnet so traffic knows where to go.
Execution Sample
AWS
resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_subnet" "subnet1" {
  vpc_id = aws_vpc.main.id
  cidr_block = "10.0.1.0/24"
}

resource "aws_internet_gateway" "igw" {
  vpc_id = aws_vpc.main.id
}

resource "aws_route_table" "rt" {
  vpc_id = aws_vpc.main.id
}

resource "aws_route" "route1" {
  route_table_id = aws_route_table.rt.id
  destination_cidr_block = "0.0.0.0/0"
  gateway_id = aws_internet_gateway.igw.id
}

resource "aws_route_table_association" "a" {
  subnet_id = aws_subnet.subnet1.id
  route_table_id = aws_route_table.rt.id
}
This code creates a VPC, a route table, adds a route to the internet gateway, and associates the route table with a subnet.
Process Table
StepActionResource Created/ModifiedState ChangeResult
1Create VPCaws_vpc.mainVPC with CIDR 10.0.0.0/16 createdVPC ready for subnets
2Create Route Tableaws_route_table.rtRoute table linked to VPC createdRoute table ready for routes
3Add Routeaws_route.route1Route to 0.0.0.0/0 via IGW addedRoute table can send traffic to internet
4Associate Route Tableaws_route_table_association.aRoute table associated with subnet1Subnet1 uses this route table
5Traffic FlowN/ASubnet1 traffic follows route table routesSubnet1 can reach internet via IGW
6EndN/AAll resources created and linkedConfiguration complete
💡 All steps completed; route table configured and associated with subnet
Status Tracker
ResourceInitialAfter CreationAfter Route AddedAfter AssociationFinal
VPCNone10.0.0.0/16 createdNo changeNo change10.0.0.0/16 active
Route TableNoneCreated linked to VPCRoute to 0.0.0.0/0 addedAssociated with subnet1Active with routes and association
RouteNoneNoneRoute to internet gateway addedNo changeActive route to IGW
Subnet AssociationNoneNoneNoneRoute table associatedSubnet1 uses route table
Key Moments - 3 Insights
Why do we need to associate a route table with a subnet?
Because without association, the subnet does not know which routes to use. See execution_table step 4 where association links the route table to subnet1.
What happens if we add a route but do not associate the route table with any subnet?
The route exists but no subnet uses it, so traffic from subnets will not follow that route. This is shown by the absence of association in step 4.
Can a route table have multiple routes?
Yes, route tables can have many routes directing traffic to different destinations. Here we added one route in step 3, but more can be added similarly.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step is the route to the internet gateway added?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Check the 'Action' and 'Result' columns in execution_table row for step 3.
According to variable_tracker, what is the state of the route table after association?
ACreated but no routes
BAssociated with subnet but no routes
CHas routes and associated with subnet
DNo association or routes
💡 Hint
Look at the 'Route Table' row under 'After Association' in variable_tracker.
If we skip step 4 (association), what will be the result for subnet1 traffic?
ASubnet1 traffic will not use the route table routes
BSubnet1 traffic will follow the route table routes
CSubnet1 will have internet access anyway
DSubnet1 will be deleted
💡 Hint
Refer to key_moments question about association importance and execution_table step 4.
Concept Snapshot
Route tables control where subnet traffic goes.
Create a route table in your VPC.
Add routes to direct traffic (e.g., to internet gateway).
Associate the route table with subnets.
Subnets use associated route tables to send traffic.
Without association, routes are ignored.
Full Transcript
This visual execution shows how to configure route tables in AWS. First, a VPC is created with a CIDR block. Then a route table is created and linked to the VPC. Next, a route is added to the route table directing traffic to the internet gateway. After that, the route table is associated with a subnet so that subnet's traffic follows the routes. Finally, traffic from the subnet can reach the internet via the route table. Key points include the necessity of associating route tables with subnets and that routes only take effect when associated. The execution table and variable tracker show each step and resource state changes clearly.