You have 30 VPCs across accounts, some with overlapping CIDRs, and they need to talk to each other. What's your design?
AdvancedScenarioMulti-env and multi-account
Answer
Situation read → Peering doesn't scale (it's not transitive, and 30 VPCs would need hundreds of connections) and can't connect overlapping ranges. You need a hub and a fix for the overlaps.
What I'd do →
- Use AWS Transit Gateway in a network account, shared via RAM, with route tables segmenting prod from non-prod.
- Fix overlaps going forward: allocate CIDRs centrally with VPC IPAM so new VPCs never overlap.
- For existing overlaps:
- Re-IP the less critical VPC if practical, or
- Use private NAT gateways with a routable secondary CIDR to translate, or
- Expose services through PrivateLink (endpoint services), which doesn't care about overlapping CIDRs.
- Centralise egress and inspection (Network Firewall) in the hub if security needs it.
- Everything in Terraform, with flow logs on the TGW attachments.
Why → TGW gives transitive hub routing; IPAM stops the problem from growing; PrivateLink handles service-to-service across overlaps.
Interview tip → PrivateLink as the answer for overlapping CIDRs is the senior detail.
More on Multi-env and multi-account
Design the AWS account structure for a 50-engineer startup that's growing fast.IntermediateHow do you promote the same build from dev to staging to prod?BeginnerBugs keep passing staging and appearing in production. How do you make staging closer to prod?IntermediateHow do you structure Terraform for dev, staging and prod? Workspaces, directories or Terragrunt?IntermediateDevelopers want a preview environment for every pull request. How would you build it?AdvancedHelm values files or Kustomize overlays for per-environment config?Beginner