How would you design a production VPC for a three-tier web application?
IntermediateProductionVPC & Network Architecture
Answer
Three subnet tiers in at least three AZs: public (ALB, NAT gateways), private app (compute), private data (RDS, ElastiCache) with no route to the internet. Size the VPC /16 with /20 or /22 subnets so growth does not force a redesign.
Security groups chain by reference: ALB SG to app SG to DB SG. Add gateway endpoints for S3/DynamoDB, interface endpoints for the services you call heavily, VPC flow logs to S3 or CloudWatch, and manage everything in Terraform.
flowchart LR
U[Users] --> ALB[ALB public subnets]
ALB --> APP[App private subnets]
APP --> DB[(Data private subnets)]
APP --> NAT[NAT gateway]
NAT --> IGW[Internet gateway]
More on VPC & Network Architecture
How many AZs and subnets should a production VPC use, and why?BeginnerWhat makes a subnet public versus private?BeginnerHow do you avoid NAT gateway single points of failure and cross-AZ charges?IntermediateWhen should you use VPC endpoints?IntermediateHow do you design connectivity for 50+ VPCs across accounts and regions?AdvancedWhat is PrivateLink and when is it better than peering?Advanced