LinuxCommandLibrary

gcloud-config-set

Set Google Cloud SDK configuration properties

TLDR

Set the project property in the core section

$ gcloud config set project [project_id]
copy

Set the compute zone for future operations
$ gcloud config set compute/zone [zone_name]
copy

Disable prompting to make gcloud suitable for scripting
$ gcloud config set disable_prompts true
copy

View the list of properties currently in use
$ gcloud config list
copy

Unset a previously set property
$ gcloud config unset [property_name]
copy

Create a new configuration profile
$ gcloud config configurations create [configuration_name]
copy

Switch between different configuration profiles
$ gcloud config configurations activate [configuration_name]
copy

SYNOPSIS

gcloud config set PROPERTY VALUE [--scope=SCOPE] [--installation] [--format=FORMAT] [--help]

PARAMETERS

PROPERTY
    Property name in [SECTION/]KEY format, e.g., project/my-project-id or compute/zone/us-central1-a

VALUE
    Value to assign to the property

--scope=SCOPE
    Scope: user (default, overrides installation) or installation (global)

--installation, -i
    Equivalent to --scope=installation; store in installation scope

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

--help
    Show detailed help

DESCRIPTION

The gcloud config set command updates properties in the Google Cloud CLI configuration, which controls default settings like project ID, compute zone, or authentication paths. Properties follow a [SECTION/]KEY format, such as project/my-project or compute/zone/us-central1-a. Changes apply to the active configuration (view with gcloud config configurations list). By default, values are stored in user scope, overriding installation defaults. Use for quick setup in scripts or interactive sessions.

This enables environment-specific configs without flags on every command, streamlining workflows for Cloud projects. Common uses include setting billing projects, default regions, or metric scopes. Always verify with gcloud config list post-change.

CAVEATS

Changes affect only the active configuration; use gcloud config configurations activate to switch. Installation scope requires admin rights and impacts all users.

EXAMPLES

gcloud config set project my-project-id
gcloud config set compute/zone us-central1-a
gcloud config set --scope=installation metrics/environment prod

SCOPES

user: Per-user, highest precedence.
installation: System-wide, lowest precedence.

HISTORY

Introduced with Google Cloud SDK v0.1 in 2013; evolved with gcloud CLI unification in SDK 130.0.0 (2017) for better config management.

SEE ALSO

gcloud config get(1), gcloud config list(1), gcloud config configurations(1)

Copied to clipboard