Size Cloud NAT ports and addresses from VM count and price gateway uptime plus per-GB data processing.
Cloud NAT reserves a fixed block of source ports per VM up front rather than allocating them on demand, so the address requirement is purely arithmetic: total reserved ports divided by the 64,512 ports each NAT IP provides. The billing is separate again — gateway uptime scales with VM count and data processing is charged per GB in both directions. The default 64 ports per VM is fine for a web server and hopeless for a crawler or a service that opens hundreds of connections to one API endpoint, and exhaustion shows up as intermittent connection timeouts rather than a clear error. Confirm the current uptime tier and per-GB processing price in the Google Cloud pricing calculator.
Cloud NAT
NAT addresses = ceil(VMs × ports per VM ÷ 64,512); cost = VMs × uptime price × hours + GB processed × data price + addresses × address price × hours.
NAT addresses = ceil(VMs × ports per VM ÷ 64,512); cost = VMs × uptime price × hours + GB processed × data price + addresses × address price × hours. Cloud NAT reserves a fixed block of source ports per VM up front rather than allocating them on demand, so the address requirement is purely arithmetic: total reserved ports divided by the 64,512 ports each NAT IP provides. The billing is separate again — gateway uptime scales with VM count and data processing is charged per GB in both directions.
The default 64 ports per VM is fine for a web server and hopeless for a crawler or a service that opens hundreds of connections to one API endpoint, and exhaustion shows up as intermittent connection timeouts rather than a clear error. Confirm the current uptime tier and per-GB processing price in the Google Cloud pricing calculator.
This calculator takes 9 inputs: VMs behind the gateway, Ports reserved per VM, Usable ports per NAT address, Gateway uptime price per VM-hour, Data processed through NAT, Data processing price per GB, In-use external address price per hour, Hours in the billing month, Peak connections per VM to one destination. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
Cloud NAT ports are consumed per unique destination tuple, so 64 ports means 64 simultaneous connections to the same destination address and port — not 64 connections in total. Raising the minimum ports per VM, or enabling dynamic port allocation, is the fix.