Skip to main content

Create a Custom AWS VPC and DHCP Option Set

Hands-On Lab

 

Photo of Tia  Williams

Tia Williams

AWS Training Architect II in Content

Length

00:30:00

Difficulty

Intermediate

The goal of this hands-on lab is to create a custom DHCP option set for the VPC. We will walk through a VPC refresher and build a VPC from scratch, and then create the custom DHCP option set and assign the new option set to an EC2 instance.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Create a Custom AWS VPC and DHCP Option Set

Introduction

The goal of this hands-on lab is to create a custom DHCP option set for the VPC. We will walk through a VPC refresher and build a VPC from scratch, and then create the custom DHCP option set and assign the new option set to an EC2 instance.

Solution

Log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.

Create an AWS VPC

Create VPC

  1. Navigate to VPC > Your VPCs.
  2. Click Create VPC, and set the following values:
    • Name tag: MyVPC
    • IPv4 CIDR block: 10.0.0.0/16
  3. Leave the IPv6 CIDR block and Tenancy fields as their default values.
  4. Click Create.

Create (and Attach) Internet Gateway

  1. Click Internet Gateways in the left-hand menu.
  2. Click Create internet gateway.
  3. Give it a Name tag of "MyIGW".
  4. Click Create.
  5. Once it's created, click Actions > Attach to VPC.
  6. In the dropdown, select MyVPC.
  7. Click Attach.

Create (and Associate) Route Table and Routes

  1. Click Route Tables in the left-hand menu.
  2. Click Create route table, and set the following values:
    • Name tag: PublicRT
    • VPC: MyVPC
  3. Click Create.
  4. Once it's created, select it.
  5. Click the Routes tab.
  6. Click Edit routes.
  7. Click Add route.
  8. Set the following values:
    • Destination: 0.0.0.0/0
    • Target: Internet Gateway, MyIGW
  9. Click Save routes.

Create Subnet

  1. Click Subnets in the left-hand menu.
  2. Click Create subnet, and set the following values:
    • Name tag: Public Subnet
    • VPC: MyVPC
    • Availability Zone: No preference
    • IPv4 CIDR block: 10.0.1.0/24
  3. Click Create.
  4. Click the Route Table tab.
  5. Click Edit route table association.
  6. Set Route Table ID to PublicRT.
  7. Click Save.

Create a Custom DHCP Options Set

Create EC2 Instance

  1. In a new browser tab, navigate to EC2 > Instances.
  2. Click Launch Instance.
  3. On the AMI page, select the Amazon Linux 2 AMI.
  4. Leave t2.micro selected, and click Next: Configure Instance Details.
  5. On the Configure Instance Details page:
    • Network: MyVPC
    • Subnet: Public Subnet
    • Auto-assign Public IP: Enable
  6. Click Review and Launch, and then Launch.
  7. In the key pair dialog, select Create a new key pair.
  8. Give it a Key pair name of "mykeypair".
  9. Click Download Key Pair, and then Launch Instances.
  10. Click View Instances, and give it a few minutes to enter the running state.

Create DHCP Options Set

  1. In the VPC browser tab, click DHCP Options Sets in the left-hand menu.
  2. Click Create DHCP options set, and set the following values:
    • Name: MyDHCPOptions
    • Domain name: mydomain.example.com
  3. Click Create DHCP options set.
  4. Select our newly created DHCP options set.
  5. Observe what's listed under Options in the Details tab.
  6. Click Your VPCs in the left-hand menu.
  7. With our VPC selected, click Actions > Edit DHCP options set.
  8. The default DHCP options set will automatically be listed in the dropdown, so select MyDHCPOptions instead.
  9. Click Save.

Create Another EC2 Instance

  1. In the EC2 instances browser tab, click Launch Instance.
  2. On the AMI page, select the Amazon Linux 2 AMI.
  3. Leave t2.micro selected, and click Next: Configure Instance Details.
  4. On the Configure Instance Details page:
    • Network: MyVPC
    • Subnet: Public Subnet
    • Auto-assign Public IP: Enable
  5. Click Review and Launch, and then Launch.
  6. In the key pair dialog, select Choose an existing key pair.
  7. Select the mykeypair.
  8. Check the acknowledgment checkbox.
  9. Click Launch Instances.
  10. Click View Instances, and give it a few minutes to enter the running state.
  11. Observe the new instance's private DNS listed in the Description section — it should include the domain name we entered for our DHCP options set.

Conclusion

Congratulations on successfully completing this hands-on lab!