5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Tips】WSLのgcloud initはGUIが使える

Posted at

概要

表題の通り。
Google Cloud Platform 用のCLIアプリgcloudはWSL上のLinuxにインストールできるが、(少なくともUbuntuでは)Windows上のブラウザでアクセスできるURLが表示され、ブラウザから認証ができた。

環境

  • Windows 10 Home 1903
  • Windows Subsytem for Linux
    • Ubuntu 18.04 LTS

実行

入力

export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update
sudo apt install google-cloud-sdk
sudo apt install kubectl google-cloud-sdk-app-engine-python google-cloud-sdk-app-engine-python-extras
gcloud init

出力

gcloud init後、画像の通りCLIでURLが表示される。
image.png
白抜きになっている部分にURLが表示されており、そこにアクセスすることで認証ができる。
image.png
アクセス先でGCPを使いたいGoogleアカウントにログインするとこのような画面が表示されるため、画像では黒塗りになっている部分に表示されているコードをコピーしてCLIの「Enter verification code: 」の後に貼り付ける。
あとはプロジェクトやゾーンの選択をCLI上で行えば設定が完了する。

補足

「入力」にある各種コマンドの意味については公式ドキュメントこちらの記事を参照。

参考文献

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?