Cloud Networking: Virtual Private Cloud (VPC), Subnets & Routing

In the early days of public cloud, virtual machines were assigned public IP addresses and exposed directly to the internet. Today, enterprise cloud computing is built upon isolated Software-Defined Networks (SDNs) called Virtual Private Clouds (VPCs). A VPC acts as your private virtual data center inside the cloud provider's global network.

Cloud Virtual Private Cloud VPC Architecture with Public and Private Subnets

Figure 5: Enterprise VPC Architecture: CIDR block partitioning, Internet Gateway (IGW), Application Load Balancers, NAT Gateway, Private Subnets, and Isolated Database Subnets.

1. IP Addressing & CIDR Notation

When creating a VPC, you assign it an IPv4 address range using Classless Inter-Domain Routing (CIDR) notation based on RFC 1918 private address ranges:

  • 10.0.0.0/16: 16 network bits, 16 host bits → Provides 65,536 total IP addresses (from 10.0.0.0 to 10.0.255.255). This is the standard recommended size for enterprise VPCs.
  • 10.0.1.0/24: 24 network bits, 8 host bits → Provides 256 total IP addresses (251 usable in AWS, as AWS reserves 5 IPs per subnet for network, router, DNS, and future use).

2. Public Subnet vs Private Subnet

The fundamental security rule of cloud networking is: Never place database instances or private application microservices in a public subnet.

Feature Public Subnet Private Subnet
Route Table Configuration Has an explicit route to an Internet Gateway (IGW): 0.0.0.0/0 → igw-xxxx. Has NO route to an Internet Gateway. Outbound traffic routes via a NAT Gateway.
Public IP Addresses Instances can be assigned public Elastic IPs. Instances ONLY receive private IP addresses (e.g., 10.0.2.45).
Direct Internet Ingress Allowed (subject to Security Group rules). Physically impossible from outside the VPC.
Typical Workloads Application Load Balancers (ALB), Bastion Hosts. Backend EC2 instances, Kubernetes Pods, RDS Databases.

3. Network Translation: Internet Gateway vs NAT Gateway

  • Internet Gateway (IGW): A horizontally scaled, redundant VPC component that enables communication between instances in your VPC and the internet. It performs two-way 1:1 network address translation (NAT) between public and private IPs.
  • NAT Gateway (Network Address Translation): Located in a public subnet, a NAT Gateway allows instances in a private subnet to connect outbound to the internet (to download security updates or third-party API webhooks), while preventing the internet from initiating inbound connections to those private instances!

University Exam Corner (BCA / B.Sc CS)

Question: "What is the difference between a Security Group and a Network ACL (NACL) in cloud networking?"

Answer: Security Groups operate at the virtual network interface (instance) level and are stateful (if you send a request out, the response is automatically allowed back in regardless of inbound rules). Network ACLs (NACLs) operate at the subnet boundary, are stateless (inbound and outbound traffic must be explicitly permitted with rule numbers), and support explicit "DENY" rules.

Frequently Asked Questions (FAQ) - Student & Interview Review

Q1. Why does AWS reserve 5 IP addresses in every subnet?

In any AWS subnet (e.g., 10.0.0.0/24), AWS reserves: 10.0.0.0 (Network address), 10.0.0.1 (VPC local router), 10.0.0.2 (Amazon DNS server), 10.0.0.3 (Reserved for future use), and 10.0.0.255 (Network broadcast address). Thus, 256 - 5 = 251 IPs are usable.

Q2. What is VPC Peering?

VPC Peering is a direct networking connection between two VPCs that allows you to route traffic between them using private IPv4 or IPv6 addresses as if they were in the same network, without routing traffic over the public internet.

Explore Related Cloud Computing Tutorials & Next Steps

Broaden your enterprise cloud architecture and DevOps expertise across our curriculum:

Load Balancing & Elastic Auto-Scaling

Distribute incoming web traffic across public and private subnets using multi-AZ application load balancers.

Cloud DNS & Global Traffic Routing

Configure Amazon Route 53 latency, weighted, and failover routing policies pointing to VPC endpoints.

Shared Responsibility Security Model

Configure Security Groups and Network ACLs to enforce strict ingress and egress traffic boundaries.

Terraform Infrastructure as Code (IaC)

Automate the provisioning of multi-AZ VPCs, subnets, NAT gateways, and routing tables with Terraform HCL.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Reddit

You may also like this!