简体   繁体   中英

GCP: is it possible to switch IP for cloud functions instances?

I've found many questions about whether it's possible to get static IP for GCF, but I would like the function to switch IP as frequently as possible .

The function is used to check whether there's any update on a site. But the site blocks IP that access too frequently. (> 60 accesses per min, I think)

I tested cloud function's IP addresses by creating a cloud function which simply logs it's current IP address. and triggered it with Pub/Sub messages. I published 100 messages, and all triggered function instances printed out same IP address.

Is there any way to make the function switch IP address?

Is there any way to make the function switch IP address?

No. Cloud Functions runs on Google servers. Those servers do not change IP addresses (at least not often enough for your purposes).

One strategy is to create a VPC connector from App Engine to your Project's VPC, setup a Cloud NAT with several IP addresses. However, even with that effort you will not be guaranteed "round robin" NAT IP addresses.

Another strategy is to create duplicate Cloud Functions in different regions and zones and then use one function to call another function in different regions and zones. Each cloud function in each zone will have a different public IP address.

Note: I do not endorse bypassing a vendors policies . Your question has a technical challenge that applies to other use cases such as global health checks, distributed load creation, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM