Skip to content

Commit 1a50acb

Browse files
authored
Documentation for connecting to Cloud SQL (#380)
1 parent 0b407ba commit 1a50acb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/quickstarts/03-quickstart-cloudrun.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ Service [hello] revision [hello-00001-yen] has been deployed and is serving 100
9393
Service URL: https://hello-gpua4upw6q-uc.a.run.app
9494
```
9595

96+
## If connecting to Cloud SQL
97+
98+
If your Cloud Run service will connect to Cloud SQL via the [Cloud SQL Auth Proxy], then it is important
99+
to select the `gen2` Cloud Run execution environment.
100+
101+
**Note:** To do this, you may need to install the `beta` version of the gcloud CLI, but if this is required, you will be prompted. Enter `y` to accept the extra installation.
102+
103+
```shell
104+
gcloud beta run deploy NAME \
105+
--source=PATH \ # can use $PWD or . for current dir
106+
--project=PROJECT \ # the Google Cloud project ID
107+
--region=REGION \ # ex: us-central1
108+
--platform=managed \ # for Cloud Run
109+
--allow-unauthenticated # for public access
110+
--execution-environment=gen2 # helpful if using CloudSQL
111+
```
112+
96113
<br>
97114

98115
**Congratulations!** You have successfully built and deployed your function
@@ -116,6 +133,7 @@ the [Manage resources] page.
116133
[Cloud Run]: https://cloud.google.com/run
117134
[Cloud Shell]: https://cloud.google.com/shell
118135
[Cloud Shell Editor]: https://shell.cloud.google.com/?show=ide&environment_deployment=ide
136+
[Cloud SQL Auth Proxy]: https://github.com/GoogleCloudPlatform/cloud-sql-proxy
119137
[codelab]: https://codelabs.developers.google.com/codelabs/cloud-shell
120138
[delete the image]: https://cloud.google.com/container-registry/docs/managing#deleting_images
121139
[gcloud]: https://cloud.google.com/sdk/docs/install

0 commit comments

Comments
 (0)