🔧 The Google Cloud CLI (gcloud): Sign In, Configurations, Format and Filter

How gcloud is organized, the sign-in options, named configurations for switching between projects, the --format and --filter flags that replace queries, and the topic guides that work offline

💡 How this page was tested. On 6 October 2026 I installed the Google Cloud CLI 588.0.0 (core 2026.10.02) from Google's tarball into a throwaway folder, with a private configuration directory (CLOUDSDK_CONFIG) so no real configuration was touched, and ran everything that works without signing in: the version, the errors when no account exists, project and configuration settings, --format, and the offline help topics. Anything that needs a real account is marked from the documentation, not run here. The sibling pages: az, aws, oci and the comparison.

What gcloud is

gcloud is the Google Cloud command-line interface. Its commands are organized as groups, then verbs, and are usually quite readable: gcloud compute instances list, gcloud projects create, gcloud storage buckets create, gcloud config set project. Most things you do are about a project (see the account page): the CLI remembers which one in its configuration.

Getting it

Google offers a package for the usual Linux package managers, a snap, and a tarball that unpacks to a folder and has its own installer. I used the tarball, so that it all lives in one directory that I can delete:

curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-x86_64.tar.gz
tar xzf google-cloud-cli-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh --quiet --path-update=false

Or skip installing: Cloud Shell in the console has gcloud ready and signed in. The version and parts, as run:

user@lab:~$ gcloud --version
Google Cloud SDK 588.0.0
bq 2.1.39
bundled-python3-unix 3.14.7
core 2026.10.02
gcloud-crc32c 1.0.0
gsutil 5.37
user@lab:~$ gcloud config list
[core]
disable_prompts = 1
disable_usage_reporting = true

Your active configuration is: [default]
user@lab:~$ gcloud auth list

No credentialed accounts.

To login, run:
  $ gcloud auth login `ACCOUNT`
user@lab:~$ gcloud compute instances list
ERROR: (gcloud.compute.instances.list) You do not currently have an active account selected.
Please run:

  $ gcloud auth login

to obtain new credentials.

If you have already logged in with a different account, run:

  $ gcloud config set account ACCOUNT

to select an already authenticated account to use.

Before you sign in

The output above also shows an unsigned gcloud:

Signing in

From Google's documentation (read on 6 October 2026):

gcloud auth list shows who is signed in (the active account has an asterisk), and gcloud config list shows the project and the defaults. Run both before you create anything.

Configurations: one tool, several projects

A configuration is a named bundle of settings: account, project, default region and zone. You can have several, and switch between them in one command. This is gcloud's best feature for people who work with more than one project, and it ran for real:

user@lab:~$ gcloud config set project my-lab-4821
Updated property [core/project].
user@lab:~$ gcloud config set compute/region us-central1
ERROR: (gcloud.config.set) You do not currently have an active account selected.
Please run:

  $ gcloud auth login

to obtain new credentials.

If you have already logged in with a different account, run:

  $ gcloud config set account ACCOUNT

to select an already authenticated account to use.
user@lab:~$ gcloud config list
[core]
disable_prompts = 1
disable_usage_reporting = true

Your active configuration is: [default]
user@lab:~$ gcloud config list --format='value(core.project)'
my-lab-4821
user@lab:~$ gcloud config get project
my-lab-4821
user@lab:~$ gcloud config list --format=json
{
  "core": {
    "disable_prompts": "1",
    "disable_usage_reporting": "true",
    "project": "my-lab-4821"
  }
}

Read it:

Now two configurations:

user@lab:~$ gcloud config configurations list
NAME     IS_ACTIVE  ACCOUNT  PROJECT      COMPUTE_DEFAULT_ZONE  COMPUTE_DEFAULT_REGION
default  True                my-lab-4821
user@lab:~$ gcloud config configurations create work
Created [work].
Activated [work].
user@lab:~$ gcloud config set project other-proj-1234
Updated property [core/project].
user@lab:~$ gcloud config configurations activate default; gcloud config get project
Activated [default].
my-lab-4821

On disk (from the same session): the settings are in plain files under ~/.config/gcloud/configurations/, named config_default and config_work, and the file active_config names the one in use. Other files in that folder, such as credentials.db, hold sign-in secrets: back them up carefully or not at all.

The environment variable CLOUDSDK_ACTIVE_CONFIG_NAME=NAME picks the active configuration for one shell (it is named in the offline gcloud topic configurations guide), and CLOUDSDK_CONFIG moves the whole settings folder (it is how this test was kept private).

Flags override the configuration for one command: --project PROJECT_ID, --configuration NAME, --account ACCOUNT (all are in the real help text). In scripts, always pass --project instead of trusting whatever is active.

Format and filter: gcloud's own query language

gcloud does not use JMESPath. It has its own pair of flags (explained in the offline gcloud topic formats and gcloud topic filters guides):

The real help says: "Use the --format flag to change the default output format of a command", and "Use the --filter flag to select resources to be listed". On a real project (from the documentation, not run here):

gcloud compute instances list
gcloud compute instances list --filter="status=RUNNING" --format="table(name, zone.basename(), machineType.basename(), status)"
gcloud compute instances list --format="value(name)"
gcloud projects list --format=json

Help, with no account

Everything here ran for real and needs no sign-in:

Habits that save you

The cheat sheet

← The AWS CLI (aws): Sign In, Profiles, Output and Query · ↑ All tutorials · The Oracle Cloud CLI (oci): Config File, API Keys, Sessions and Query →