gcloud CLI Skill
Provide accurate, up-to-date guidance for using the gcloud command-line tool to manage Google Cloud Platform resources and services.
General gcloud Patterns
All gcloud commands follow: gcloud [GROUP] [SUBGROUP] [COMMAND] [FLAGS]
Common global flags available on every command:
--project PROJECT_ID — override active project
--account ACCOUNT — override active account
--format FORMAT — output as json, yaml, csv, table, text, value, etc.
--quiet / -q — disable interactive prompts
--impersonate-service-account SA_EMAIL — run as a service account without a key file
--verbosity LEVEL — debug, info, warning, error, critical, none
--configuration CONFIG — use a named configuration
Configurations
Manage multiple project/account/region profiles:
gcloud config configurations create NAME
gcloud config configurations activate NAME
gcloud config set project PROJECT_ID
gcloud config set compute/region REGION
gcloud config set compute/zone ZONE
gcloud config list
Top-Level Command Groups
| Group |
Purpose |
Reference |
auth |
Authentication & credentials |
references/auth.md |
config |
CLI configuration & named configurations |
references/config.md |
projects |
Manage GCP projects |
references/projects.md |
iam |
IAM roles, policies, service accounts |
references/iam.md |
compute |
VMs, disks, networks, firewalls, load balancers |
references/compute.md |
container |
GKE clusters and node pools |
references/container.md |
functions |
Cloud Functions (deploy, call, logs) |
references/functions-and-run.md |
run |
Cloud Run services and jobs |
references/functions-and-run.md |
app |
App Engine applications |
references/app.md |
builds |
Cloud Build triggers and submissions |
references/builds.md |
storage |
Cloud Storage buckets and objects (also gsutil) |
references/storage.md |
firestore |
Firestore databases and indexes |
references/firestore.md |
pubsub |
Pub/Sub topics and subscriptions |
references/pubsub.md |
sql |
Cloud SQL instances |
references/sql.md |
secrets |
Secret Manager |
references/secrets.md |
logging |
Cloud Logging read/write |
references/logging.md |
monitoring |
Cloud Monitoring dashboards and alerts |
references/monitoring.md |
artifacts |
Artifact Registry repos |
references/artifacts.md |
dns |
Cloud DNS zones and records |
references/dns.md |
kms |
Cloud KMS keys |
references/kms.md |
emulators |
Local dev emulators |
references/emulators.md |
services |
Enable/disable APIs (gcloud services enable ...) |
references/services.md |
components |
Manage SDK components (gcloud components install ...) |
references/components.md |
Bundled sub-tools: bq (BigQuery), gsutil (Cloud Storage), kubectl (Kubernetes).
Common Workflows
Deploy a Cloud Function (Gen2)
gcloud functions deploy FUNCTION_NAME \
--gen2 --runtime python312 --trigger-http \
--allow-unauthenticated --region REGION \
--source . --entry-point main
Deploy to Cloud Run
gcloud run deploy SERVICE_NAME \
--image IMAGE_URL --region REGION \
--allow-unauthenticated --set-env-vars KEY=VALUE
Enable an API
gcloud services enable firestore.googleapis.com
gcloud services list --enabled
Create a service account and grant roles
gcloud iam service-accounts create SA_NAME --display-name "Description"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="serviceAccount:SA_NAME@PROJECT_ID.iam.gserviceaccount.com" \
--role="roles/ROLE"
Troubleshooting
gcloud info — active config, account, project, SDK paths, Python version
gcloud auth list — all credentialed accounts and which is active
gcloud config list — active configuration values
- If ADC issues, check
GOOGLE_APPLICATION_CREDENTIALS env var and run gcloud auth application-default login
--log-http on any command to see raw HTTP requests/responses
--verbosity debug for maximum diagnostic output
1---2name: gcloud-cli3description: >4 Comprehensive reference for the Google Cloud CLI (gcloud). Use this skill whenever5 working with GCP infrastructure, services, or tooling via the command line. Triggers6 include: any mention of "gcloud", "Google Cloud", "GCP", Cloud Functions, Cloud Run,7 Compute Engine, IAM, service accounts, authentication with Google Cloud, ADC8 (Application Default Credentials), GCP emulators (Firestore, Pub/Sub, Bigtable,9 Datastore, Spanner), or any task requiring interaction with Google Cloud Platform10 from a terminal. Also use when deploying to GCP, managing GCP projects/configs,11 or debugging GCP authentication issues.12metadata:13 source: https://skillmd.com/skills/nealepetrillo/gcloud-cli14---1516# gcloud CLI Skill1718Provide accurate, up-to-date guidance for using the `gcloud` command-line tool to manage Google Cloud Platform resources and services.1920## General gcloud Patterns2122All gcloud commands follow: `gcloud [GROUP] [SUBGROUP] [COMMAND] [FLAGS]`2324Common global flags available on every command:25- `--project PROJECT_ID` — override active project26- `--account ACCOUNT` — override active account27- `--format FORMAT` — output as json, yaml, csv, table, text, value, etc.28- `--quiet` / `-q` — disable interactive prompts29- `--impersonate-service-account SA_EMAIL` — run as a service account without a key file30- `--verbosity LEVEL` — debug, info, warning, error, critical, none31- `--configuration CONFIG` — use a named configuration3233### Configurations3435Manage multiple project/account/region profiles:36```37gcloud config configurations create NAME38gcloud config configurations activate NAME39gcloud config set project PROJECT_ID40gcloud config set compute/region REGION41gcloud config set compute/zone ZONE42gcloud config list43```4445## Top-Level Command Groups4647| Group | Purpose | Reference |48|-------|---------|-----------|49| `auth` | Authentication & credentials | `references/auth.md` |50| `config` | CLI configuration & named configurations | `references/config.md` |51| `projects` | Manage GCP projects | `references/projects.md` |52| `iam` | IAM roles, policies, service accounts | `references/iam.md` |53| `compute` | VMs, disks, networks, firewalls, load balancers | `references/compute.md` |54| `container` | GKE clusters and node pools | `references/container.md` |55| `functions` | Cloud Functions (deploy, call, logs) | `references/functions-and-run.md` |56| `run` | Cloud Run services and jobs | `references/functions-and-run.md` |57| `app` | App Engine applications | `references/app.md` |58| `builds` | Cloud Build triggers and submissions | `references/builds.md` |59| `storage` | Cloud Storage buckets and objects (also `gsutil`) | `references/storage.md` |60| `firestore` | Firestore databases and indexes | `references/firestore.md` |61| `pubsub` | Pub/Sub topics and subscriptions | `references/pubsub.md` |62| `sql` | Cloud SQL instances | `references/sql.md` |63| `secrets` | Secret Manager | `references/secrets.md` |64| `logging` | Cloud Logging read/write | `references/logging.md` |65| `monitoring` | Cloud Monitoring dashboards and alerts | `references/monitoring.md` |66| `artifacts` | Artifact Registry repos | `references/artifacts.md` |67| `dns` | Cloud DNS zones and records | `references/dns.md` |68| `kms` | Cloud KMS keys | `references/kms.md` |69| `emulators` | Local dev emulators | `references/emulators.md` |70| `services` | Enable/disable APIs (`gcloud services enable ...`) | `references/services.md` |71| `components` | Manage SDK components (`gcloud components install ...`) | `references/components.md` |7273Bundled sub-tools: `bq` (BigQuery), `gsutil` (Cloud Storage), `kubectl` (Kubernetes).7475## Common Workflows7677### Deploy a Cloud Function (Gen2)78```bash79gcloud functions deploy FUNCTION_NAME \80 --gen2 --runtime python312 --trigger-http \81 --allow-unauthenticated --region REGION \82 --source . --entry-point main83```8485### Deploy to Cloud Run86```bash87gcloud run deploy SERVICE_NAME \88 --image IMAGE_URL --region REGION \89 --allow-unauthenticated --set-env-vars KEY=VALUE90```9192### Enable an API93```bash94gcloud services enable firestore.googleapis.com95gcloud services list --enabled96```9798### Create a service account and grant roles99```bash100gcloud iam service-accounts create SA_NAME --display-name "Description"101gcloud projects add-iam-policy-binding PROJECT_ID \102 --member="serviceAccount:SA_NAME@PROJECT_ID.iam.gserviceaccount.com" \103 --role="roles/ROLE"104```105106## Troubleshooting107108- `gcloud info` — active config, account, project, SDK paths, Python version109- `gcloud auth list` — all credentialed accounts and which is active110- `gcloud config list` — active configuration values111- If ADC issues, check `GOOGLE_APPLICATION_CREDENTIALS` env var and run `gcloud auth application-default login`112- `--log-http` on any command to see raw HTTP requests/responses113- `--verbosity debug` for maximum diagnostic output