What is a VPC?
VPC stands for Virtual Private Cloud. It's your own private section of the AWS cloud where you launch resources like EC2 instances, databases, and load balancers. Think of it as your own fenced-in data center in the cloud.
By default, resources in your VPC are isolated from the rest of the internet and from other AWS accounts. You decide exactly what traffic goes in and out. It's like having your own private highway with on-ramps and off-ramps that you control.
VPC Components
A VPC has several key components: Subnets divide your VPC into smaller networks. Route tables control traffic routing. Internet gateways connect your VPC to the internet. NAT gateways let private instances access the internet without being directly accessible.
Security groups and Network ACLs act as firewalls. Think of your VPC as a neighborhood — subnets are the streets, route tables are the road signs, and security groups are the locks on each house.
Default VPC vs Custom VPC
Every AWS account comes with a default VPC that's pre-configured for you. It has public subnets, an internet gateway, and instances get public IP addresses automatically. It's great for learning and quick testing.
For production, you'll want a custom VPC where you control every aspect — subnet sizes, routing, security, and connectivity. Custom VPCs give you the isolation and control that serious applications need.
CIDR Blocks
When you create a VPC, you define its IP address range using a CIDR block. The most common choices are 10.0.0.0/16, 172.16.0.0/16, or 192.168.0.0/16 — all private address ranges that don't conflict with typical home networks.
A /16 CIDR block gives you 65,536 IP addresses. That's usually more than enough. Plan your subnets carefully because you can't change the VPC's CIDR block after creation.
VPC Peering and VPN
VPC Peering connects two VPCs together so they can communicate as if they're on the same network. It's like building a tunnel between two neighborhoods. Peering can be within the same region or across regions.
For connecting your VPC to your on-premises network, use a VPN connection or AWS Direct Connect. This lets your office or data center securely communicate with your cloud resources, extending your network into AWS.