How To Use Multiple gcloud Configuration From a Single Workstation

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.

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

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.

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.

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

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.

READ  How to Add Persistent Volume to Pods in Google Kubernetes Engine

Hope this article helps!



Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.