gcloud(1)
Google Cloud command-line interface for managing Google Cloud resources and services.
Synopsis
gcloud [GLOBAL_OPTIONS] COMMAND [COMMAND_OPTIONS] [ARGUMENTS]Description
gcloud is the primary command-line tool for interacting with Google Cloud Platform (GCP). It provides a unified interface to manage compute instances, storage, databases, networking, and hundreds of other cloud services from the terminal.
Before using gcloud, authenticate with your Google Cloud account using gcloud auth login and set your active project with gcloud config set project PROJECT_ID. Configuration is stored locally and persists across sessions.
Commands are organized hierarchically: gcloud compute instances list manages Compute Engine VMs, gcloud storage buckets manages Cloud Storage, and so on. Use gcloud COMMAND --help for detailed documentation on any command.
Common options
| Flag | What it does |
|---|---|
--project PROJECT_ID | Set the GCP project for this command (overrides configuration) |
--region REGION | Set the compute region (e.g., us-central1, europe-west1) |
--zone ZONE | Set the compute zone (e.g., us-central1-a, europe-west1-b) |
--quiet, -q | Skip interactive prompts and assume default answers |
--verbosity LEVEL | Control output verbosity (debug, info, warning, error, critical) |
--format FORMAT | Output format: json, yaml, table, csv, or custom |
--help, -h | Display help for the command |
--impersonate-service-account SA_EMAIL | Execute command as a service account |
--configuration CONFIG_NAME | Use a specific named configuration |
Examples
Authenticate with your Google Cloud account and set up credentials
gcloud auth loginSet the default project for all subsequent gcloud commands
gcloud config set project my-project-idList all Compute Engine VM instances in the us-central1-a zone
gcloud compute instances list --zone=us-central1-aList all Cloud Storage buckets and output as JSON
gcloud storage buckets list --format=jsonCreate a new Compute Engine instance with a specific machine type
gcloud compute instances create my-vm --zone=us-central1-a --machine-type=e2-mediumSSH into a Compute Engine instance with automatic credential setup
gcloud compute ssh my-vm --zone=us-central1-aDisplay the current gcloud configuration and properties
gcloud config listDelete a VM instance without confirmation prompts
gcloud compute instances delete my-vm --zone=us-central1-a --quiet