Google Cloud CLI (gcloud) cheatsheet
Google Cloud CLI (gcloud): Storage, secrets and logs
7 common Google Cloud CLI (gcloud) tasks.
Copy files to or from a bucket
Copy a local file to a bucket. Add --recursive for folders.
gcloud storage cp file.txt gs://my-bucket/
Sync a folder with a bucket
Make a bucket match a local folder.
gcloud storage rsync ./dist gs://my-bucket --recursive
Read a secret
Print the latest version of a Secret Manager secret.
gcloud secrets versions access latest --secret my-secret
Caution: This prints the secret in your terminal.
Store a secret
Create a secret from a file.
gcloud secrets create my-secret --data-file ./secret.txt
Read logs
Query the most recent error log entries.
gcloud logging read "severity>=ERROR" --limit 20 --format json