Connect to Memorystore from Cloud Run

2020-02-05 18:10发布

问题:

I want to run a service on Google Cloud Run that uses Cloud Memorystore as cache.

I created an Memorystore instance in the same region as Cloud Run and used the example code to connect: https://github.com/GoogleCloudPlatform/golang-samples/blob/master/memorystore/redis/main.go this didn't work.

Next I created a Serverless VPC access Connectore which didn't help. I use Cloud Run without a GKE Cluster so I can't change any configuration.

Is there a way to connect from Cloud Run to Memorystore?

回答1:

Cloud Run is expected to get support for the Serverless VPC Connector in the future, which is the prerequisite for using Cloud Memorystore.

You could create a Cloud Run on GKE cluster and host your service there until the Serverless VPC Access support is available on Cloud Run.

Another alternative is to use a redis instance on Redis Labs by adapting this App Engine how-to guide



回答2:

If you need something in your VPC, you can also spin up Redis on Compute Engine

It's more costly (especially for a Cluster) than Redis Cloud - but an temp solution if you have to keep the data in your VPC.



回答3:

According to the updated Cloud Run documentation that serverless VPC access is now available along with explicit support for Memorystore