Google Cloud • DevOps • SRE

Google Cloud CLI Commands Cheat Sheet

Practical gcloud commands for Compute Engine, Cloud Storage, GKE, Artifact Registry, Cloud Run, Cloud SQL, IAM, networking, logging, monitoring and CI/CD automation.

142 commands across 25 categories

Google Cloud CLI Setup and Version

5 commands
gcloud version

Display the installed Google Cloud CLI version and components.

gcloud help

Search Google Cloud CLI help documentation.

gcloud topic configurations

Learn about gcloud configurations and configuration management.

gcloud components list

List installed and available Google Cloud CLI components.

gcloud components update

Update installed Google Cloud CLI components.

Google Cloud Authentication

5 commands
gcloud init

Initialize gcloud, authenticate and configure a Google Cloud project.

gcloud auth login

Authenticate the Google Cloud CLI with a Google account.

gcloud auth list

List authenticated Google Cloud accounts.

gcloud auth revoke <ACCOUNT>

Revoke credentials for a Google Cloud account.

gcloud auth application-default login

Configure Application Default Credentials for local development.

Google Cloud Projects

5 commands
gcloud projects list

List accessible Google Cloud projects.

gcloud config get-value project

Display the currently configured Google Cloud project.

gcloud config set project <PROJECT_ID>

Set the active Google Cloud project.

gcloud projects describe <PROJECT_ID>

Display project metadata.

gcloud projects create <PROJECT_ID>

Create a new Google Cloud project.

Google Cloud Configurations

6 commands
gcloud config list

Display active gcloud configuration properties.

gcloud config configurations list

List available gcloud configurations.

gcloud config configurations create <NAME>

Create a separate gcloud configuration.

gcloud config configurations activate <NAME>

Activate a gcloud configuration.

gcloud config set compute/region <REGION>

Set the default Compute Engine region.

gcloud config set compute/zone <ZONE>

Set the default Compute Engine zone.

Compute Engine Virtual Machines

10 commands
gcloud compute instances list

List Compute Engine VM instances.

gcloud compute instances describe <INSTANCE> --zone=<ZONE>

Display details about a Compute Engine instance.

gcloud compute instances create <INSTANCE> --zone=<ZONE>

Create a Compute Engine VM.

gcloud compute instances create <INSTANCE> --zone=<ZONE> --machine-type=<MACHINE_TYPE>

Create a VM using a specific machine type.

gcloud compute instances start <INSTANCE> --zone=<ZONE>

Start a stopped VM.

gcloud compute instances stop <INSTANCE> --zone=<ZONE>

Stop a running VM.

gcloud compute instances restart <INSTANCE> --zone=<ZONE>

Restart a VM instance.

gcloud compute instances delete <INSTANCE> --zone=<ZONE>

Delete a Compute Engine VM.

gcloud compute ssh <INSTANCE> --zone=<ZONE>

Connect to a Compute Engine VM over SSH.

gcloud compute scp <LOCAL_FILE> <INSTANCE>:<REMOTE_PATH> --zone=<ZONE>

Copy files to a Compute Engine VM.

Compute Engine Disks and Images

8 commands
gcloud compute disks list

List persistent disks.

gcloud compute disks describe <DISK> --zone=<ZONE>

Display persistent disk details.

gcloud compute disks create <DISK> --size=<SIZE>

Create a persistent disk.

gcloud compute disks delete <DISK> --zone=<ZONE>

Delete a persistent disk.

gcloud compute images list

List available Compute Engine images.

gcloud compute images describe <IMAGE>

Display image metadata.

gcloud compute snapshots list

List disk snapshots.

gcloud compute snapshots create <SNAPSHOT> --source-disk=<DISK>

Create a snapshot from a persistent disk.

Google Cloud Storage

9 commands
gcloud storage buckets list

List Cloud Storage buckets.

gcloud storage buckets create gs://<BUCKET>

Create a Cloud Storage bucket.

gcloud storage buckets describe gs://<BUCKET>

Display Cloud Storage bucket metadata.

gcloud storage buckets delete gs://<BUCKET>

Delete a Cloud Storage bucket.

gcloud storage ls

List Cloud Storage buckets and objects.

gcloud storage cp <FILE> gs://<BUCKET>/

Upload a file to Cloud Storage.

gcloud storage cp gs://<BUCKET>/<OBJECT> .

Download an object from Cloud Storage.

gcloud storage rsync <LOCAL_DIR> gs://<BUCKET>/<PATH>

Synchronize a local directory with Cloud Storage.

gcloud storage rm gs://<BUCKET>/<OBJECT>

Delete a Cloud Storage object.

VPC Networks

6 commands
gcloud compute networks list

List VPC networks.

gcloud compute networks describe <NETWORK>

Display VPC network details.

gcloud compute networks create <NETWORK>

Create a custom VPC network.

gcloud compute networks delete <NETWORK>

Delete a VPC network.

gcloud compute networks subnets list

List VPC subnets.

gcloud compute networks subnets create <SUBNET> --network=<NETWORK> --region=<REGION> --range=<CIDR>

Create a subnet in a VPC network.

Firewall Rules

4 commands
gcloud compute firewall-rules list

List VPC firewall rules.

gcloud compute firewall-rules describe <RULE>

Display firewall rule details.

gcloud compute firewall-rules create <RULE> --network=<NETWORK> --allow=tcp:80

Create a firewall rule allowing HTTP traffic.

gcloud compute firewall-rules delete <RULE>

Delete a firewall rule.

Google Kubernetes Engine

7 commands
gcloud container clusters list

List GKE clusters.

gcloud container clusters create <CLUSTER> --zone=<ZONE>

Create a GKE cluster.

gcloud container clusters create-auto <CLUSTER> --region=<REGION>

Create an Autopilot GKE cluster.

gcloud container clusters describe <CLUSTER> --zone=<ZONE>

Display GKE cluster details.

gcloud container clusters get-credentials <CLUSTER> --zone=<ZONE>

Configure kubectl credentials for a GKE cluster.

gcloud container clusters resize <CLUSTER> --num-nodes=<COUNT> --zone=<ZONE>

Resize a GKE cluster.

gcloud container clusters delete <CLUSTER> --zone=<ZONE>

Delete a GKE cluster.

Google Artifact Registry

5 commands
gcloud artifacts repositories list

List Artifact Registry repositories.

gcloud artifacts repositories create <REPOSITORY> --repository-format=docker --location=<REGION>

Create a Docker Artifact Registry repository.

gcloud artifacts repositories describe <REPOSITORY> --location=<REGION>

Display repository details.

gcloud artifacts repositories delete <REPOSITORY> --location=<REGION>

Delete an Artifact Registry repository.

gcloud auth configure-docker <REGION>-docker.pkg.dev

Configure Docker authentication for Artifact Registry.

Cloud Run

5 commands
gcloud run services list

List Cloud Run services.

gcloud run deploy <SERVICE> --image=<IMAGE>

Deploy a container image to Cloud Run.

gcloud run services describe <SERVICE> --region=<REGION>

Display Cloud Run service details.

gcloud run services update <SERVICE> --region=<REGION>

Update Cloud Run service configuration.

gcloud run services delete <SERVICE> --region=<REGION>

Delete a Cloud Run service.

Cloud Functions

5 commands
gcloud functions list

List Cloud Functions.

gcloud functions deploy <FUNCTION> --runtime=<RUNTIME> --trigger-http

Deploy an HTTP-triggered Cloud Function.

gcloud functions describe <FUNCTION>

Display Cloud Function details.

gcloud functions logs read <FUNCTION>

Read Cloud Function logs.

gcloud functions delete <FUNCTION>

Delete a Cloud Function.

Cloud SQL

7 commands
gcloud sql instances list

List Cloud SQL instances.

gcloud sql instances describe <INSTANCE>

Display Cloud SQL instance details.

gcloud sql instances create <INSTANCE> --database-version=POSTGRES_16 --tier=<TIER>

Create a Cloud SQL PostgreSQL instance.

gcloud sql databases list --instance=<INSTANCE>

List databases in a Cloud SQL instance.

gcloud sql databases create <DATABASE> --instance=<INSTANCE>

Create a Cloud SQL database.

gcloud sql instances restart <INSTANCE>

Restart a Cloud SQL instance.

gcloud sql instances delete <INSTANCE>

Delete a Cloud SQL instance.

IAM and Service Accounts

7 commands
gcloud iam service-accounts list

List service accounts.

gcloud iam service-accounts create <ACCOUNT> --display-name=<DISPLAY_NAME>

Create a service account.

gcloud iam service-accounts keys create <FILE> --iam-account=<EMAIL>

Create a service account key file.

gcloud iam service-accounts delete <EMAIL>

Delete a service account.

gcloud projects get-iam-policy <PROJECT_ID>

Display IAM policy for a project.

gcloud projects add-iam-policy-binding <PROJECT_ID> --member=<MEMBER> --role=<ROLE>

Grant an IAM role to a principal at project level.

gcloud projects remove-iam-policy-binding <PROJECT_ID> --member=<MEMBER> --role=<ROLE>

Remove an IAM role binding.

Cloud DNS

4 commands
gcloud dns managed-zones list

List Cloud DNS managed zones.

gcloud dns managed-zones create <ZONE> --dns-name=<DOMAIN> --description=<DESCRIPTION>

Create a managed DNS zone.

gcloud dns record-sets list --zone=<ZONE>

List DNS records in a managed zone.

gcloud dns managed-zones delete <ZONE>

Delete a DNS managed zone.

Cloud Monitoring

2 commands
gcloud monitoring policies list

List Cloud Monitoring alert policies.

gcloud monitoring policies describe <POLICY>

Display an alert policy.

Cloud Logging

4 commands
gcloud logging logs list

List available logs.

gcloud logging read '<FILTER>'

Read log entries matching a filter.

gcloud logging read '<FILTER>' --limit=50

Read a limited number of matching log entries.

gcloud logging sinks list

List configured logging sinks.

Secret Manager

5 commands
gcloud secrets list

List Secret Manager secrets.

gcloud secrets create <SECRET> --replication-policy=automatic

Create a Secret Manager secret.

gcloud secrets versions add <SECRET> --data-file=<FILE>

Add a new secret version from a file.

gcloud secrets versions access latest --secret=<SECRET>

Read the latest secret version.

gcloud secrets delete <SECRET>

Delete a secret.

BigQuery

4 commands
bq ls

List BigQuery datasets.

bq ls <PROJECT_ID>:<DATASET>

List tables in a BigQuery dataset.

bq show <PROJECT_ID>:<DATASET>

Display BigQuery dataset information.

bq query --use_legacy_sql=false '<SQL>'

Run a standard SQL query using the bq CLI.

Google Cloud APIs

4 commands
gcloud services list --enabled

List enabled Google Cloud APIs and services.

gcloud services list --available

List APIs and services available to enable.

gcloud services enable <SERVICE>.googleapis.com

Enable a Google Cloud API.

gcloud services disable <SERVICE>.googleapis.com

Disable a Google Cloud API.

Google Cloud Output and Filtering

6 commands
gcloud compute instances list --format=json

Return command output as JSON.

gcloud compute instances list --format='table(name,zone)'

Display selected fields in table format.

gcloud compute instances list --filter='status=RUNNING'

Filter resources by status.

gcloud compute instances list --sort-by=name

Sort command results by resource name.

gcloud compute instances list --limit=10

Limit the number of returned resources.

gcloud <COMMAND> --quiet

Disable interactive prompts for automation.

Google Cloud CLI Troubleshooting

6 commands
gcloud info

Display gcloud environment and installation information.

gcloud auth list

Verify authenticated accounts.

gcloud config list

Check active configuration and project settings.

gcloud config get-value project

Verify the active Google Cloud project.

gcloud services list --enabled

Check which APIs are enabled.

gcloud <COMMAND> --verbosity=debug

Enable detailed debugging output.

CI/CD Google Cloud Workflow

8 commands
gcloud auth activate-service-account --key-file=<KEY_FILE>

Authenticate CI/CD automation with a service account key.

gcloud config set project <PROJECT_ID>

Set the target Google Cloud project for CI/CD.

gcloud auth configure-docker <REGION>-docker.pkg.dev

Configure Docker authentication for Artifact Registry.

docker build -t <REGION>-docker.pkg.dev/<PROJECT_ID>/<REPOSITORY>/myapp:$BUILD_NUMBER .

Build a versioned Docker image for Artifact Registry.

docker push <REGION>-docker.pkg.dev/<PROJECT_ID>/<REPOSITORY>/myapp:$BUILD_NUMBER

Push the image to Artifact Registry.

gcloud run deploy <SERVICE> --image=<IMAGE> --region=<REGION>

Deploy the image to Cloud Run.

gcloud container clusters get-credentials <CLUSTER> --zone=<ZONE>

Load GKE credentials for Kubernetes deployment.

kubectl apply -f deployment.yaml

Deploy Kubernetes resources to GKE.

Useful Google Cloud DevOps Commands

5 commands
gcloud cheat-sheet

Display the built-in gcloud cheat sheet.

gcloud topic filters

Learn how gcloud filtering works.

gcloud topic formats

Learn about gcloud output formatting.

gcloud topic command-conventions

Learn standard gcloud command conventions.

gcloud <COMMAND> --help

Display detailed help for a specific gcloud command.

Google Cloud CLI Setup and Version

gcloud version

Display the installed Google Cloud CLI version and components.

gcloud help

Search Google Cloud CLI help documentation.

gcloud topic configurations

Learn about gcloud configurations and configuration management.

gcloud components list

List installed and available Google Cloud CLI components.

gcloud components update

Update installed Google Cloud CLI components.

Google Cloud Authentication

gcloud init

Initialize gcloud, authenticate and configure a Google Cloud project.

gcloud auth login

Authenticate the Google Cloud CLI with a Google account.

gcloud auth list

List authenticated Google Cloud accounts.

gcloud auth revoke <ACCOUNT>

Revoke credentials for a Google Cloud account.

gcloud auth application-default login

Configure Application Default Credentials for local development.

Google Cloud Projects

gcloud projects list

List accessible Google Cloud projects.

gcloud config get-value project

Display the currently configured Google Cloud project.

gcloud config set project <PROJECT_ID>

Set the active Google Cloud project.

gcloud projects describe <PROJECT_ID>

Display project metadata.

gcloud projects create <PROJECT_ID>

Create a new Google Cloud project.

Google Cloud Configurations

gcloud config list

Display active gcloud configuration properties.

gcloud config configurations list

List available gcloud configurations.

gcloud config configurations create <NAME>

Create a separate gcloud configuration.

gcloud config configurations activate <NAME>

Activate a gcloud configuration.

gcloud config set compute/region <REGION>

Set the default Compute Engine region.

gcloud config set compute/zone <ZONE>

Set the default Compute Engine zone.

Compute Engine Virtual Machines

gcloud compute instances list

List Compute Engine VM instances.

gcloud compute instances describe <INSTANCE> --zone=<ZONE>

Display details about a Compute Engine instance.

gcloud compute instances create <INSTANCE> --zone=<ZONE>

Create a Compute Engine VM.

gcloud compute instances create <INSTANCE> --zone=<ZONE> --machine-type=<MACHINE_TYPE>

Create a VM using a specific machine type.

gcloud compute instances start <INSTANCE> --zone=<ZONE>

Start a stopped VM.

gcloud compute instances stop <INSTANCE> --zone=<ZONE>

Stop a running VM.

gcloud compute instances restart <INSTANCE> --zone=<ZONE>

Restart a VM instance.

gcloud compute instances delete <INSTANCE> --zone=<ZONE>

Delete a Compute Engine VM.

gcloud compute ssh <INSTANCE> --zone=<ZONE>

Connect to a Compute Engine VM over SSH.

gcloud compute scp <LOCAL_FILE> <INSTANCE>:<REMOTE_PATH> --zone=<ZONE>

Copy files to a Compute Engine VM.

Compute Engine Disks and Images

gcloud compute disks list

List persistent disks.

gcloud compute disks describe <DISK> --zone=<ZONE>

Display persistent disk details.

gcloud compute disks create <DISK> --size=<SIZE>

Create a persistent disk.

gcloud compute disks delete <DISK> --zone=<ZONE>

Delete a persistent disk.

gcloud compute images list

List available Compute Engine images.

gcloud compute images describe <IMAGE>

Display image metadata.

gcloud compute snapshots list

List disk snapshots.

gcloud compute snapshots create <SNAPSHOT> --source-disk=<DISK>

Create a snapshot from a persistent disk.

Google Cloud Storage

gcloud storage buckets list

List Cloud Storage buckets.

gcloud storage buckets create gs://<BUCKET>

Create a Cloud Storage bucket.

gcloud storage buckets describe gs://<BUCKET>

Display Cloud Storage bucket metadata.

gcloud storage buckets delete gs://<BUCKET>

Delete a Cloud Storage bucket.

gcloud storage ls

List Cloud Storage buckets and objects.

gcloud storage cp <FILE> gs://<BUCKET>/

Upload a file to Cloud Storage.

gcloud storage cp gs://<BUCKET>/<OBJECT> .

Download an object from Cloud Storage.

gcloud storage rsync <LOCAL_DIR> gs://<BUCKET>/<PATH>

Synchronize a local directory with Cloud Storage.

gcloud storage rm gs://<BUCKET>/<OBJECT>

Delete a Cloud Storage object.

VPC Networks

gcloud compute networks list

List VPC networks.

gcloud compute networks describe <NETWORK>

Display VPC network details.

gcloud compute networks create <NETWORK>

Create a custom VPC network.

gcloud compute networks delete <NETWORK>

Delete a VPC network.

gcloud compute networks subnets list

List VPC subnets.

gcloud compute networks subnets create <SUBNET> --network=<NETWORK> --region=<REGION> --range=<CIDR>

Create a subnet in a VPC network.

Firewall Rules

gcloud compute firewall-rules list

List VPC firewall rules.

gcloud compute firewall-rules describe <RULE>

Display firewall rule details.

gcloud compute firewall-rules create <RULE> --network=<NETWORK> --allow=tcp:80

Create a firewall rule allowing HTTP traffic.

gcloud compute firewall-rules delete <RULE>

Delete a firewall rule.

Google Kubernetes Engine

gcloud container clusters list

List GKE clusters.

gcloud container clusters create <CLUSTER> --zone=<ZONE>

Create a GKE cluster.

gcloud container clusters create-auto <CLUSTER> --region=<REGION>

Create an Autopilot GKE cluster.

gcloud container clusters describe <CLUSTER> --zone=<ZONE>

Display GKE cluster details.

gcloud container clusters get-credentials <CLUSTER> --zone=<ZONE>

Configure kubectl credentials for a GKE cluster.

gcloud container clusters resize <CLUSTER> --num-nodes=<COUNT> --zone=<ZONE>

Resize a GKE cluster.

gcloud container clusters delete <CLUSTER> --zone=<ZONE>

Delete a GKE cluster.

Google Artifact Registry

gcloud artifacts repositories list

List Artifact Registry repositories.

gcloud artifacts repositories create <REPOSITORY> --repository-format=docker --location=<REGION>

Create a Docker Artifact Registry repository.

gcloud artifacts repositories describe <REPOSITORY> --location=<REGION>

Display repository details.

gcloud artifacts repositories delete <REPOSITORY> --location=<REGION>

Delete an Artifact Registry repository.

gcloud auth configure-docker <REGION>-docker.pkg.dev

Configure Docker authentication for Artifact Registry.

Cloud Run

gcloud run services list

List Cloud Run services.

gcloud run deploy <SERVICE> --image=<IMAGE>

Deploy a container image to Cloud Run.

gcloud run services describe <SERVICE> --region=<REGION>

Display Cloud Run service details.

gcloud run services update <SERVICE> --region=<REGION>

Update Cloud Run service configuration.

gcloud run services delete <SERVICE> --region=<REGION>

Delete a Cloud Run service.

Cloud Functions

gcloud functions list

List Cloud Functions.

gcloud functions deploy <FUNCTION> --runtime=<RUNTIME> --trigger-http

Deploy an HTTP-triggered Cloud Function.

gcloud functions describe <FUNCTION>

Display Cloud Function details.

gcloud functions logs read <FUNCTION>

Read Cloud Function logs.

gcloud functions delete <FUNCTION>

Delete a Cloud Function.

Cloud SQL

gcloud sql instances list

List Cloud SQL instances.

gcloud sql instances describe <INSTANCE>

Display Cloud SQL instance details.

gcloud sql instances create <INSTANCE> --database-version=POSTGRES_16 --tier=<TIER>

Create a Cloud SQL PostgreSQL instance.

gcloud sql databases list --instance=<INSTANCE>

List databases in a Cloud SQL instance.

gcloud sql databases create <DATABASE> --instance=<INSTANCE>

Create a Cloud SQL database.

gcloud sql instances restart <INSTANCE>

Restart a Cloud SQL instance.

gcloud sql instances delete <INSTANCE>

Delete a Cloud SQL instance.

IAM and Service Accounts

gcloud iam service-accounts list

List service accounts.

gcloud iam service-accounts create <ACCOUNT> --display-name=<DISPLAY_NAME>

Create a service account.

gcloud iam service-accounts keys create <FILE> --iam-account=<EMAIL>

Create a service account key file.

gcloud iam service-accounts delete <EMAIL>

Delete a service account.

gcloud projects get-iam-policy <PROJECT_ID>

Display IAM policy for a project.

gcloud projects add-iam-policy-binding <PROJECT_ID> --member=<MEMBER> --role=<ROLE>

Grant an IAM role to a principal at project level.

gcloud projects remove-iam-policy-binding <PROJECT_ID> --member=<MEMBER> --role=<ROLE>

Remove an IAM role binding.

Cloud DNS

gcloud dns managed-zones list

List Cloud DNS managed zones.

gcloud dns managed-zones create <ZONE> --dns-name=<DOMAIN> --description=<DESCRIPTION>

Create a managed DNS zone.

gcloud dns record-sets list --zone=<ZONE>

List DNS records in a managed zone.

gcloud dns managed-zones delete <ZONE>

Delete a DNS managed zone.

Cloud Monitoring

gcloud monitoring policies list

List Cloud Monitoring alert policies.

gcloud monitoring policies describe <POLICY>

Display an alert policy.

Cloud Logging

gcloud logging logs list

List available logs.

gcloud logging read '<FILTER>'

Read log entries matching a filter.

gcloud logging read '<FILTER>' --limit=50

Read a limited number of matching log entries.

gcloud logging sinks list

List configured logging sinks.

Secret Manager

gcloud secrets list

List Secret Manager secrets.

gcloud secrets create <SECRET> --replication-policy=automatic

Create a Secret Manager secret.

gcloud secrets versions add <SECRET> --data-file=<FILE>

Add a new secret version from a file.

gcloud secrets versions access latest --secret=<SECRET>

Read the latest secret version.

gcloud secrets delete <SECRET>

Delete a secret.

BigQuery

bq ls

List BigQuery datasets.

bq ls <PROJECT_ID>:<DATASET>

List tables in a BigQuery dataset.

bq show <PROJECT_ID>:<DATASET>

Display BigQuery dataset information.

bq query --use_legacy_sql=false '<SQL>'

Run a standard SQL query using the bq CLI.

Google Cloud APIs

gcloud services list --enabled

List enabled Google Cloud APIs and services.

gcloud services list --available

List APIs and services available to enable.

gcloud services enable <SERVICE>.googleapis.com

Enable a Google Cloud API.

gcloud services disable <SERVICE>.googleapis.com

Disable a Google Cloud API.

Google Cloud Output and Filtering

gcloud compute instances list --format=json

Return command output as JSON.

gcloud compute instances list --format='table(name,zone)'

Display selected fields in table format.

gcloud compute instances list --filter='status=RUNNING'

Filter resources by status.

gcloud compute instances list --sort-by=name

Sort command results by resource name.

gcloud compute instances list --limit=10

Limit the number of returned resources.

gcloud <COMMAND> --quiet

Disable interactive prompts for automation.

Google Cloud CLI Troubleshooting

gcloud info

Display gcloud environment and installation information.

gcloud auth list

Verify authenticated accounts.

gcloud config list

Check active configuration and project settings.

gcloud config get-value project

Verify the active Google Cloud project.

gcloud services list --enabled

Check which APIs are enabled.

gcloud <COMMAND> --verbosity=debug

Enable detailed debugging output.

CI/CD Google Cloud Workflow

gcloud auth activate-service-account --key-file=<KEY_FILE>

Authenticate CI/CD automation with a service account key.

gcloud config set project <PROJECT_ID>

Set the target Google Cloud project for CI/CD.

gcloud auth configure-docker <REGION>-docker.pkg.dev

Configure Docker authentication for Artifact Registry.

docker build -t <REGION>-docker.pkg.dev/<PROJECT_ID>/<REPOSITORY>/myapp:$BUILD_NUMBER .

Build a versioned Docker image for Artifact Registry.

docker push <REGION>-docker.pkg.dev/<PROJECT_ID>/<REPOSITORY>/myapp:$BUILD_NUMBER

Push the image to Artifact Registry.

gcloud run deploy <SERVICE> --image=<IMAGE> --region=<REGION>

Deploy the image to Cloud Run.

gcloud container clusters get-credentials <CLUSTER> --zone=<ZONE>

Load GKE credentials for Kubernetes deployment.

kubectl apply -f deployment.yaml

Deploy Kubernetes resources to GKE.

Useful Google Cloud DevOps Commands

gcloud cheat-sheet

Display the built-in gcloud cheat sheet.

gcloud topic filters

Learn how gcloud filtering works.

gcloud topic formats

Learn about gcloud output formatting.

gcloud topic command-conventions

Learn standard gcloud command conventions.

gcloud <COMMAND> --help

Display detailed help for a specific gcloud command.

Recommended Google Cloud DevOps Workflow

gcloud auth logingcloud config set project <PROJECT_ID>gcloud auth configure-docker <REGION>-docker.pkg.devdocker build -t <REGION>-docker.pkg.dev/<PROJECT_ID>/<REPOSITORY>/myapp:$BUILD_NUMBER .docker push <REGION>-docker.pkg.dev/<PROJECT_ID>/<REPOSITORY>/myapp:$BUILD_NUMBERgcloud run deploy <SERVICE> --image=<IMAGE> --region=<REGION>gcloud container clusters get-credentials <CLUSTER> --zone=<ZONE>kubectl apply -f deployment.yaml

Quick Troubleshooting Workflow

  1. Check the authenticated account with gcloud auth list.
  2. Check the active project with gcloud config get-value project.
  3. Verify enabled APIs with gcloud services list --enabled.
  4. Inspect the target resource with the appropriate describe command.
  5. Check logs using gcloud logging read.
  6. Use --verbosity=debug when detailed CLI diagnostics are required.