0
0
AWScloud~10 mins

CIDR blocks and IP addressing 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 define a VPC with a CIDR block of 10.0.0.0/16.

AWS
resource "aws_vpc" "main" {
  cidr_block = "[1]"
}
Drag options to blanks, or click blank then click option'
A172.16.0.0/12
B192.168.0.0/24
C255.255.255.0
D10.0.0.0/16
Attempts:
3 left
💡 Hint
Common Mistakes
Using a subnet mask like 255.255.255.0 instead of a CIDR block.
Choosing a CIDR block that is too small for the VPC.
2fill in blank
medium

Complete the code to create a subnet with CIDR block 10.0.1.0/24 inside the VPC.

AWS
resource "aws_subnet" "subnet1" {
  vpc_id     = aws_vpc.main.id
  cidr_block = "[1]"
}
Drag options to blanks, or click blank then click option'
A10.0.1.0/24
B10.0.0.0/16
C192.168.1.0/24
D172.16.1.0/28
Attempts:
3 left
💡 Hint
Common Mistakes
Using a CIDR block outside the VPC range.
Choosing a subnet that overlaps with another subnet.
3fill in blank
hard

Fix the error in the subnet CIDR block to be a valid subnet inside the VPC 10.0.0.0/16.

AWS
resource "aws_subnet" "subnet2" {
  vpc_id     = aws_vpc.main.id
  cidr_block = "[1]"
}
Drag options to blanks, or click blank then click option'
A10.1.0.0/16
B192.168.0.0/24
C10.0.2.0/24
D172.16.0.0/12
Attempts:
3 left
💡 Hint
Common Mistakes
Using a subnet CIDR block that is the same size or larger than the VPC.
Choosing a subnet outside the VPC's IP range.
4fill in blank
hard

Fill both blanks to create a subnet with 512 IP addresses inside the VPC 10.0.0.0/16.

AWS
resource "aws_subnet" "subnet3" {
  vpc_id     = aws_vpc.main.id
  cidr_block = "[1]"
  availability_zone = "[2]"
}
Drag options to blanks, or click blank then click option'
A10.0.4.0/23
Bus-east-1a
C10.0.8.0/24
Dus-west-2b
Attempts:
3 left
💡 Hint
Common Mistakes
Using a /24 subnet which only has 256 IP addresses.
Choosing an availability zone from a different region.
5fill in blank
hard

Fill all three blanks to define a route table with a route to the internet gateway for the VPC 10.0.0.0/16.

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

  route {
    cidr_block = "[1]"
    gateway_id = aws_internet_gateway.[2].id
    depends_on = [aws_internet_gateway.[3]]
  }
}
Drag options to blanks, or click blank then click option'
A0.0.0.0/0
Bigw_main
D10.0.0.0/16
Attempts:
3 left
💡 Hint
Common Mistakes
Using the VPC CIDR block instead of 0.0.0.0/0 for the route.
Mismatching the internet gateway resource name in gateway_id and depends_on.