The gcloud CLI cheat sheet

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 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.


Make the gcloud CLI your own; personalize your configuration with properties.

Authorization and Credentials

Grant and revoke authorization to the gcloud CLI and manage credentials.


Manage project access policies.


Configuring Identity and Access Management (IAM) preferences and service accounts.

Docker & Google Kubernetes Engine (GKE)

Manage containerized applications on Kubernetes.

Virtual Machines & Compute Engine

Create, run, and manage VMs on Google Cloud infrastructure.

Serverless & App Engine

Build highly scalable applications on a fully managed serverless platform


Commands that might come in handy

Introductory primer

A quick primer for getting started with the gcloud CLI.

Installing the Google Cloud CLI

Install the Google Cloud CLI with these installation instructions.

Flags, arguments, and other wondrous additions

Arguments can be positional arguments or flags:

  • Positional args: Set after command name; must respect order of positional args.
  • Flags: Set after positional args; order of flags doesn’t matter.

    A flag can be either a:

    • Name-value pair (--foo=bar), or
    • Boolean (--force/no-force).

    Additionally, flags can either be:

    • Required
    • Optional: If an optional flag is not defined, the default value is used

Global flags

Some flags are available throughout the gcloud CLI experience, like:

  • --help: For when in doubt; display detailed help for a command.
  • --project: If using a project other than the current one.
  • --quiet: Disabling interactive prompting (and applying default values for inputs).
  • --verbosity: Can set verbosity levels at debug, info, warning, error, critical, and none.
  • --version: Display gcloud version information.
  • --format: Set output format as config, csv, default, diff, disable, flattened, get, json, list, multi, none, object, table, text, value, or yaml.

Cleaning up results

Get the most from your output with the filter, format, limit, and sort-by flags.

For Compute Engine instances with prefix us and not machine type f1-micro:

gcloud compute instances list --filter="zone ~ ^us AND -machineType:f1-micro"

For a list of projects created on or after 15 January 2018, sorted from oldest to newest, presented as a table with project number, project id and creation time columns with dates and times in local timezone:

gcloud projects list --format="table(projectNumber,projectId,"
--filter="createTime>=2018-01-15T12:00:00" --sort-by=createTime

For a list of ten Compute Engine instances with a label my-label (of any value):

gcloud compute instances list --filter="*" --limit=10

Understanding commands

The underlying patterns for gcloud CLI commands; to aid self-discovery of commands.

Finding gcloud CLI commands

The gcloud CLI is a tree; non-leaf nodes are command groups and leaf nodes are commands. (Also, tab completion works for commands and resources!)

Most gcloud commands follow the following format:

gcloud + release level (optional) + component + entity + operation + positional args + flags

For example: gcloud + compute + instances + create + example-instance-1 + --zone=us-central1-a

Release level

Release Level refers to the command’s release status.

Example: alpha for alpha commands, beta for beta commands, no release level needed for GA commands.


Component refers to the different Google Cloud services.

Example: compute for Compute Engine, app for App Engine, etc.


Entity refers to the plural form of an element or collection of elements under a component.

Example: disks, firewalls, images, instances, regions, zones for compute


Operation refers to the imperative verb form of the operation to be performed on the entity.

Example: Common operations are describe, list, create/update, delete/clear, import, export, copy, remove, add, reset, restart, restore, run, and deploy.

Positional args

Positional args refer to the required, order-specific arguments needed to execute the command.

Example: <INSTANCE_NAMES> is the required positional argument for gcloud compute instances create.


Flags refer to the additional arguments, --flag-name(=value), passed in to the command after positional args.

Example: --machine-type=<MACHINE_TYPE> and --preemptible are optional flags for gcloud compute instances create.