- Google Cloud SDK components and when to use them
- gcloud authentication and configuration best practices
- Example commands for common tasks
- Tips for automation and security

- Authenticate your user or service account
- Set the default project
- Optionally set default compute region/zone
- For interactive use, run:
- For headless or scripted environments:
- For service accounts (recommended for automation/CI):
- To obtain Application Default Credentials (for local code using Google client libraries):
Protect service account keys. Use Workload Identity (GKE) or short-lived credentials in CI when possible. Avoid committing
KEY.json into source control.- Set your active project so you don’t need
--projecton every command:
- Optionally set a default compute region or zone:
--zone, --machine-type, --tier) if defaults are not set or if the action needs them.
Configuration management and multi-project workflows
- Keep environments organized to avoid accidental deployments to the wrong project (dev, staging, prod).
- gcloud supports multiple named configurations that make switching contexts simple.
Use these commands to script environment setup or to switch contexts in interactive sessions.
Use the CLI for quick tasks, automation scripts, and CI/CD pipelines. For long-lived, reproducible infrastructure, combine gcloud with infrastructure-as-code tools like Terraform.
- Use gcloud for quick administration, ad-hoc scripting, or when you need direct control for a single project or operation.
- For repeatable, versioned infrastructure deployments across environments, prefer IaC tools (Terraform, Deployment Manager) and integrate gcloud commands into CI jobs when needed.
- For storage operations, use gsutil for bulk object transfers; for data warehouse operations, use
bqfor BigQuery tasks; for Kubernetes workloads, usekubectlor integrate withgcloud containercommands for GKE.
- gcloud CLI overview: https://cloud.google.com/sdk/gcloud
- Authentication for gcloud: https://cloud.google.com/sdk/docs/authorizing
- Configurations guide: https://cloud.google.com/sdk/docs/configurations
- gsutil documentation: https://cloud.google.com/storage/docs/gsutil
- BigQuery bq tool: https://cloud.google.com/bigquery/docs/bq-command-line-tool
- kubectl reference: https://kubernetes.io/docs/reference/kubectl/
