A roster of go-to commands for the Google Cloud CLI, the primary command-line tool for Google Cloud.
(Also included: introductory primer, understanding commands, and a printable PDF.)
Cheat sheet
Getting started
Get going with the gcloud CLI.
gcloud init: Initialize, authorize, and configure the gcloud CLI.gcloud version: Display version and installed components.gcloud components install: Install specific components.gcloud components update: Update your gcloud CLI to the latest version.gcloud config set project: Set a default Google Cloud project to work on.gcloud info: Display current gcloud CLI environment details.
Help
gcloud CLI is happy to help.
gcloud help: Search the gcloud CLI reference documents for specific terms.gcloud feedback: Provide feedback to the gcloud CLI team.gcloud topic: Supplementary help material for non-command topics like accessibility, filtering, and formatting.
Personalization
Make the gcloud CLI your own; personalize your configuration with properties.
gcloud config set: Define a property (like compute/zone) for the current configuration.gcloud config get: Fetch the value of a gcloud CLI property.gcloud config list: Display all the properties for the current configuration.gcloud config configurations create: Create a new named configuration.gcloud config configurations list: Display a list of all available configurations.gcloud config configurations activate: Switch to an existing named configuration.
Authorization and Credentials
Grant and revoke authorization to the gcloud CLI and manage credentials.
gcloud auth login: Authorize Google Cloud access for the gcloud CLI with Google Cloud user credentials and set the current account as active.gcloud auth activate-service-account: Authorize Google Cloud access similar togcloud auth loginbut with service account credentials.gcloud auth application-default: Manage your Application Default Credentials (ADC) for Cloud Client Libraries.gcloud auth list: List all credentialed accounts.gcloud auth print-access-token: Display the current account's access token.gcloud auth revoke: Remove access credentials for an account.
Projects
Manage project access policies.
gcloud projects describe: Display metadata for a project (including its ID).gcloud projects add-iam-policy-binding: Add an IAM policy binding to a specified project.
IAM
Configuring Identity and Access Management (IAM) preferences and service accounts.
gcloud iam list-grantable-roles: List IAM grantable roles for a resource.gcloud iam roles create: Create a custom role for a project or org.gcloud iam service-accounts create: Create a service account for a project.gcloud iam service-accounts add-iam-policy-binding: Add an IAM policy binding to a service account.gcloud iam service-accounts set-iam-policy-binding: Replace existing IAM policy binding.gcloud iam service-accounts keys list: List a service account's keys.
Docker & Google Kubernetes Engine (GKE)
Manage containerized applications on Kubernetes.
gcloud auth configure-docker: Register the gcloud CLI as a Docker credential helper.gcloud container clusters create: Create a cluster to run GKE containers.gcloud container clusters list: List clusters for running GKE containers.gcloud container clusters get-credentials: Updatekubeconfigto getkubectlto use a GKE cluster.gcloud container images list-tags: List tag and digest metadata for a container image.
Virtual Machines & Compute Engine
Create, run, and manage VMs on Google Cloud infrastructure.
gcloud compute zones list: List Compute Engine zones.gcloud compute instances create: Create a VM instance.gcloud compute instances describe: Display a VM instance's details.gcloud compute instances list: List all VM instances in a project.gcloud compute disks snapshot: Create snapshot of persistent disks.gcloud compute snapshots describe: Display a snapshot's details.gcloud compute snapshots delete: Delete a snapshot.gcloud compute ssh: Connect to a VM instance by using SSH.
Serverless & App Engine
Build highly scalable applications on a fully managed serverless platform
gcloud app deploy: Deploy your app's code and configuration to the App Engine server.gcloud app versions list: List all versions of all services deployed to the App Engine server.gcloud app browse: Open the current app in a web browser.gcloud app create: Create an App Engine app within your current project.