0
0
AWScloud~10 mins

Route tables configuration in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a route table in AWS using Terraform.

AWS
resource "aws_route_table" "example" {
  vpc_id = [1]
}
Drag options to blanks, or click blank then click option'
Aaws_vpc.main.id
Baws_subnet.main.id
Caws_internet_gateway.main.id
Daws_route_table.main.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using subnet ID instead of VPC ID
Referencing the internet gateway ID directly
Using the route table's own ID before creation
2fill in blank
medium

Complete the code to add a route to the route table that directs all traffic to the internet gateway.

AWS
resource "aws_route" "internet_access" {
  route_table_id         = aws_route_table.example.id
  destination_cidr_block = [1]
  gateway_id             = aws_internet_gateway.main.id
}
Drag options to blanks, or click blank then click option'
A192.168.1.0/24
B0.0.0.0/0
C10.0.0.0/16
D172.16.0.0/12
Attempts:
3 left
💡 Hint
Common Mistakes
Using a private subnet CIDR block instead of all traffic
Using a subnet CIDR block that limits traffic
Confusing the destination CIDR with the gateway ID
3fill in blank
hard

Fix the error in the route association code by completing the blank.

AWS
resource "aws_route_table_association" "example_assoc" {
  subnet_id      = [1]
  route_table_id = aws_route_table.example.id
}
Drag options to blanks, or click blank then click option'
Aaws_subnet.public.id
Baws_route_table.example.id
Caws_internet_gateway.main.id
Daws_vpc.main.id
Attempts:
3 left
💡 Hint
Common Mistakes
Using the route table ID as subnet ID
Using the internet gateway ID instead of subnet ID
Using the VPC ID instead of subnet ID
4fill in blank
hard

Fill both blanks to create a route that sends traffic to a NAT gateway for private subnet internet access.

AWS
resource "aws_route" "private_nat" {
  route_table_id         = aws_route_table.private.id
  destination_cidr_block = [1]
  [2]             = aws_nat_gateway.main.id
}
Drag options to blanks, or click blank then click option'
A10.0.0.0/16
Bnat_gateway_id
C0.0.0.0/0
Dgateway_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using gateway_id instead of nat_gateway_id
Using a private subnet CIDR block instead of all traffic
Mixing up NAT gateway and internet gateway attributes
5fill in blank
hard

Fill all three blanks to define a route table with a route and associate it with a subnet.

AWS
resource "aws_route_table" "example" {
  vpc_id = [1]
}

resource "aws_route" "example_route" {
  route_table_id         = aws_route_table.example.id
  destination_cidr_block = [2]
  gateway_id             = aws_internet_gateway.main.id
}

resource "aws_route_table_association" "example_assoc" {
  subnet_id      = [3]
  route_table_id = aws_route_table.example.id
}
Drag options to blanks, or click blank then click option'
Aaws_vpc.main.id
B0.0.0.0/0
Caws_subnet.public.id
Daws_nat_gateway.main.id
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up subnet and VPC IDs
Using NAT gateway ID instead of internet gateway ID
Using private subnet ID instead of public subnet ID