AWS Reachability Analyzer, testing reachability
Setting up the VPC environment, Launching EC2 instances, and Testing Reachability.
This edition of the newsletter is written by Meriem Terki, a Data scientist skilled in AWS and Azure.
In this article, we’ll walk through setting up a VPC environment, launching EC2 instances, and using the AWS Reachability Analyzer to ensure your instances can communicate.
This guide is ideal for those new to AWS or those looking to solidify their understanding of VPC networking.
🤷♂️ What’s a VPC Reachability Analyzer?
🚀 Game-changer for AWS network troubleshooting
🔀 Dynamically maps network traffic across VPCs and subnets
👀 Provides end-to-end visibility and automates root cause analysis
📈 Ensures compliance and security, scaling from small to enterprise networks
🔄 Revolutionizes AWS network management with speed and automation
📝 Steps Diagram
Task Steps
❶ Sign in to the AWS Management Console
On the AWS sign-in page, enter your credentials to log in to your AWS account and click on the Sign-in button.
Once Signed In to the AWS Management Console, Make the default AWS Region as US East (N. Virginia) us-east-1
❷ Setting Up Your Environment by creating VPC
In the AWS Management Console, you can find the VPC service by clicking on the “Services” dropdown at the top and typing VPC in the search bar. Then, select the VPC service from the search results.
Once you’re in the VPC service, you’ll see the option to create a new VPC on the side menu or by clicking on the create VPC button and VPC only.
Create a new VPC: Name: reachability-test-VPC.
Specify an IPv4 CIDR block for your VPC (10.0.0.0/16) in the IPv4 CIDR block field.
In this case, you’re asked to use 10.0.0.0/16 as an example, but you can choose any valid CIDR block that doesn’t conflict with your existing network.
Click on the Create VPC button
Within your newly created VPC, you’ll need to create two subnets: one public and one private.
To create a subnet, go to the subnets section in the VPC service and click on the Create Subnet button.
Specify the VPC you just created, the CIDR block for the subnet
Subnet Name: public subnet
IPv4 subnet CIDR block: 10.0.1.0/24
Now we are going to create the same steps,
Subnet name: private subnet
subnet CIDR block: 10.0.2.0/24
Configure the route tables and internet gateway for the public subnet
For the public subnet to have internet access, you’ll need to configure the route table and attach an internet gateway.
Go to the Route Tables section in the VPC service and create a new route table for the public subnet.
Route Table Name: MY-RT
Next, go to the Internet Gateways section and create a new Internet gateway.
Internet Gateway Name: My-Internet-Gateway
Once the Internet gateway is created attach it to the VPC that you have created.
In the route table, click on Edit routes, then add your internet gateway. The destination should be (0.0.0.0/0), and the target should be the internet gateway.
❸ Launch two EC2 instances within this VPC
Navigate to EC2 by clicking on the Services menu at the top, then click on EC2 in the Compute section.
In the EC2 service, you’ll see a left-hand side menu. Click on the Instances option, and then click on the Launch Instances button to start the process of creating a new EC2 instance.
Name: Enter MyEC2Server1
You’ll be asked to choose an Amazon Machine Image (AMI) for your instance. Search for Amazon Linux 2023 AMI in the search box and select it by clicking on the Select button.
For Instance Type: Select t2.micro
You’ll need to create a key pair to securely connect to your EC2 instances. Select the Create a new key pair option.
For Key pair(login): Select Create a new key pair Button
Key pair name: VPC-Key
Key pair type: RSA
Private key file format: .pem
Make sure to select the appropriate VPC and public subnet.
In Network Settings Click on Edit Button:
Auto-assign public IP: Enable
Select Create a Security Group
Security group name: Enter MyEC2Server_SG
Description: Enter Security Group to allow traffic to EC2
We will now add the security group rules. SSH will already be present there.
For HTTP, Select the Add security group rule Button
Choose Type: Select HTTP Source: Select Anywhere
Click Launch Instance.
Repeat the steps to launch another instance, ensuring it’s in the same VPC but in the private subnet.
To create the second EC2 instance, repeat the same steps 2–8 and make sure to select the same VPC you created.
Name: Enter MyEC2Server2
Create a new security group for this instance, allowing inbound traffic from the first instance’s security group.
Security Group for the second EC2 instance (Private):
Name: PrivateEC2Server_SG (or any descriptive name)
Description: Security Group for Private EC2 Instance
Inbound Rules:
Allow All Traffic (or specific ports/protocols) from the MyEC2Server_SG security group
Click Launch Instance.
❹ Testing Connectivity
Go to AWS Network Manager you’ll see a left-hand side menu. Click on the Reachability Analyzer option and click on the Create and Analyze path.
Name tag: ec2-to-ec2-reachability.
In the source type, select instances and choose the first EC2 instance you created.
In the destination type, select instances and choose the second EC2 instance.
Leave everything as default.
After configuring the source and destination instances, click on the create and analyze path button to run the analysis test.
🗺️ Now We are going to analyze the path to both the source and destination
Click on the Analyze path to reach the both source and destination path.
click on the confirm button
🔍 Reviewing Results
Once the reachability test is complete, review the results displayed by the Reachability Analyzer.
If the test result shows Reachable, it indicates that the two EC2 instances can communicate with each other within the VPC you created.
If the test result shows unreachable, the Reachability Analyzer will provide detailed information about the issue and potential reasons for the connectivity problem between the two instances.
You’re all done! Congratulations!