Managing gcloud CLI configurations

A configuration is a named set of Google Cloud CLIproperties. These properties are key-value pairs,organized in sections, that govern the behavior of the gcloud CLI.

Tip: Usually, if you're working with just one project, the default configuration, nameddefault, should be sufficient. To learn more about setting properties in a configuration to define per-product or per-service settings such as the authorization account to use, prompt preferences, and verbosity levels, seeManaging gcloud CLI properties.

Properties that are commonly stored in configurations include defaultCompute Engine zone, verbosity level, usage reporting, project ID, and anactive user or service account. Configurations allow you to define and enablethese and other settings together as a group.

Configurations are stored in your user config directory (typically~/.config/gcloud on MacOS and Linux, or%APPDATA%\gcloud on Windows); youcan find the location of your config directory by runninggcloud info --format='value(config.paths.global_config_dir)'. The configdirectory can be changed by setting the environment variableCLOUDSDK_CONFIG.Also, note that the config directory must be write-enabled. However, if you'reusing Cloud Shell, your gcloud CLI preferences are storedin a temporarytmp folder, set for your current Cloud Shell tabonly, and do not persist across sessions.

If you have multiple configurations, you can choose to switch betweenthem or run commands using a specific configuration (with the helpof the--configuration flag). For more about switching configurations, referto the section below onActivating configurations.

To read about configurations from the command-line (along with a complete listof available properties and the sections they are in), rungcloud topic configurations.

Default configuration

The gcloud CLI starts you off with a single configuration nameddefault. You can set properties in your configuration by running thegcloud init command or by runninggcloud config set directly.

For example, to disable prompting for scripting, run:

gcloud config set disable_prompts true

Multiple configurations

The singledefault configuration is suitable for many use cases. However, youcan alsocreate additional configurationsand switch between them as required usinggcloud config configurations activate.There is nothing special about the initialdefault configuration; it iscreated as a convenience. You can name this and any additional configurationshowever you'd like.

Multiple configurations are useful if you want to:

  • Use multiple projects: You can create a separate configuration foreach project and switch between them as required.
  • Use multiple authorization accounts
  • Perform generally independent tasks: For example, you can use oneconfiguration to work on a App Engine application in one projectand manage an unrelated Compute Engine instances in anotherproject.

Creating a configuration

To create a configuration, rungcloud config configurations create:

gcloudconfigconfigurationscreate[NAME]

You mustactivate the new configurationafter creation in order to use it.

Activating a configuration

Only one of your multiple configurations can be active at a given time. Theactive configuration is the configuration whose properties will govern thebehavior of the gcloud CLI.

To activate a new configuration or switch to a new active configuration, run:gcloud config configurations activate:

gcloudconfigconfigurationsactivate[NAME]

gcloud config list will always show youthe properties in your active configuration.

To change the active configuration for a single command invocation, you can usethe--configuration flag on any gcloud CLI command:

gcloudauthlist--configuration=[CONFIGURATION_NAME]

To change the active configuration for all commands in your current terminal,you can set the environment variableCLOUDSDK_ACTIVE_CONFIG_NAME to the nameof the configuration you'd like to use.

Automating configuration switching

To help make changing configurations seamless, you can leverage tools such asdirenv andondir to automatically switchbetween configurations when you switch working directories. One way toaccomplish this is to set the necessary environment variables (likeCLOUDSDK_ACTIVE_CONFIG_NAME) in the .envrc file in the root directory of your project.

Listing configurations

To list the configurations in your gcloud CLI installation, rungcloud config configurations list:

gcloud config configurations list

The gcloud CLI lists the configurations and shows whichconfiguration is active:

NAME         IS_ACTIVE     ACCOUNT            PROJECT               DEFAULT_ZONE  DEFAULT_REGIONdefault      False         user@gmail.com     example-project-1     us-east1-b    us-east1project-1    False         user@gmail.com     example-project-2     us-east1-c    us-east1project-2    True          user@gmail.com     example-project-3     us-east1-b    us-east1

Setting configuration properties

To set and unset the properties in the active configuration, rungcloud config set andgcloud config unset:

gcloudconfigsetproject[PROJECT]gcloudconfigunsetproject

Properties can also be set via environment variables namedCLOUDSDK_SECTION_NAME_PROPERTY_NAME. For example, you can set thecore/project andcompute/zone properties as follows:

CLOUDSDK_CORE_PROJECT=[YOUR_PROJECT_NAME]CLOUDSDK_COMPUTE_ZONE=[YOUR_ZONE_NAME]

Viewing configuration properties

To view the properties in a configuration, run:gcloud config configurations describe:

gcloudconfigconfigurationsdescribe[NAME]

Or, to view properties in the active configuration:

gcloud config list

The gcloud CLI prints the configuration properties:

is_active: falsename: defaultproperties:  compute:    region: us-east1    zone: us-east1-b  core:    account: user@google.com    project: example-project

Deleting a configuration

To delete a configuration, run:gcloud config configurations delete:

gcloudconfigconfigurationsdelete[NAME]

You can't delete the active configuration. Usegcloud config configurations activate if required to switch to anotherconfiguration before deleting.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.