How do you avoid NAT gateway single points of failure and cross-AZ charges?
IntermediateProductionVPC & Network Architecture
Answer
Deploy one NAT gateway per AZ and give each private subnet's route table a default route to the NAT in its own AZ. A failure of one AZ then affects only that AZ, and traffic does not cross AZ boundaries (cross-AZ data transfer is billed in both directions).
In Terraform, loop over AZs to create aws_nat_gateway and aws_route_table per AZ. For dev environments a single NAT is a fair cost trade.
More on VPC & Network Architecture
How would you design a production VPC for a three-tier web application?IntermediateHow many AZs and subnets should a production VPC use, and why?BeginnerWhat makes a subnet public versus private?BeginnerWhen 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