Using a static external IP for google cloud run

Tags:

Using static ip for google cloud run when connecting to external network is pretty useful if any of your external counterpart is using ip address based authentication, e.g., mongodb. There’s VPC peering to solve this problem, but it takes a good amount of money for small experiments.

This document explains how one can use static ip from serverless cloud run. But there is one critical knowledge gap of ‘subnetwork’. Why do we need it?

Subnet is to make your cloud run acts as if it belongs to that subnet. Remember that cloud run has only ephemeral ip addresses, so they don’t belong to anywhere in the ip address range. Subnet thus gives gcloud run accesses to any other resources in the VPC, e.g., VMs, if there is any in the ip address range.

So, if you have nothing other than the gcloud run, just use ‘10.124.0.0/28’ as the example proposes.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *