I am developing a Cloud Run application locally (using Cloud Code in VS Code).
When I go to deploy the application, there is an option to set a connection my Cloud SQL instance:
However, I am not sure how to establish this connection when I am running/debugging locally as this dialog window never appears. Because of this, I am unable to access my Cloud SQL instance.
What is the correct way of running a Cloud Run application locally in Cloud Code and having a connection to my Cloud SQL Connection?
Best answer by malaminView original
Thank you for the question. This use case can be divided into two parts. The first part of cloud run configuration with cloud SQL and cloud code configuration with your vs code.
The second part of the database connection string should be called into your app code and it is based on your selected programming language.
The following are the configuration details for a cloud-run SQL instance.
Hopefully, you have successfully configured cloud code Extention with vscode on your local machine.
Then, configure the cloud SQL instance, enable Cloud SQL Admin API, IAM roles, and service account to use either a public or private IP address.
It would be better to follow the below link rather than write the code here step by step.
I hope it will help you to overcome the issue.
@davidressler and welcome to C2C, the Google Cloud Customer Community! It’s great to have you with us!
First things first, did
@malamin’s answer perhaps help you? Or do you need more help?
Also: Don’t forget to check out our upcoming events!
Again, a big welcome!