Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to get static IP address for Google Cloud Functions?

I would like to develop a Google Cloud Function that will subscribe to file changes in a Google Cloud Storage bucket and upload the file to a third party FTP site. This FTP site requires allow-listed IP addresses of clients.

As such, it is possible to get a static IP address for Google Cloud Functions containers?

like image 927
EthanS Avatar asked Aug 07 '16 07:08

EthanS


People also ask

Is static IP free on GCP?

In general, Google Cloud charges for its Static IP service. However, there are some exceptions. For instance, students and faculty with an academic institution subscription are eligible for a discounted rate. Additionally, GCP offers a free trial of its Static IP service.

Does GCP charge for static IP?

There is no charge for static or ephemeral internal IP addresses.

How do I set a static IP in GCP?

Go to the VPC networks page. Click the VPC network that you want to reserve the new static IP in. Click Static internal IP addresses and then click Reserve static address. Enter a Name for this IP address.

Does cloud run have static IP?

Requests from your Cloud Run service travel through your VPC network and reach external endpoints using the static IP address.


1 Answers

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.

like image 100
Jeff Welling Avatar answered Sep 21 '22 00:09

Jeff Welling