Vpc No Nat Gateway
What Changes When You Drop the NAT Gateway from a VPC
Every NAT gateway costs ~$32/month per AZ before traffic charges — and in dev and management VPCs it’s often pure waste. This example shows a VPC running with a single NAT gateway (and how zero would behave) while keeping the three-tier subnet layout.
The configuration
module "vpc_app_example" {
source = "../../modules/vpc-app"
cidr_block = "10.0.0.0/16"
num_nat_gateways = 1 # dev: one NAT, not one per AZ
public_subnet_cidr_blocks = {}
private_app_subnet_cidr_blocks = {
AZ-0 = "10.0.240.0/24"
AZ-1 = "10.0.241.0/24"
AZ-2 = "10.0.242.0/24"
AZ-3 = "10.0.243.0/24"
AZ-4 = "10.0.244.0/24"
AZ-5 = "10.0.245.0/24"
}
private_persistence_subnet_cidr_blocks = {}
private_app_subnet_custom_tags = {
Foo = "Bar-private-app"
}
}
The trade-offs
num_nat_gateways = 1— all private subnets across all AZs route through a single NAT. Fine for dev; in prod it’s a cross-AZ single point of failure and adds cross-AZ data-transfer cost.num_nat_gateways = 0— private subnets get no internet route at all. That becomes isolation, not a limitation, for persistence tiers and air-gapped mgmt VPCs — but anything needing package updates needs a VPC endpoint or proxy instead.- The empty-map trick —
private_persistence_subnet_cidr_blocks = {}defers to the module’s computed CIDRs while the app tier gets explicit /24s. Mixing explicit and computed maps per tier is a clean way to pin only the ranges that appear in firewall rules.
Takeaway
NAT gateways are the classic quiet line-item: roughly $0.045/hr each plus $0.045/GB processed. Three prod AZs = ~$100/month in gateways alone. This example is the reminder that the NAT count is an explicit architectural decision — per VPC, per environment — not a default.
Verified: reconstructed example passes terraform validate against the real vpc-app module.