🌐 AWS Networking

AWS VPC
Theory Notes

Virtual Private Cloud β€” your own isolated network inside AWS. Complete beginner-friendly guide for 1st semester students.

1

What is a VPC?

Before VPC existed, when you launched an EC2 instance it went directly on a shared public network β€” visible to the internet by default. As more companies moved to AWS, this became a serious security problem.


VPC (Virtual Private Cloud) solves this: it gives you a completely isolated section of the AWS cloud where you control the networking β€” your own IP address ranges, subnets, routing rules, and security.

🏒 Analogy β€” Office Building

Think of AWS as a huge commercial complex with thousands of offices.

Without VPC β†’ you're working at a public co-working space. Anyone can walk up to your desk.


With VPC β†’ you rent an entire private floor. Only your team gets access. You control which rooms have windows (internet access) and which are internal-only. You hire security guards and set up access control at every door.


VPC = your private floor in AWS's building. The building (AWS) manages power, cooling, and physical security. You manage everything inside your floor.

Key Facts
2

IP Address Range (CIDR Block)

When you create a VPC, you give it a CIDR block β€” this is the range of private IP addresses your VPC can use. Think of it as deciding "how big is my office building?"

10.0.0.0 / 16 β†’ VPC (65,536 IPs β€” the whole building)
10.0.1.0 / 24 β†’ Public Subnet (256 IPs β€” public floor)
10.0.2.0 / 24 β†’ Private Subnet (256 IPs β€” private floor)
Simple Rule to Remember
Smaller the number after / β†’ bigger the range.
/16 = huge (65K IPs) Β· /24 = medium (256 IPs) Β· /32 = single IP

For practice: always use 10.0.0.0/16 for your VPC, then 10.0.X.0/24 for subnets.
3

VPC Core Components

πŸ—οΈ

Subnet

A division of your VPC. Like a floor of your building. Each subnet lives in one Availability Zone.

πŸšͺ

Internet Gateway (IGW)

The main door connecting your VPC to the public internet. Without it, nothing gets in or out.

πŸ—ΊοΈ

Route Table

The directory/signage system. Tells traffic "if you want the internet, go through the IGW."

πŸ›‘οΈ

Security Group

Firewall at the instance level. Like a security guard at each individual office room.

🚧

Network ACL (NACL)

Firewall at the subnet level. Like a checkpoint at the entrance to each floor.

πŸ“‘

NAT Gateway

Lets private subnet servers reach out to the internet (to download updates) without being directly exposed.

4

Public Subnet vs Private Subnet

The most important concept in VPC architecture. The only difference between a public and private subnet is the route table β€” specifically, whether traffic can reach the Internet Gateway.

FeaturePublic SubnetPrivate Subnet
Route to Internet?βœ… Yes (via IGW)❌ No direct route
Directly reachable from internet?Yes (with public IP)No
What goes here?Web servers, Load Balancers, Bastion HostDatabases, App servers, internal APIs
Example IP accessWorld can reach itOnly resources in the VPC
🏒 Building Analogy Continued

Floors with windows vs. interior rooms

Public Subnet = The ground floor reception and lobby. People from outside can walk in. Your web server (the receptionist) sits here β€” it talks to the public.


Private Subnet = The secure back office / server room. No windows. No direct external access. Your database (confidential files) stays here. Only internal staff (other servers inside the VPC) can access it.

5

Security Groups vs Network ACLs

FeatureSecurity GroupNetwork ACL (NACL)
LevelInstance (EC2 level)Subnet level
StateStateful β€” return traffic auto-allowedStateless β€” must allow inbound AND outbound separately
RulesAllow rules onlyAllow AND Deny rules
DefaultDeny all inbound, allow all outboundAllow all traffic (default)
AnalogySecurity guard at each room's doorSecurity checkpoint at each floor entrance
For Beginners β€” Start With Security Groups
In most cases, Security Groups are enough. NACLs are an additional layer for extra security. Focus on Security Groups first β€” they handle 90% of real-world use cases.
6

Default VPC β€” What AWS Gives You

When your AWS account is created, AWS automatically sets up a Default VPC in every region. This is why you've been able to launch EC2 instances without manually setting up networking!

βœ…

Default VPC comes with:

CIDR: 172.31.0.0/16 Β· Internet Gateway attached Β· Public subnets in each AZ Β· Route table with internet route

⚠️

Why not use it in production?

All subnets are public. No private isolation. Good for learning, but a real application needs a custom VPC with proper separation.

7

Standard VPC Architecture (3-Tier)

In real applications, resources are separated into 3 layers β€” each with different security requirements. This is called 3-tier architecture.

INTERNET β†’ Internet Gateway β†’ VPC (10.0.0.0/16)
PUBLIC
🌐 Web Tier β€” Load Balancer, Web Servers (EC2)
10.0.1.0/24 (Mumbai AZ-a) Β· 10.0.2.0/24 (Mumbai AZ-b)
↕ internal traffic only
PRIVATE
βš™οΈ App Tier β€” Application Servers, API backends
10.0.3.0/24 Β· 10.0.4.0/24
↕ internal traffic only
PRIVATE
πŸ—„οΈ Data Tier β€” Databases (RDS), Caches (ElastiCache)
10.0.5.0/24 Β· 10.0.6.0/24
8

AWS VPC vs Azure VNet

ConceptAWSAzure
Private NetworkVPC (Virtual Private Cloud)VNet (Virtual Network)
SubnetsSubnets (public/private)Subnets
Internet AccessInternet GatewayNo separate IGW; public IP + routing
Outbound only accessNAT GatewayNAT Gateway
Instance-level firewallSecurity Group (stateful)Network Security Group (stateful)
Subnet-level firewallNetwork ACL (stateless)NSG at subnet level
ScopeOne RegionOne Region
9

Key Summary

VPC = private network Subnet = subdivision IGW = internet door Route Table = traffic rules Security Group = instance firewall Public = internet access Private = no direct internet CIDR /16 = 65K IPs
AWS Official Docs

Official Documentation β€” VPC

All links go to docs.aws.amazon.com β€” official AWS reference.

Topic AWS Docs URL
VPC Overviewvpc/what-is-amazon-vpc.html
Subnets (Public & Private)vpc/configure-subnets.html
Internet Gatewayvpc/VPC_Internet_Gateway.html
Route Tablesvpc/VPC_Route_Tables.html
Security Groupsvpc/vpc-security-groups.html
Network ACLs (NACLs)vpc/vpc-network-acls.html
Default VPCvpc/default-vpc.html
Create a VPC (Quickstart)vpc/create-vpc.html
Free Hands-On Labs AWS Skill Builder β€” free browser-based VPC labs. Also try the VPC Console β€” every AWS account gets a free default VPC.