DEV Community

Jeya Shri
Jeya Shri

Posted on

Testing VPC connectivity - A quick hands-on

Testing VPC Connectivity

I recently completed a hands-on project focused on understanding and testing Virtual Private Cloud (VPC) connectivity in AWS. The goal of this exercise was to verify how different components inside a VPC communicate with each other and with the internet, while maintaining proper security boundaries. By testing each connection step by step, I was able to clearly see how AWS networking works in practice.

This project helped me move beyond configuration and actually validate whether the architecture behaved the way it was designed to.


Step 1: Setting Up the VPC Basics

I started by creating a custom VPC with both public and private subnets. To support proper traffic flow, I configured route tables for each subnet type, attached an internet gateway to the VPC, and set up a NAT gateway. This initial setup formed the backbone of the network and allowed me to understand how AWS separates public-facing resources from private ones while still enabling controlled communication.

At this stage, the focus was on network segmentation and ensuring that each subnet had the correct routing rules associated with it.


Step 2: Connecting to the Public EC2 Instance

Once the VPC was ready, I launched a public EC2 instance inside the public subnet. I associated an Elastic IP with the instance and connected to it securely using SSH. This step helped me understand how public instances are accessed from the internet and how security groups and key-based authentication work together to allow secure inbound access.

Successfully connecting to the instance confirmed that the internet gateway and route table for the public subnet were configured correctly.


Step 3: Testing Connectivity Between EC2 Instances

Next, I launched a private EC2 instance within the private subnet. From the public EC2 instance, I tested connectivity to the private instance using its private IP address. This demonstrated how instances within the same VPC can communicate internally, even when they are placed in different subnets.

This step highlighted the role of internal routing and security group rules in enabling private, internal communication without exposing resources to the public internet.


Step 4: Testing Internet Access from the Private Subnet

Finally, I tested internet connectivity for the private EC2 instance. Since private instances do not have direct access to the internet, the NAT gateway played a crucial role here. By routing outbound traffic through the NAT gateway, the private instance was able to access the internet securely without having a public IP address.

This confirmed how NAT gateways enable controlled outbound access while preventing any inbound connections from external networks.


Key Learnings

This project gave me practical exposure to testing VPC connectivity rather than just configuring it. By validating communication between public and private instances and confirming controlled internet access, I gained a deeper understanding of how secure and scalable VPC architectures are designed in AWS. Testing each layer of connectivity helped reinforce how individual networking components work together as a complete system.

Top comments (0)