This article is written for Windows, but the same principles apply to Linux and Mac.

I need to work with multiple Google Cloud accounts and be able to easily switch my credentials between accounts. For those of you with AWS backgrounds, think profiles.

A gcloud configuration is a set of properties that govern the behavior of gcloud and other Google Cloud SDK tools. When you first install gcloud on your desktop a configuration named default is created.

A gcloud configuration is managed by gcloud config configurations. To see the list of configurations on your system:

gcloud config configurations list

This will output a list of configurations present on your system:

default   True        default-123456      us-west1-a    us-west1
dev       False        development-123456  us-east4-c    us-east4
prod      False        production-123456   us-east4-c    us-east4

The creation of a configuration can be accomplished with gcloud or manually.

Command line Method #1:

Using the gcloud CLI, create an new configuration. This configuration will be empty. In this case I am creating a configuration named dev.

gcloud config configurations create dev

Now that we have a new configuration created, we need to activate it.

gcloud config configurations activate dev

Set the account. The account is the email address that Google Cloud IAM created for you or that you authorized in Google Cloud IAM. This account is either a Google Account email address or a Google Service Account email address.

gcloud config set core/account

The next step is to authorize the dev configuration.

gcloud auth login

There are additional optional items that you can set in the new configuration such as default project, region and zone. Review the manual method below to see more options.

Command line Method #2

You can also use gcloud init to create a new configuration.

gcloud init

This will prompt you with / for the following information:

Welcome! This command will take you through the configuration of gcloud.

Settings from your current configuration [dev] are:
  region: us-east4
  zone: us-east4-c
  disable_usage_reporting: 'False'
  project: development-123456

Pick configuration to use:
 [1] Re-initialize this configuration [dev] with new settings
 [2] Create a new configuration
 [3] Switch to and re-initialize existing configuration: [default]
 [4] Switch to and re-initialize existing configuration: [test]
Please enter your numeric choice:  2

Enter configuration name. Names start with a lower case letter and
contain only lower case letters a-z, digits 0-9, and hyphens '-':  prod
Your current configuration has been set to: [prod]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic (1/1 checks) passed.

Choose the account you would like to use to perform operations for
this configuration:
 [3] Log in with a new account
Please enter your numeric choice:  3

Your browser has been opened to visit:

You are logged in as: [].

Pick cloud project to use:
 [1] development-123456
 [2] test-123456
 [3] Create a new project
Please enter numeric choice or text value (must exactly match list
item):  1

Your current project has been set to: [development-123456].

Your project default Compute Engine zone has been set to [us-west1-a].
You can change it by running [gcloud config set compute/zone NAME].

Your project default Compute Engine region has been set to [us-west1].
You can change it by running [gcloud config set compute/region NAME].

Created a default .boto configuration file at [C:\Users\username\.boto]. See this file and
[] for more
information about configuring Google Cloud Storage.
Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use by default
* Commands will reference project `development-123456` by default
* Compute Engine commands will use region `us-west1` by default
* Compute Engine commands will use zone `us-west1-a` by default

Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [prod]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic -h` to learn about advanced features of the SDK like arg files and output formatting
Manual Method:

For the manual method, the first step is to setup gcloud with a default account. Then go to the directory where configurations are stored and create new ones. The configurations are stored in the following directory. Replace username with your Windows user name.


For Linux:


List the contents of this directory. Each configuration starts with config_.

10/14/2018  12:33 PM               139 config_default

To create a new configuration named dev, copy config_default to config_dev.

copy config_default config_dev

Now using your favorite editor, modify the file. My config_default looks like this.

account =
project = development-123456
disable_color = True

zone = us-east4-c
region = us-east4

The important item to modify is account = This user ID will be used for authentication.

The minimum configuration looks like this:

account =

Now that we have a new configuration created, we need to activate it.

gcloud config configurations activate dev

The active configuration is stored in this file.


The next step is to authorize the dev configuration.

gcloud auth login

We now have two configurations, default and dev. To switch back to the default configuration.

gcloud auth login creates the default configuration if it does not exist.

gcloud config configurations activate default

Most gcloud commands accept the command line option --configuration=CONFIGURATION_NAME. For example:

gcloud compute instances list --configuration=dev

gcloud also supports the environment variable CLOUDSDK_ACTIVE_CONFIG_NAME.


To list the Google accounts that have been authorized:

gcloud auth list

This will display a list like this:

     Credentialed Accounts

To set the active account, run:
    $ gcloud config set account `ACCOUNT`

The active account is the one with the ‘*’ in the left column.

To set the project for the current configuration:

gcloud config set project development-123456

To set the region for the current configuration:

gcloud config set compute/region us-east4

To set the zone for the current configuration:

gcloud config set compute/zone us-east4-c


Reference documentation:

Managing SDK Configurations

gcloud config configurations

gcloud auth login

gcloud auth activate-service-account

gcloud config set

Authorizing Cloud SDK Tools