Google Cloud CLI (gcloud) cheatsheet
Google Cloud CLI (gcloud): Cloud Run, Functions and builds
6 common Google Cloud CLI (gcloud) tasks.
Deploy to Cloud Run from source
Build the current folder and deploy it as a Cloud Run service.
gcloud run deploy my-service --source . --region us-central1 --allow-unauthenticated
Caution: --allow-unauthenticated makes the service public. Remove it for private services.
Deploy a container image to Cloud Run
Deploy an existing image.
gcloud run deploy my-service --image us-docker.pkg.dev/my-project/repo/app:v1 --region us-central1
Read Cloud Run logs
Print recent logs of a service.
gcloud run services logs read my-service --region us-central1 --limit 50
Show a service's URL
Print the URL of a deployed service.
gcloud run services describe my-service --region us-central1 --format "value(status.url)"
Deploy a function
Deploy an HTTP-triggered Python function from the current folder.
gcloud functions deploy my-function --gen2 --runtime python312 --trigger-http --region us-central1 --entry-point main
Build an image with Cloud Build
Build and push a container image to Artifact Registry.
gcloud builds submit --tag us-docker.pkg.dev/my-project/repo/app:v1