Create a Multi-Subnet VPC with Secure Access to Private Servers with Outbound Internet Access

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

In this hands-on lab, we will create a highly-available multi-subnet VPC and subnet structure for private application servers. We’ll then configure a bastion host so that remote administrative staff can securely connect into the VPC and manage the private instances. Since these instances will require outbound access for security patches and updates, we will create and configure a NAT gateway to allow it.

Our task is to create the VPC with public and private route tables. The VPC’s CIDR, `192.168.0.0/24`, has been subnetted. Our new CIDR block `/26` allows for a maximum of 4 subnets. We will create 2 public and 2 private subnets.

Then, we will create the NACL and security group rules to support the bastion host, private instances, and NAT gateway. Once that’s done, we’ll validate the connectivity for our bastion host by creating an SSH tunnel through it to our private instance. Once we’re in, we will verify that our private instance can connect to the internet.

There is a lot to do in this hands-on lab, so let’s get started.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the VPC Skeleton
  1. Create a VPC named ATD_VPC with a CIDR block of192.168.0.0/24.
  2. Within the VPC, create 4 subnets using the CIDR block /26.
Create an Internet Gateway and a Public and Private Route Table
  1. Create an internet gateway and attach it to the VPC.
  2. Create a public route table named ATD_PublicRT with a default route to the internet gateway.
  3. Create a private route table named ATD_PrivateRT with a destination CIDR block of 192.168.0.0/24.
Configure the Bastion Host
  1. Create the NACLs named ATD_Public1 and a security group named ATD_Bastion-SG with the appropriate configuration for the bastion host.

  2. Set up the bastion host Amazon EC2 instance with the name tag BastionHost and verify connectivity using SSH.

Create an Amazon EC2 Instance in the Private Subnet
  1. Create the NACLs and security group configuration necessary to support SSH connectivity between the bastion host and an Amazon EC2 instance in the private subnet.

  2. Create an instance in the private subnet with the name tag PrivateAppServer and verify SSH connectivity from the bastion host.

Set Up the NAT Gateway and Validate Connectivity
  1. Create the NACLs required for the NAT gateway subnet.

  2. Create the NAT gateway and set it as the target for the default route in the private route table.

  3. Verify connectivity to the internet from the private EC2 instance.

Additional Resources

Please make sure you are in the us-east-1 region. Please refer to the updated Lab Guide for this activity.

Windows Users: Please use the instructions below when prompted during the video lessons:

For instructions on connecting to a Amazon Linux instance using Putty on a Windows computer, please use the following video lesson:

https://learn.acloud.guru/course/aws-certified-developer-associate/learn/d08a2b54-37e1-d237-21a7-55eea7c0fb2d/f522c2d0-a5f1-488b-44a3-6aa73de5cef2/watch

As an alternative to PuTTY, WSL2 can be used. You can find setup steps here: https://docs.microsoft.com/en-us/windows/wsl/install-win10

If you are using a Windows computer and need instructions on configuring the ssh-agent, please use these instructions:

https://aws.amazon.com/blogs/security/securely-connect-to-linux-instances-running-in-a-private-amazon-vpc/

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?