Possible to get static IP address for Google Cloud Functions?

Update: This feature is now available in GCP https://cloud.google.com/functions/docs/networking/network-settings#associate-static-ip


First of all this is not an unreasonable request, don't get gaslighted. AWS Lambdas already support this feature and have for awhile now. If you're interested in this feature please star this feature request: https://issuetracker.google.com/issues/112629904

Secondly, we arrived at a work-around which I also posted to that issue as well, maybe this will work for you too:

  • Setup a VPC Connector
  • Create a Cloud NAT on the VPC
  • Create a Proxy host which does not have a public IP, so the egress traffic is routed through Cloud NAT
  • Configure a Cloud Function which uses the VPC Connector, and which is configured to use the Proxy server for all outbound traffic

A caveat to this approach:

  • We wanted to put the proxy in a Managed Instance Group and behind a GCP Internal LB so that it would dynamically scale, but GCP Support has confirmed this is not possible because the GCP ILB basically allow-lists the subnet, and the Cloud Function CIDR is outside that subnet

I hope this is helpful.

Update: Just the other day, they announced an early-access beta for this exact feature!!

"Cloud Functions PM here. We actually have an early-access preview of this feature if you'd like to test it out.

Please complete this form so we can add you..."

The form can be found in the Issue linked above.


See answer below -- it took a number of years, but this is now supported.

https://cloud.google.com/functions/docs/networking/network-settings#associate-static-ip