Google Cloud SDKのインストール ~ 初期化


環境

  • MacOS X 10.14.5 (Mojave)
  • Homebrew 2.2.5

Google Cloud SDKのインストール

$ brew cask install google-cloud-sdk

https://cloud.google.com/sdk/docs/downloads-interactive?hl=ja#mac

パスを通す

brew infoしてみる

$ brew info google-cloud-sdk

・
・
・
google-cloud-sdk is installed at /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk. Add your profile:

  for bash users
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc'
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc'

  for zsh users
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
    source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'

bashの場合は.bashrcに以下の2行を追記

source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc'
source '/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc' 

シェル再起動

$ exec $SHELL -l

Cloud SDK の初期化

$ gcloud init

対話形式で設定していく

https://cloud.google.com/sdk/docs/initializing?hl=ja



googleアカウントへログインするか聞かれます。 -> ログイン

To continue, you must log in. Would you like to log in (Y/n)? 



プロジェクトが複数ある場合は数字で選択します。

Pick cloud project to use:
 [1] [my-project-1]
 [2] [my-project-2]
 ...
 Please enter your numeric choice:



こんなメッセージがでて初期化完了

Your current project has been set to: [testtheid].

Not setting default zone/region (this feature makes it easier to use
[gcloud compute] by setting an appropriate default value for the
--zone and --region flag).
See https://cloud.google.com/compute/docs/gcloud-compute section on how to set
default compute region and zone manually. If you would like [gcloud init] to be
able to do this for you the next time you run it, make sure the
Compute Engine API is enabled for your project on the
https://console.developers.google.com/apis page.

Your Google Cloud SDK is configured and ready to use!

* Commands that require authentication will use [email protected] by default
* Commands will reference project `testtheid` by default
Run `gcloud help config` to learn how to change individual settings

This gcloud configuration is called [default]. You can create additional configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.

Some things to try next:

* Run `gcloud --help` to see the Cloud Platform services you can interact with. And run `gcloud help COMMAND` to get help on any gcloud command.
* Run `gcloud topic --help` to learn about advanced features of the SDK like arg files and output formatting

もしよろしければ

Google Cloud SDKのコマンドメモ