← Back to tools

Google Cloud CLI

Official command-line interface for Google Cloud Platform

Cloud & Services linuxmacoswindows Python Apache-2.0

Description

gcloud is the primary CLI for Google Cloud Platform. It provides tools to manage GCP resources including Compute Engine, Cloud Storage, BigQuery, Kubernetes Engine, Cloud Functions, and more. Part of the Google Cloud SDK which also includes gsutil and bq.

Install

homebrewbrew install google-cloud-sdk

AI Summary

Official Google Cloud CLI. Manage Compute Engine VMs, Cloud Storage, GKE clusters, Cloud Functions, BigQuery, and all GCP services from the terminal.

Capabilities

  • + Create and manage Compute Engine VM instances
  • + Deploy applications to App Engine, Cloud Run, and Cloud Functions
  • + Manage GKE Kubernetes clusters and workloads
  • + Configure IAM roles, service accounts, and permissions
  • + Interact with Cloud Storage buckets and objects via gsutil
  • + Switch between projects, accounts, and configurations

Use When

  • Managing any Google Cloud Platform resource from the terminal
  • Deploying applications to GCP services like Cloud Run or App Engine
  • Provisioning and managing GKE Kubernetes clusters
  • Automating GCP workflows in CI/CD pipelines

Avoid When

  • x Managing non-GCP cloud resources (use aws-cli, az, doctl instead)
  • x Need declarative infrastructure management (use Terraform)
  • x Simple container deployments without GCP dependency (use flyctl or Docker)

Usage Patterns

Create a Compute Engine VM

gcloud compute instances create my-vm --zone=us-central1-a --machine-type=e2-medium --image-family=debian-12 --image-project=debian-cloud

Creates a Debian VM with the specified machine type and zone

Deploy to Cloud Run

gcloud run deploy my-service --source . --region us-central1 --allow-unauthenticated

Builds a container from source and deploys it to Cloud Run

List GKE clusters

gcloud container clusters list --format='table(name,location,currentNodeCount,status)'

Lists all GKE clusters with key details in table format

Switch active project

gcloud config set project my-project-id

Sets the default project for all subsequent gcloud commands

Input / Output

stdin: Some commands accept input from stdin (e.g., configuration YAML)
stdout: Formatted output in JSON, YAML, table, or custom formats
Exit codes:
0 Success
1 General error

Typical Pipelines

gcloud compute instances list --format=json | jq '.[] | select(.status=="RUNNING") | .name'
gcloud projects list --format='value(projectId)' | fzf | xargs gcloud config set project
gcloud logging read 'severity>=ERROR' --limit 50 --format json | jq -r '.[].textPayload'

Related Tools

View AGENTS.md for Google Cloud CLI