proofboundJoin the waitlist

Platform

Cloud Run static outbound IP

A Cloud Run service reaches the internet from a dynamic address pool. A static outbound IP is a reserved address on Cloud NAT, plus a VPC path that actually sends the service's traffic through it. Direct VPC egress is the current way to build that path.

. If a provider has moved a setting, their documentation is the authority.

The shape that works

Reserve a static external IP. Attach it to a Cloud NAT gateway on a Cloud Router, for the subnet the service will use. Deploy the service with Direct VPC egress on that subnet, and set VPC egress to all traffic. “Private ranges only” leaves internet-bound calls on the dynamic pool, which is the usual reason the partner still sees a random Google address after you “set up NAT.”

  1. 1
    Create or pick a VPC subnet with enough addresses for the number of instances you will run.
  2. 2
    Reserve a regional static external IP. Add a second if Cloud NAT's port math says one address is not enough for the concurrent connections.
  3. 3
    Create a Cloud Router, then a Cloud NAT gateway that uses manual address allocation and that subnet. For Public NAT with Direct VPC egress, Google's guidance is to set minimum ports per VM to twice what one instance needs.
  4. 4
    Deploy or update the service with --network, --subnet, and --vpc-egress=all-traffic. The image, region, and subnet region have to match.
  5. 5
    Call the partner from the service and confirm the source address is the reserved one. Then put that address on the allowlist and remove any wider entry.

Serverless VPC Access connectors are the older path. Google still recommends a connector when cold start matters: Direct VPC egress in front of Cloud NAT can add 30 seconds or more at instance startup. The connector has its own always-on cost. Pick the delay or the idle cost with your eyes open.

What the allowlist trusts

  • Every Cloud Run instance using that subnet and NAT, including other services you later attach.
  • The reserved address is stable. The identity of the revision, the request, and the container is not on the packet.
  • Cloud NAT is billed while it exists, including when the service is scaled to zero and no request is in flight.
  • Cloud NAT logs for Direct VPC egress do not show Cloud Run resource names. You will not reconstruct 'which service' from the NAT log alone.

GitHub Actions in the same project still egress from GitHub unless the job runs on a runner inside this VPC. For that problem, use the GitHub Actions static IP comparison.

Sources

Related

The NAT IP is the subnet's, shared by every instance

Cloud NAT is the right whitelist entry when the whole service is one trust domain. Proofbound is in development for GitHub Actions and Kubernetes workloads that have to be named individually on the way out.

One email when early access opens.