Mac用のCloud SDKをダウンロード
Mac OS X 用のクイックスタート | Cloud SDK のドキュメント | Google Cloud Platform
解凍した後、任意のところに配置。
今回は書類フォルダ配下に置いた
/Users/xxxxx/Documents/google-cloud-sdk
パスを通す
vi ~/.bash_profile
PATHを通す
.bash_profileの更新
source ~/.bash_profile
echo $PATHでPATHの確認
PATHの確認
echo $PATH
インストール
カレントフォルダを以下であることを確認
/Users/xxxxx/Documents/google-cloud-sdk
sh install.sh
うまくいけば以下のように表示される。
Welcome to the Google Cloud SDK!
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. You may choose
to opt out of this collection now (by choosing 'N' at the below prompt), or at
any time in the future by running the following command:
gcloud config set disable_usage_reporting true
Do you want to help improve the Google Cloud SDK (Y/n)?
Yがデフォルトで選択されているのでそのままEnterキーを押す
SDK の初期化
コマンド プロンプトで次のコマンドを実行します。
gcloud init
ブラウザ経由でGoogle認証が走ります。
すごい
再度テーミナルにフォーカスが移ります
Compute Engine のデフォルト ゾーンを選択となります。
まずはプロジェクトの選択になります。プロジェクトIDになるので、コンピュートエンジンの画面でプロジェクト名に対するIDを確認します。
Pick cloud project to use:
[1] vast-dock-1231
[2] test1-878a1
[3] vast-dock-181211
[4] Create a new project
Please enter numeric choice or text value (must exactly match list
item):
その後、ゾーンを指定になります。
接続したいサーバーが配置してあるゾーンを選択します。
Which Google Compute Engine zone would you like to use as project
default?
If you do not specify a zone via a command line flag while working
with Compute Engine resources, the default is assumed.