忘れないようにメモ。
例えば、before-selmertsx
プロジェクトから、test-selmertsx
プロジェクトへと切り替えるとする。
そのときの手順は下記の通り
configurationsの作成
gcloud config configurations create test-selmertsx gcloud config configurations activate test-selmertsx
プロジェクトの設定をする
下記コマンドでリージョンやアカウントの設定をします。
gcloud config set compute/region asia-northeast1 gcloud config set compute/zone asia-northeast1-a gcloud config set core/account selmertsx@gmail.com gcloud config set core/project test-selmertsx
そして gcloud config list
で設定確認。
$ gcloud config list [compute] region = asia-northeast1 zone = asia-northeast1-a [core] account = selmertsx@gmail.com disable_usage_reporting = True project = test-selmertsx Your active configuration is: [test-selmertsx]
プロジェクトを有効にする
gcloud auth login
を実行するとブラウザが立ち上がって認証する。それで終了。
$ gcloud config configurations list NAME IS_ACTIVE ACCOUNT PROJECT DEFAULT_ZONE DEFAULT_REGION before-selmertsx True selmertsx@gmail.com before-selmertsx asia-northeast1-a test-selmertsx False selmertsx@gmail.com test-selmertsx asia-northeast1-a asia-northeast1
元のプロジェクトに戻す
$ gcloud config configurations activate before-project Activated [before-project].