LinuxCommandLibrary

gcloud-config

Manage gcloud SDK configurations

TLDR

Define a property (like compute/zone) for the current configuration

$ gcloud config set [property] [value]
copy

Fetch the value of a gcloud property
$ gcloud config get [property]
copy

Display all the properties for the current configuration
$ gcloud config list
copy

Create a new configuration with a given name
$ gcloud config configurations create [configuration_name]
copy

Display a list of all available configurations
$ gcloud config configurations list
copy

Switch to an existing configuration with a given name
$ gcloud config configurations activate [configuration_name]
copy

SYNOPSIS

gcloud config [GLOBAL-FLAG …] COMMAND [ARG …]

PARAMETERS

configurations
    Create, delete, switch between, and describe gcloud configurations.

get-value
    Display value for the given config key.

list
    Display all gcloud config variables for active configuration.

set
    Add or update a config property.

set-value
    Set config value (deprecated; use set)

unset
    Remove config properties.

config-paths
    View and edit gcloud configuration paths.

--configuration=CONFIGURATION
    Use named configuration (default: active one).

--format=FORMAT
    Output format (e.g., table, json).

DESCRIPTION

gcloud config is a core command in the Google Cloud CLI toolset for viewing, setting, and managing configuration properties used by gcloud and other Cloud SDK components. Configurations control defaults like the active project ID, compute region/zone, billing account, authentication credentials, and API enablement.

This command supports multiple named configurations (e.g., for dev/staging/prod environments), allowing seamless switching without altering environment variables. Properties are stored in INI-style files under ~/.config/gcloud/ on Linux.

Key workflows include initializing with gcloud init (which invokes config commands), listing settings via gcloud config list, and customizing via gcloud config set. It's vital for CI/CD pipelines, scripting, and multi-project management, ensuring reproducible CLI behavior across sessions and users.

Deprecated options like set-value redirect to modern equivalents. Always pair with gcloud auth for credential management.

CAVEATS

User-specific configs; run as sudo affects root user. Requires gcloud initialization. Some props auto-overridden by env vars (e.g., CLOUDSDK_PROJECT).

EXAMPLES

gcloud config set project my-project-id
gcloud config configurations create prod
gcloud config list --format=table(property.value)

CONFIG LOCATIONS

Linux: ~/.config/gcloud/configurations/config_default
Global props in ~/.config/gcloud/configurations/config_default/config_default.

HISTORY

Introduced in 2013 with initial Google Cloud SDK release. Evolved through SDK versions (now CLI v4+), adding multi-config support in 2017 and paths management later.

SEE ALSO

gcloud(1), gcloud init(1), gcloud auth(1)

Copied to clipboard