Cheat Sheets Practical By Samson Tanimawo, PhD Published Jun 12, 2025 4 min read

gcloud Cheatsheet

Top commands.

Authentication

gcloud auth login: interactive browser flow. Standard for human users.

gcloud auth activate-service-account --key-file=key.json: service account auth. For CI and automation.

gcloud config configurations create dev: named configurations for switching between projects, accounts, regions.

Project and region management

gcloud config set project my-project. Sets default project for subsequent commands.

gcloud config set compute/region us-central1. Sets default region.

gcloud projects list. Lists projects you have access to. Useful when working across many.

Compute Engine commands

gcloud compute instances list. Lists VMs in current project.

gcloud compute instances create my-vm --zone=us-central1-a --machine-type=e2-medium. Creates a VM with sane defaults.

gcloud compute ssh my-vm. SSH into a VM via gcloud. Handles auth and key distribution.

GKE commands

gcloud container clusters list. Lists clusters across regions.

gcloud container clusters get-credentials my-cluster --region=us-central1. Sets up kubectl context.

gcloud container clusters update --enable-autoscaling. In-place modifications to cluster config.

Logs and debugging

gcloud logging read 'resource.type=gce_instance' --limit=50. Reads recent logs.

gcloud logging tail 'resource.type=gce_instance'. Live tail; useful during incidents.

gcloud projects describe my-project. IAM and metadata. Surfaces who has what access.