How To Use Multiple gcloud Configuration From a Single Workstation

multiple gcloud configuration

Sometimes you might work with different google cloud accounts and want to have all the gcloud configuration on a single workstation.

In this post I will explain how to configure multiple gcloud configuration on a single workstation.

All the gcloud configs are present in  ~/.config/gcloud/configurations folder

The configs present in the configurations folder would look like the following.

config_default       config_devopscube

As you can see, all the configurations start with the config_ keyword.

Follow the steps given below for the configuration

1. cd in to the config directory.


2. Create a new configuration file with config_ prefix

vi config_demo-account

3. Enter the required parameters in the config file and save it. An example is shown below. You should change the values according to your google cloud account, project, zone and region.

account = [email protected]
project = devopscube

zone = asia-east1-b	
region = asia-east1

4. For using any new configuration, you need to activate it. Use the following command to activate the configuration you created. You just need to specify the suffix of the configuration name as shown below.

gcloud config configurations activate demo-account

5. Once activated, login to the google cloud account using the following command.

gcloud auth login

6. Once logged in, you will be able to make all the gcloud api calls for the new configuration.

Like this you can maintain multiple gcloud configuration and use it when ever you need it.

Hope this article helps!



1 comment
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like