Three Ways to Manage GCP
GCP offers three primary interfaces: the Cloud Console (a web UI at console.cloud.google.com), the gcloud command-line tool (part of the Cloud SDK, installable locally or used inside Cloud Shell), and REST/RPC APIs that underlie both. The Console is ideal for exploring resources visually and for one-off tasks, while gcloud is essential for repeatable, scriptable operations and for integrating cloud management into CI/CD pipelines. Every action performed in the Console can also be done via gcloud or the API, since the Console itself is just a client calling the same underlying APIs.
Cricket analogy: Using the Console versus gcloud is like a captain setting the field visually by walking players into position versus radioing precise coordinates from the dugout — both achieve the same field setting through different interfaces.
Installing and Configuring gcloud
After installing the Cloud SDK, you authenticate with 'gcloud auth login' (which opens a browser for OAuth) and set defaults with 'gcloud config set project' and 'gcloud config set compute/region'. Configurations can be grouped into named profiles using 'gcloud config configurations create', which is useful when you regularly switch between multiple projects, such as a dev and a production environment, without retyping project IDs on every command.
Cricket analogy: Setting a default gcloud project is like a fielding coach permanently setting the default field placement for a bowler, so you don't need to reposition everyone before every over.
# Authenticate and set a default project/region
gcloud auth login
gcloud config set project my-gcp-project-id
gcloud config set compute/region us-central1
# Create and switch between named configurations for dev vs prod
gcloud config configurations create dev
gcloud config set project my-dev-project
gcloud config configurations create prod
gcloud config set project my-prod-project
gcloud config configurations activate devCloud Shell provides a free, browser-based terminal with gcloud, kubectl, and other tools pre-installed, plus 5 GB of persistent home directory storage — useful for quick tasks without installing anything locally.
Scripting and Automation with gcloud
gcloud supports output formatting flags like '--format=json' and '--format=table(name,status)' that make it straightforward to parse command output in scripts, and combined with '--filter', you can query specific subsets of resources without writing custom API calls. This scriptability is why gcloud, rather than the Console, is the standard tool for CI/CD pipelines, infrastructure automation, and any workflow that needs to be repeatable and auditable.
Cricket analogy: Filtering gcloud output is like a statistician querying only Virat Kohli's ODI centuries against Australia from a full career database instead of scanning every match manually.
Running destructive gcloud commands like 'gcloud compute instances delete' or 'gcloud projects delete' inside a scripted pipeline without confirmation prompts (using '--quiet') can cause irreversible damage. Always double-check the active project with 'gcloud config get-value project' before running destructive commands, especially after switching configurations.
- GCP can be managed through the Cloud Console (web UI), the gcloud CLI, or directly via REST/RPC APIs.
- The Console and gcloud both call the same underlying APIs, so any action in one can be replicated in the other.
- gcloud is authenticated with 'gcloud auth login' and configured with 'gcloud config set project/region'.
- Named configurations let you switch quickly between multiple projects like dev and prod.
- Cloud Shell provides a free browser-based terminal with gcloud pre-installed and persistent storage.
- Output formatting flags like --format and --filter make gcloud scriptable for automation and CI/CD.
- Always verify the active project before running destructive commands, especially in scripts.
Practice what you learned
1. What underlies both the Cloud Console and the gcloud CLI?
2. What command sets the default project for subsequent gcloud commands?
3. Why is gcloud preferred over the Console for CI/CD pipelines?
4. What should you check before running a destructive gcloud command in a script?
Was this page helpful?
You May Also Like
What Is Google Cloud Platform?
An introduction to Google Cloud Platform, its core service categories, and how it compares to running your own infrastructure.
GCP Resource Hierarchy
How Organizations, Folders, Projects, and resources nest together in GCP, and how IAM policies inherit down this hierarchy.
GCP Global Infrastructure
How Google Cloud organizes data centers into regions, zones, and edge locations, and why this shapes availability and latency decisions.