GCP CLI (gcloud)
The gcloud CLI is a unified tool to manage your GCP services from the command line.
Overview
Think of the gcloud CLI (Command Line Interface) as your Swiss Army knife for Google Cloud Platform. Instead of clicking through the web console, you can manage all your GCP resources by typing commands in your terminal. This is especially useful for:
- Automating repetitive tasks
- Managing resources quickly without opening a browser
- Creating scripts to set up or modify cloud resources
- Integrating GCP management into your development workflow
The gcloud CLI comes as part of the Google Cloud SDK, which is a free set of tools that helps you work with GCP. It's available for Windows, macOS, and Linux, making it accessible no matter what system you're using.
While the web console is great for learning and occasional use, the gcloud CLI becomes invaluable when you need to perform tasks repeatedly or automate your cloud operations.
Example uses
Quick Resource Creation: Launch a new virtual machine with a single command:
gcloud compute instances create my-server --zone us-central1-a
Bulk Operations: List all running instances across all zones:
gcloud compute instances list
Project Management: Switch between different GCP projects easily:
gcloud config set project my-project-id
Service Configuration: Enable or disable GCP services:
gcloud services enable container.googleapis.com
Integration with other GCP services
The gcloud CLI works seamlessly with virtually all GCP services:
- Google Kubernetes Engine (GKE): Configure and manage Kubernetes clusters
- Cloud Storage: Upload, download, and manage files in buckets
- Cloud Functions: Deploy and manage serverless functions
- GCP Compute Engine: Create and manage virtual machines
Most importantly, any action you can perform in the GCP Console can also be done through the gcloud CLI.
Similar services in other clouds
Documents
Setting up the GCP CLI
Access and manage GCP from the command line.