Extra Networking Lab 1 Multi-VPC Account Architecture
Extra Networking Lab 1 Multi-VPC Account Architecture
An internet gateway (IGW) is a horizontally scaled, redundant, and highly available VPC
component that allows communication between instances in your VPC and the internet. It
therefore imposes no availability risks or bandwidth constraints on your network traffic.
In this lab, we will create three VPC’s with Internet Gateways, and EC2 instances - one per
VPC. We will observe that by default, EC2 instances in different VPCs are not able to
communicate with each other using private IP addresses.
2.1 Navigate to VPC Dashboard
To get started, navigate to VPC Dashboard Services:
https://console.aws.amazon.com/vpc/home?region=us-east-1#vpcs:
In every region, a default VPC has already been created for you. So, even if you haven’t created
anything in your account yet, you will see some VPC resources already there.
● Create “VPC A”, specifying 10.0.0.0/16 as IPv4 CIDR block. Do not enable IPv6. Select “Default”
Tenancy. Accept proposed Tags:
● Follow the same steps to create “VPC B” and “VPC C”.
After completing these steps, you should have three new VPCs and default listed under “Your
VPCs:”
Click on “Create subnet” button, create subnets with names that reflect VPC and AZ
placement, such as “VPC A – AZ 1a”:
Creating Subnet in AZ2 for VPC A:
On your own, create subnets for “VPC B” and “VPC C”; refer to Table 1 for CIDR allocations.
After you finish the task, 6 new subnets should be available:
2.2.3 Deploy Internet Gateways
In this section, we will deploy one Internet Gateway (IGW) per VPC. We need an Internet
Gateway in order to establish outside connectivity to EC2 instances in VPCs.
Select Internet Gateway for “VPC A”, such as “VPC A – IGW”. Click “Create”
You should now have an IGW for the default VPC and three newly created IGWs available:
Navigate to “VPC A” Route Table and click on “Routes” tab. Click on “Edit Routes:”
Modify Route Table to add the default route 0.0.0.0/0 pointing to the Internet Gateway.
Repeat these steps for “VPC B” and “VPC C” route tables.
Choose “Amazon Linux 2 AMI (HVM), SSD Volume Type” 64-bit x86 and click “Select.”
We will use Free tier eligible “t2.micro” instance type. Click on “Next: Configure Instance
Details.”
Deploy the first instance to AZ1 of “VPC A” by choosing them from the network and the subnet
dropdowns.
We will be assigning Public IP to this instance. Without this step, we will not be able to connect
to the instance remotely.
Click on “Review and Launch.” Click on “Launch.” Select the “ee-default-keypair” ssh key pair
that was pre-generated by the Event Engine. Launch Instance. Select “I acknowledge that I
have access to the selected private key file…” and click on “Launch Instances.”
While instance is being launched, assign it a name that reflects VPC and AZ placements, such
as “EC2 VPC A – AZ1”
Launch two more EC2 instances – one in “VPC B” AZ1 and the other one in “VPC C” AZ1.
Assign names.
After few minutes, you should have 3 EC2 instances in the “running” state.
For each EC2 instance, update the Security Group rules under the Security tab to allow ICMP
traffic (SSH on port 22 should already be open):
Modify the Inbound Rules on the Security Group to permit SSH and ICMP traffic from any
address:
Repeat these steps for EC2 instances in “VPC B – AZ 1” and “VPC C – AZ1”.
Write down the private IPv4 addresses assigned to EC2 instances by clicking on an Instance
and navigating to the Networking tab:
Populate the following table with IP information.
Table 2. EC2 instances' private IP Addresses
Click “Connect” to connect using EC2 Instance Connect and user name ec2-user:
SSH session should open in a new browser tab. From the EC2 instance in “VPC A” try pinging
the private IP addresses of EC2 instances in “VPC B” and “VPC C”. Are those addresses
pingable?
2. VPC Peering
A VPC peering connection is a networking connection between two VPCs that enables you to
route traffic between them using private IPv4 addresses or IPv6 addresses.
In this lab, we will establish VPC peering links between “VPC A” and “VPC B”, as well as “VPC
A” and “VPC C”.
Select the connection, navigate under “Actions” and click “Accept Request”
You should now have two active peering connections as shown below:
3.2 Update Route Tables
Navigate to “Route Tables”:
https://console.aws.amazon.com/vpc/home?region=us-east-1#RouteTables:sort=desc:routeTa
bleId, select “VPC A Route Table”, click on “Routes” tab and click “Edit routes:”
Add route entries for “VPC B” and “VPC C” using their CIDR ranges (10.1.0.0/16 and
10.2.0.0/16 respectively)
Connect to the EC2 instance in “VPC A” using EC2 Instance Connect (refer to section 2.2.6).
Try pinging EC2 instances in “VPC B” and “VPC C”. Use private Addresses of the Instances.
If peering and routing are configured correctly, you should be able to ping both instances.
SSH to EC2 instance in “VPC B”. Can you ping the instance in “VPC C”?
4 Transit Gateway
In the previous lab, we created VPC Peering Links in order to facilitate connectivity between
two VPCs. While this approach can be used to interconnect larger number of VPCs, managing
many point-to-point connections can be cumbersome. A more scalable approach is to utilize
AWS Transit Gateway.
In this lab, we will remove point-to-point peering connections between “VPC A” and “VPC B”,
“VPC A” and “VPC C.” We will setup Transit Gateway (TGW) and use it to interconnect “VPC A”,
“VPC B”, and “VPC C.”
4.1 Delete VPC Peering Connections
Navigate to VPC Dashboard:
https://console.aws.amazon.com/vpc/home?region=us-east-1#PeeringConnections:sort=vpcP
eeringConnectionId
Click on “Peering Connections”, select “VPC A 🡨🡪 VPC C” and delete peering connection.
Select the checkbox to delete relate route table entries to avoid traffic blackholing scenario:
Repeat for “VPC A 🡨🡪 VPC B” connection.
A few moments later, TGW will transition from “pending” to “available” state.
Under “VPC Dashboard” – “Transit Gateways”, navigate to “Transit Gateway Attachments” and
click on “Create Transit Gateway Attachment.”
Create the VPC attachment for both availability zones in “VPC A:”
Repeat these steps to create attachments for “VPC B” and “VPC C.”
Repeat these steps for “VPC B’s” and VPC C’s” routing tables.
Connect to EC2 instance in “VPC A”.
Try pinging private IPs of instances deployed in “VPC B” and “VPC C”. Ping should be
successful.
Connect to EC2 instance in “VPC B”. Try pinging private IPs of instances deployed in “VPC A”
and “VPC C”. Ping should be successful.
You validated that EC2 instances in all three VPCs can reach each other using Transit Gateway.