Skip to main content
Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console. Open IP Lab Portal

Overview

Lab details

  1. This lab walks you through creating a VPC, some subnets, an Internet Gateway, a Route table, and then configuring these services to work together to form an effective VPC. We will be using the AWS CLI to create the VPC.
  2. Duration: 45 minutes
  3. AWS Region: US East (N. Virginia) us-east-1

Introduction

Amazon Virtual Private Cloud (Amazon VPC) is a web service offered by Amazon Web Services (AWS) that allows you to create and manage isolated networks within the AWS cloud. It essentially provides you with your own logically isolated section of the AWS cloud where you can launch AWS resources like Amazon EC2 instances, databases, and more, in a defined network environment. Here are some key concepts related to AWS VPC:
  • VPC (Virtual Private Cloud): This is the fundamental building block of AWS networking. It allows you to create a logically isolated section of the AWS Cloud to launch resources in a virtual network you define.
  • Subnet: A subnet is a range of IP addresses in your VPC. You divide the IP address range of your VPC into smaller subnets, each associated with a particular Availability Zone (AZ). Subnets can be public (accessible from the internet) or private (accessible only from within the VPC).
  • Route Table: A route table contains a set of rules, called routes, that determine where network traffic is directed. Each subnet in a VPC must be associated with a route table, which controls the traffic between subnets.
  • Internet Gateway: An internet gateway allows resources within your VPC to access the internet and enables internet traffic to reach resources in your VPC.
  • NAT Gateway/NAT Instance: Network Address Translation (NAT) gateways or NAT instances allow private instances in your VPC to initiate outbound traffic to the internet while preventing unsolicited inbound traffic from the internet.
  • Security Groups and Network Access Control Lists (NACLs): Security groups act as firewalls for Amazon EC2 instances, controlling inbound and outbound traffic. NACLs are stateless and act as a subnet-level firewall, controlling traffic at the subnet level.
  • VPC Peering: VPC peering allows you to connect two VPCs together so that instances in different VPCs can communicate using private IP addresses.
  • VPC Endpoints: VPC endpoints enable you to privately connect your VPC to supported AWS services and VPC endpoint services powered by PrivateLink.
  • VPN Connections: AWS VPN provides secure communication between your on-premises networks and your Amazon VPC over the internet.
AWS VPC provides a high level of control over your network environment, allowing you to customize IP address ranges, create subnets, control inbound and outbound traffic with security groups and NACLs, and design complex network architectures. It’s a crucial component for building secure and scalable applications in the AWS cloud.

Architecture diagram

Task details

  1. Sign in to the AWS Management Console.
  2. Create an Environment in CloudShell.
  3. Create a VPC using AWS CLI.
  4. Create a Subnet using AWS CLI.
  5. Create an Internet gateway using AWS CLI.
  6. Attach it to the VPC.
  7. Create a custom Route table for your VPC using AWS CLI.
  8. Create a public route in the Route table that points to the Internet Gateway using AWS CLI.
  9. Associate the Subnet to your Route table.
  10. View the new VPC.
  11. Validation of the Lab.

Launching the lab environment

  1. To launch the lab environment, Click on the Launch lab button.
  2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
  3. Once the lab is started, you will be provided with an IAM username, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time

Lab guide

Lab steps

Task 1: Sign in to the AWS Management Console

  1. Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
  2. On the AWS sign-in page,
  • Leave the Account ID as default. Never edit/remove the 12-digit Account ID present in the AWS Console. Otherwise, you cannot proceed with the lab.
  • Now copy your User Name and Password in the Lab Console to the IAM Username and Password in the AWS Console and click on the Sign in button
  1. Once Signed In to the AWS Management Console, Make the default AWS Region US East (N. Virginia) us-east-1.

Task 2: Create an Environment in CloudShell

  1. Make sure you are in the N.Virginia Region.
  2. Click on the cloud shell icon on the top right of the AWS menu bar.
  3. A new tab in your browser opens and if you see a welcome message to Cloud Shell, click on the Close button in that message.
  4. You will see a creating environment message on the screen.
  5. Wait for a few minutes to complete the environment creation. Once the environment is created, you are ready to use the terminal.

Task 3: Create a VPC using AWS CLI

  1. This command will create a VPC with CIDR block 10.1.0.0/16
  • The output of this command is shown below:
  • Note: Please note the VPC ID from the output and keep it in a text editor.

Task 4: Create a Subnet using AWS CLI

  1. This command will create a subnet with CIDR block 10.1.1.0/24 in the VPC created above. Enter wq if prompts with :
  • Note: Please replace <Your VPC ID> with yours.
  • The output of this command is shown below:
  • Note: Please note the subnet ID in your text editor.

Task 5: Create an Internet gateway using AWS CLI

  1. This command will create an Internet gateway.
  • The output of this command is shown below:
  • Note: Please note the Internet gateway ID in your text editor.

Task 6: Attach Internet Gateway to VPC using AWS CLI

  1. This command will attach the above created internet gateway to the VPC that you have created.
  • Note: Please replace the VPC ID and Internet gateway ID with yours.

Task 7: Create a custom Route table for your VPC using AWS CLI

  1. This command will create a custom route table in the VPC.
  • Note: Please replace the VPC ID with yours.
  • The output of this command is shown below:
  • Note: Please note down your new route table ID in your text editor.

Task 8: Create a public route in the Route table that points to the Internet gateway using AWS CLI

  1. This command will add a public route in the custom route table that you created in the above step.
  • Note: Please replace the route table ID and internet gateway ID with yours.
  • The output of this command is shown below:

Task 9: Associate the Subnet to your Route table using AWS CLI

  1. This command will associate the subnet that you created with the custom route table.
  • Note: Please replace the route table ID and subnet ID with yours.
  • The output of this command is shown below:

Task 10: View the New VPC

  1. Navigate to the Services menu in the top, then click on VPC
  2. Click on Your VPC and you will be able to see the new VPC.
  3. Click on Subnets and see the new subnet created.
  4. You can go through the Internet gateway and see its attached.
  5. Go to the Route table page and click on routes. You will be able to see the new public route.

Do you know?

AWS Direct Connect allows you to establish a dedicated network connection from your premises to AWS, bypassing the public internet.

Task 11: Validation of the Lab

  1. Once the lab steps are completed, please click on the Check my work button on the Right side panel.
  2. This will validate the resources in the AWS account and display whether you have completed this lab successfully or not.
  3. Sample output :

Completion and conclusion

  1. You have successfully logged into the AWS Management console.
  2. You have successfully created a VPC using AWS CLI.
  3. You have successfully created a Subnet using AWS CLI.
  4. You have successfully created an Internet gateway and attached it to the VPC.
  5. You have successfully created a Route table and added a public route using AWS CLI.
  6. You have successfully associated the Subnet to the route table using AWS CLI.
  7. You have successfully tested the lab.

End lab

  1. Sign out of AWS Account.
  2. You have successfully completed the lab.
  3. Once you have completed the steps click on End lab in the IP Lab Portal.

What gets checked

When you press Check my work, the platform verifies each of these:
  • Create Amazon Custom VPC Public Route Table — Check whether a Custom VPC Public Route Table is created and an Internet Gateway route is added or not.
  • Create Amazon Custom VPC — Check whether a Custom VPC is created or not.
  • Create Amazon Custom VPC Subnet — Check whether a Subnet is created for the Custom VPC or not.
  • Create Internet Gateway — Check whether an Internet Gateway is created and attached to the Custom VPC or not.