AWS Networking Fundamentals: VPC, Subnets, Route Tables, Internet Gateway, and VPC Peering

Introduction
Networking is one of the most important concepts in AWS. Before launching applications on AWS, it's essential to understand how Virtual Private Clouds (VPCs), Subnets, Route Tables, Internet Gateways, and VPC Peering work together.
In this article, we'll build a strong foundation by understanding these core AWS networking components and how they communicate with each other.
What is a VPC?
A Virtual Private Cloud (VPC) is a logically isolated network within AWS where you can launch and manage AWS resources such as EC2 instances.
Think of a VPC as your own private data center inside AWS.
Benefits of a VPC
Network isolation
IP address control
Enhanced security
Flexible routing
Scalability
Example
A company creates a VPC with the CIDR block:
10.0.0.0/16
This VPC can contain multiple subnets and resources.
Understanding CIDR Blocks
CIDR (Classless Inter-Domain Routing) defines the range of IP addresses available in a network.
Example
VPC CIDR:
10.0.0.0/16
Available IP range:
10.0.0.0 – 10.0.255.255
Subnet CIDR:
10.0.1.0/24
Available IP range:
10.0.1.0 – 10.0.1.255
What is a Subnet?
A subnet is a smaller network created inside a VPC.
Subnets help organize resources and control traffic flow.
Types of Subnets
Public Subnet
A subnet that can access the internet through an Internet Gateway.
Examples:
Web servers
Load balancers
Bastion hosts
Private Subnet
A subnet without direct internet access.
Examples:
Databases
Internal applications
Backend services
What is an Internet Gateway (IGW)?
An Internet Gateway enables communication between a VPC and the internet.
Without an Internet Gateway:
Instances cannot access the internet
SSH connections may fail
Web applications remain inaccessible
Steps
Create an Internet Gateway
Attach it to a VPC
Add a route to the Route Table
Route Example:
Destination: 0.0.0.0/0
Target: Internet Gateway
What is a Route Table?
A Route Table contains rules that determine where network traffic should go.
Every subnet must be associated with a Route Table.
Example Routes
Local Communication:
Destination: 10.0.0.0/16
Target: Local
Internet Access:
Destination: 0.0.0.0/0
Target: Internet Gateway
Launching an EC2 Instance
After creating:
VPC
Subnet
Route Table
Internet Gateway
You can launch an EC2 instance.
Important settings:
Select the correct VPC
Select the subnet
Enable Auto Assign Public IP
Configure Security Groups
Security Groups
Security Groups act as virtual firewalls for EC2 instances.
Common Rules
SSH Access
Port: 22
Protocol: TCP
Source: Your IP
HTTP Access
Port: 80
Protocol: TCP
Source: Anywhere
HTTPS Access
Port: 443
Protocol: TCP
Source: Anywhere
What is VPC Peering?
VPC Peering allows two VPCs to communicate privately using AWS networking infrastructure.
Traffic never passes through the public internet.
Use Cases
Multi-environment architecture
Shared services
Cross-team communication
Multi-account networking
VPC Peering Architecture
VPC-1
CIDR: 10.0.0.0/16
↓
Peering Connection
↓
VPC-2
CIDR: 192.168.0.0/16
Both VPCs can communicate using private IP addresses.
Steps to Configure VPC Peering
Step 1
Create VPC-1
CIDR: 10.0.0.0/16
Step 2
Create VPC-2
CIDR: 192.168.0.0/16
Step 3
Create a VPC Peering Connection
Requester: VPC-1
Accepter: VPC-2
Step 4
Accept the Peering Request
Status should become:
Active
Step 5
Update Route Tables
Route Table of VPC-1:
Destination: 192.168.0.0/16
Target: Peering Connection
Route Table of VPC-2:
Destination: 10.0.0.0/16
Target: Peering Connection
Step 6
Update Security Groups
Allow ICMP and required traffic from the peer VPC CIDR range.
Testing Connectivity
Connect to EC2 Instance 1 and ping the private IP of EC2 Instance 2.
Example:
ping 192.168.1.10
Successful replies confirm that VPC Peering is working correctly.
Common Troubleshooting Issues
Unable to SSH into EC2
Possible causes:
Missing Internet Gateway
Missing route table entry
Security Group blocking port 22
No public IP assigned
VPC Peering Not Working
Possible causes:
Peering request not accepted
Route tables not updated
Security Groups blocking traffic
Incorrect CIDR configuration
Conclusion
Understanding VPCs, Subnets, Route Tables, Internet Gateways, Security Groups, and VPC Peering is essential for every Cloud Engineer and DevOps Engineer.
These networking fundamentals form the backbone of AWS infrastructure and are frequently used in real-world production environments.
Mastering these concepts will help you design secure, scalable, and highly available cloud architectures.




