How to securely connect to Cloud SQL from Cloud Run?

℡╲_俬逩灬. 提交于 2019-11-29 04:07:42
Steren

UPDATE: to connect to Cloud SQL from Cloud Run see the official documentation


Cloud SQL is now supported by the fully managed version of Cloud Run (Cloud Run on GKE users were already able to use Cloud SQL using a private IP)

The feature is currently in alpha, so you need to use gcloud alpha (it will be in gcloud beta within 10 days):

To get started:

  • if you do not have one already, create a Cloud SQL instance.
  • make sure that the Cloud SQL admin API
  • deploy a new revision of your Cloud Run service with gcloud alpha and the following flag: $ gcloud alpha run services update --add-cloudsql-instances [INSTANCE_CONNECTION_NAME] Where is INSTANCE_CONNECTION_NAME is of the type project:region:instancename.

When yo do this, Cloud Run will activate and configure the Cloud SQL proxy for you. You should then connect to it via the /cloudsql/[INSTANCE_CONNECTION_NAME] Unix socket.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!