Network in AWS
Cloud networks form the backbone of distributed systems infrastructure. AWS is the canonical reference: understanding its networking model gives you the vocabulary and mental model for every other cloud provider β theyβre broadly similar with different names.
This lesson is a tour of the AWS networking primitives, from the top-level account hierarchy down to security groups and route tables.
The Hierarchy
Why multi-account?
Common reasons organizations split into multiple accounts:
- Separation of applications β different security needs, regulatory requirements, or operational teams.
- Tenant separation β strict isolation between customers in multi-tenant systems (large enterprise tenants often get their own AWS account).
- Environment isolation β dev/staging/prod canβt accidentally touch each other.
- Cost allocation β clean per-business-unit billing.
- Compliance β regulations sometimes require strict isolation.
VPC: Virtual Private Cloud
A VPC is your isolated network environment within AWS β virtually equivalent to a private data center. Resources inside communicate via private IPs, logically separated from other AWS customers.
CIDR blocks
When you create a VPC, you pick a CIDR block that defines the available IP range β e.g., 10.0.0.0/16 gives you 65,536 addresses (10.0.0.0 to 10.0.255.255). All subnets inside the VPC use slices of this space.
Properties
Subnets
Subnets are subdivisions of a VPC. Each subnet:
- Lives in exactly one AZ.
- Uses a subset of the VPCβs CIDR block.
- Can be public (internet-accessible) or private (internal-only).
Why multiple subnets
- High availability β spread resources across subnets in different AZs.
- Security segmentation β public web servers vs. private databases.
- Access control β public subnets connect to the internet; private subnets stay isolated.
- Compliance β different tiers may need different security controls.
A typical 3-tier deployment uses six subnets β public + private in three AZs:
VPC: 10.0.0.0/16
AZ us-east-1a: AZ us-east-1b: AZ us-east-1c:
βββ public-1a (10.0.1.0/24) βββ public-1b (10.0.2.0/24) βββ public-1c (10.0.3.0/24)
βββ private-1a (10.0.11.0/24) βββ private-1b (10.0.12.0/24) βββ private-1c (10.0.13.0/24)
Internet Connectivity
Internet Gateway (IGW)
Provides bidirectional internet connectivity for public subnets. One per VPC. Resources in public subnets with public IPs (or Elastic IPs) are reachable from the internet.
NAT Gateway / NAT Instance
Lets resources in private subnets access the internet (for software updates, calling external APIs) without being reachable from outside.
Route Tables
A route table specifies where traffic from a subnet goes. Each subnet associates with exactly one route table. Common entries:
| Destination | Target | Meaning |
|---|---|---|
| VPC CIDR (e.g., 10.0.0.0/16) | local | Within-VPC traffic stays internal |
| 0.0.0.0/0 | igw-xxx | Send everything else to internet (public subnet) |
| 0.0.0.0/0 | nat-xxx | Send everything else to NAT (private subnet) |
| 192.168.0.0/16 | pcx-xxx | Send to peered VPC |
Security: Two Layers
AWS gives you two complementary mechanisms for traffic control.
Security group example
Allow SSH from one IP, HTTP/HTTPS from anywhere:
| Type | Protocol | Port range | Source | Description |
|---|---|---|---|---|
| SSH | TCP | 22 | 117.212.92.68/32 | Office IP |
| HTTP | TCP | 80 | 0.0.0.0/0 | Public web |
| HTTPS | TCP | 443 | 0.0.0.0/0 | Public web |
Most production setups use security groups heavily and NACLs sparingly (default-allow NACLs as a safety net rather than primary control).
Connecting VPCs and Networks
A Realistic Topology
A typical multi-tier production VPC for a SaaS platform:
Internet
β
[Internet GW]
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VPC: 10.0.0.0/16 β
β β
β ββPublic Subnetsβββββββββββββββββββββββββββββββββ β
β β ALB / NAT GW (one per AZ) β β
β βββ¬ββββββββββββββββ¬ββββββββββββββββ¬ββββββββββββββ β
β β β β β
β βββΌβββββββββββββ ββΌβββββββββββββ ββΌβββββββββββββ β
β β App Subnet β β App Subnet β β App Subnet β β
β β (private) β β (private) β β (private) β β
β β ECS / EKS β β ECS / EKS β β ECS / EKS β β
β βββ¬βββββββββββββ ββ¬βββββββββββββ ββ¬βββββββββββββ β
β β β β β
β βββΌβββββββββββββ ββΌβββββββββββββ ββΌβββββββββββββ β
β β DB Subnet β β DB Subnet β β DB Subnet β β
β β (isolated) β β (isolated) β β (isolated) β β
β β RDS Multi-AZ β β β β β β
β ββββββββββββββββ βββββββββββββββ βββββββββββββββ β
β AZ 1a AZ 1b AZ 1c β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
This shape β public subnets for load balancers and NAT, private subnets for app, isolated subnets for data β is the AWS reference architecture. Other clouds use the same shape with different names.
Multi-region for SaaS
Multi-region deployments serve three needs in SaaS:
- Latency β users get a region close to them.
- Compliance β EU customersβ data stays in EU regions; US in US.
- Disaster recovery β region-level failures donβt take everyone down.
Standard patterns:
- Active-passive β primary region serves all traffic; secondary stays warm and takes over on failure.
- Active-active β both regions serve traffic; clients route to closest. Higher cost; harder consistency story.
- Region-per-tenant β each tenant deployed to one region based on their compliance/latency needs. Common in B2B SaaS.
Recap
- Account β Region β AZ β VPC β Subnet is the core hierarchy.
- VPCs give you isolated networks; subnets give you AZ placement and segmentation.
- Internet Gateway + Route Tables for public connectivity; NAT Gateway for outbound from private subnets.
- Security Groups (stateful, instance) + NACLs (stateless, subnet) layer defense.
- Multi-VPC connectivity: peering for simple cases, Transit Gateway for scale, Direct Connect / VPN for hybrid.
- Multi-region patterns serve latency, compliance, and DR β common in SaaS at scale.