DEV Community

Noriko Yamamoto
Noriko Yamamoto

Posted on

4

How to switch multiple accounts for GCP gcloud command

If you have two accounts below:


STEP 1. create configuration set for account1

% gcloud config configurations create account1
Created [account1].
Activated [account1].
Enter fullscreen mode Exit fullscreen mode
% gcloud config set project hoge-fuga-123
Updated property [core/project].
Enter fullscreen mode Exit fullscreen mode
% gcloud config set account sample@account1.sample
Updated property [core/account].
Enter fullscreen mode Exit fullscreen mode

STEP 2. create configuration set for account2

% gcloud config configurations create account2
Created [account2].
Activated [account2].
Enter fullscreen mode Exit fullscreen mode
% gcloud config set project hoge-fuga-456
Updated property [core/project].
Enter fullscreen mode Exit fullscreen mode
% gcloud config set account sample@account2.sample
Updated property [core/account].
Enter fullscreen mode Exit fullscreen mode

STEP 3. switch to account1 and check config

% gcloud config configurations activate account1
Activated [account1].
Enter fullscreen mode Exit fullscreen mode
% gcloud config list
[core]
account = sample@account1.sample
disable_usage_reporting = False
project = hoge-fuga-123

Your active configuration is: [account1]
Enter fullscreen mode Exit fullscreen mode

STEP 4. switch to account2 and check config

% gcloud config configurations activate account2
Activated [account2].
Enter fullscreen mode Exit fullscreen mode
% gcloud config list
[core]
account = sample@account2.sample
disable_usage_reporting = False
project = hoge-fuga-456

Your active configuration is: [account2]
Enter fullscreen mode Exit fullscreen mode

GCP original reference page: https://cloud.google.com/sdk/gcloud/reference/config/configurations/

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)