I'm looking at the best way to deploy an app to GCP. This app neeeds to use a microservice (running on Cloud Run or Cloud Function) to execute SQL code on distant database.
Basically, the microservice received a piece of SQL code, and needs to execute it on a distant database. For security reasons, the distant database will have to whitelist the IP address that the app will use to connect to it.
On GCP, what would be the best way to have a fixed, public IP address, that a distant DB can whitelist ? Considering that I want to use Cloud Run or Cloud Function.
NB : I'm aware of solutions using GKE. Or on AWS, using Lambda + a NAT Instance.
Thanks !
You have several solutions to achieve this
Serverless VPC Access works with AppEngine and Cloud Function. Cloud Run should be compliant with it in 2020.
Last alternative: In both case, we use Cloud Nat for going on public internet with a static IP. You can imagine to set up a VPN between your VPC and the On Prem network (where is hosted your database) and like this, you have nothing to whitelist, all the communication are inside the same virtual private network