You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use the `gcloud run deploy` command to build and deploy your function in a
57
57
single step.
58
58
59
+
*Note:* If your Cloud Run service will connect to Cloud SQL via the
60
+
[Cloud SQL Auth Proxy], then it is important to select the `gen2` Cloud Run
61
+
execution environment.
62
+
59
63
```shell
60
64
gcloud run deploy NAME \
61
-
--source=PATH \ # can use $PWD or . for current dir
62
-
--project=PROJECT \ # the Google Cloud project ID
63
-
--region=REGION \ # ex: us-central1
64
-
--platform=managed \ # for Cloud Run
65
-
--allow-unauthenticated # for public access
65
+
--source=PATH \ # can use $PWD or . for current dir
66
+
--project=PROJECT \ # the Google Cloud project ID
67
+
--region=REGION \ # ex: us-central1
68
+
--platform=managed \ # for Cloud Run
69
+
--allow-unauthenticated # for public access
70
+
--execution-environment=gen2 # helpful if using CloudSQL
66
71
```
67
72
68
73
Since the project ID was saved to the `gcloud` configuration in the
@@ -93,23 +98,6 @@ Service [hello] revision [hello-00001-yen] has been deployed and is serving 100
93
98
Service URL: https://hello-gpua4upw6q-uc.a.run.app
94
99
```
95
100
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
-
113
101
<br>
114
102
115
103
**Congratulations!** You have successfully built and deployed your function
0 commit comments