VPC knowledge base

Cheat-sheet style reference for AWS VPC building blocks. For the narrative deep-dive see AWS VPC Fundamentals. This page is optimised for fast lookup: tables, defaults, limits, cost gotchas.

Object cheat-sheet

ObjectWhat it isScopeKey fact
VPCVirtual L3 network / address spaceRegion/16 max, /28 min; up to 5 CIDRs per VPC
SubnetSlice of VPC CIDRSingle AZ5 IPs reserved per subnet (network, router, DNS, future, broadcast)
Route tablePer-subnet forwarding policyVPCOne table per subnet; many subnets can share one table
IGWInternet gateway (1:1 NAT for public IPs)VPCFree; one per VPC; horizontally scaled by AWS
NAT GatewayOutbound-only NAT for private subnetsAZExpensive: hourly + per-GB processed
NAT InstanceSelf-managed EC2 doing NATENICheap but you run it
VGW / TGWOn-prem gateway / hub routerVPC / RegionTGW replaces VGW+peering mesh at scale
VPC Endpoint (Gateway)Private route to S3 / DynamoDBVPCFree — always enable for S3
VPC Endpoint (Interface)ENI in your VPC → AWS service via PrivateLinkSubnetHourly + data; needed for most services
Peering1:1 VPC-to-VPCRegion or cross-regionNon-transitive
Security GroupStateful per-ENI firewallVPCAllow only; implicit deny; refs other SGs
NACLStateless per-subnet ACLSubnetAllow + deny; ordered rules; both directions
Flow LogsFlow metadata captureVPC / subnet / ENI5-tuple + action; no payload
Traffic MirroringFull packet copy to target ENIENIFor IDS/forensics; Nitro only

Reserved IPs per subnet

For a 10.0.0.0/24 subnet:

IPPurpose
10.0.0.0Network address
10.0.0.1VPC router (first hop)
10.0.0.2DNS resolver (.2 in every subnet)
10.0.0.3Reserved for future use
10.0.0.255”Broadcast” — reserved even though broadcast doesn’t exist

Usable: .4 through .254 → 251 hosts on a /24.

Default limits (common ones)

ItemDefaultNotes
VPCs per region5Soft limit
Subnets per VPC200Soft
Route tables per VPC200Soft
Route entries per table50Soft up to 1000
Security Groups per VPC2,500Soft
Rules per SG60 inbound + 60 outboundSoft
SGs per ENI5Hard (soft up to 16)
NAT Gateways per AZ5Soft
Elastic IPs per region5Soft

If you’re hitting these, request quota increases in Service Quotas.

Route table target cheat-sheet

local               VPC CIDR             (automatic, immutable)
igw-xxxx            0.0.0.0/0            public subnet
nat-xxxx            0.0.0.0/0            private subnet (outbound)
pcx-xxxx            peer VPC CIDR        peering
tgw-xxxx            multi                transit gateway attachment
vgw-xxxx            on-prem CIDR         site-to-site VPN / DX
vpce-xxxx           S3 / DDB prefix      gateway endpoint
eni-xxxx            any                  traffic steering to NVA (firewall)

Longest-prefix-match wins. local is special and always most specific for the VPC CIDR.

Gateway endpoint vs interface endpoint

Gateway endpointInterface endpoint (PrivateLink)
ServicesS3, DynamoDB100+ (EC2 API, KMS, SSM, Secrets Manager, ECR, …)
MechanismRoute table entry to prefix listENI with private IP in your subnet
DNSNo DNS change neededPrivate DNS override recommended
CostFreeHourly per endpoint + per-GB
When to useS3/DDB traffic from VPC — alwaysAnything else you want to keep off the internet

Connectivity decision tree

Need: VPC ↔ other VPC (same or cross-account)
  └─ few VPCs, point-to-point ─────────→ VPC Peering
  └─ many VPCs, transitive  ───────────→ Transit Gateway
  └─ cross-region, at scale  ──────────→ TGW Peering or Cloud WAN
  └─ private publish a service to consumers → PrivateLink

Need: VPC ↔ on-prem
  └─ over internet, encrypted ─────────→ Site-to-Site VPN (IKEv2)
  └─ dedicated circuit, low latency ───→ Direct Connect (+ optional VPN backup)
  └─ hub integrating many sites/VPCs  ─→ TGW + DX Gateway

Need: VPC ↔ AWS service (S3, DDB, STS, KMS…)
  └─ S3 / DynamoDB ───────────────────→ Gateway Endpoint (free)
  └─ anything else ───────────────────→ Interface Endpoint (PrivateLink)

Need: outbound internet from private subnet
  └─ regular traffic ─────────────────→ NAT Gateway (managed, expensive)
  └─ cost-sensitive / low volume  ────→ NAT Instance (self-managed)
  └─ IPv6-only outbound  ─────────────→ Egress-only Internet Gateway

Cost traps

  • NAT Gateway processing charges$0.045/GB processed (plus hourly). Backups / container pulls / apt updates via NAT get expensive fast.
    • Mitigation: S3 Gateway Endpoint (free); ECR Interface Endpoint for container pulls; package mirrors in-VPC.
  • Cross-AZ data transfer$0.01/GB each way inside a VPC. DB primary in AZ-a, app in AZ-b → every query crosses a charge boundary.
  • Inter-region data transfer — much higher. Don’t accidentally put a replica in us-west-2 when the primary is in us-east-1.
  • Elastic IPs — free while attached to a running instance; charged $0.005/h when idle. Release unused EIPs.
  • Flow Logs to CloudWatch Logs — ingest charge per GB. Use S3 destination for long retention.

Default VPC facts

  • One per region, CIDR 172.31.0.0/16
  • A /20 default subnet per AZ (4091 usable IPs each)
  • Default route to the IGW attached at create time
  • Auto-assign public IP is enabled on default subnets
  • Safe to leave for labs; don’t deploy real workloads into it

SG vs NACL at a glance

Security GroupNACL
Attached toENISubnet
StateStatefulStateless
ActionAllow onlyAllow + deny
EvaluationUnion of all rulesFirst match by rule number
ReferencesCan reference other SGs, prefix lists, IPsIPs / CIDRs only
Ephemeral portsNot needed (stateful)Must allow manually for return traffic
DefaultDeny all (new SG: no inbound, outbound any)Default NACL: allow all; custom NACL: deny all

See AWS Security Groups vs NACLs for full comparison.

Troubleshooting checklist — “why can’t A reach B?”

  1. Route table — is there a route from A’s subnet to B’s CIDR?
  2. Route table (return) — is there a route from B’s subnet back to A?
  3. Security Group (A outbound) — permits the destination?
  4. Security Group (B inbound) — permits the source (IP, CIDR, or SG id)?
  5. NACL (A subnet, egress + ingress) — allows both the forward packet and the return?
  6. NACL (B subnet) — same check, both directions?
  7. Public IP / NAT — if crossing the internet, does A have a path out (IGW or NAT)?
  8. DNS — is A resolving B’s hostname to the expected IP (private vs public DNS)?
  9. Flow Logsaction=ACCEPT or REJECT? REJECT tells you which layer (SG vs NACL) blocked.
  10. MTU / path MTU — 1500 default; VPN/overlays lower. Test with DF-bit.

Diagram slot

Add VPC topology diagrams to Assets/VPC/ and embed here:

![[Assets/VPC/<diagram>.png]]

See also