[GCE] gcutilをインストール
Compute Engineのインスタンスを操作するために gcutil というものを入れる。
Google Cloud SDKのインストールで gcloud というコマンドが使えるようになったが、 gcloud はGoogle Cloud Platform全体管理ツールで、Google Cloud Platformの各サービス(App Engine, Compute Engineとか)のAPIを操作すにはCloud Platform Tools(gcloudとか)を入れる必要があるらしい。
今インストールされているCloud Platform Toolsの一覧は gcloud コマンドで確認できる。
こんな感じで出力される。
Compute Engineを使うなら gcutil をインストールする。
必要なものダウンロードしてインストールしてくれる。
これでインスタンスを操作するための gcutil というコマンドが使えるようになる。インスタンスの一覧を確認するには listinstances オプションを使う。
こんな感じで一覧が表示されたらOK。
zsh を使ってる場合は gcutil をインストールしてもそのままではコマンド補完のリストに出てこないので gcloud で gcutil をインストールしたあとに rehash を叩くとよい。
【まとめ】
Google Cloud PlatformのCompute Engine使ってみた
Google Cloud SDKのインストールで gcloud というコマンドが使えるようになったが、 gcloud はGoogle Cloud Platform全体管理ツールで、Google Cloud Platformの各サービス(App Engine, Compute Engineとか)のAPIを操作すにはCloud Platform Tools(gcloudとか)を入れる必要があるらしい。
今インストールされているCloud Platform Toolsの一覧は gcloud コマンドで確認できる。
gcloud components list
こんな感じで出力される。
The following are the components available through the Google Cloud
SDK. You may choose to install one or more of the pre-configured
packages (which contain everything you need to get started), and/or
any of the individual components below.
-------------------------------------------------------------------------------
| Packages |
|-----------------------------------------------------------------------------|
| Status | Name | ID | Size |
|---------------+-----------------------------------------+------------+------|
| Not Installed | Cloud SDK Core Command Line Tools | pkg-core | |
| Not Installed | Cloud SDK for Go Developers | pkg-go | |
| Not Installed | Cloud SDK for Java Developers | pkg-java | |
| Not Installed | Cloud SDK for Python and PHP Developers | pkg-python | |
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
| Individual Components |
|-----------------------------------------------------------------------------------------|
| Status | Name | ID | Size |
|---------------+----------------------------------------+---------------------+----------|
| Not Installed | App Engine SDK for Go (Linux, x86_64) | gae-go-linux-x86_64 | 31.9 MB |
| Not Installed | App Engine SDK for Java | gae-java | 146.5 MB |
| Not Installed | App Engine SDK for Python and PHP | gae-python | 35.9 MB |
| Not Installed | Big Query Command Line Tool | bq | < 1 MB |
| Not Installed | Cloud DNS Admin Command Line Interface | dns | < 1 MB |
| Not Installed | Cloud SQL Admin Command Line Interface | sql | < 1 MB |
| Not Installed | Cloud Storage Command Line Tool | gsutil | 1.8 MB |
| Not Installed | Commands That Are In Developer Preview | preview | < 1 MB |
| Not Installed | Compute Engine Command Line Tool | gcutil | < 1 MB |
| Installed | Cloud SDK Core Libraries | core | < 1 MB |
-------------------------------------------------------------------------------------------
To install new components or update existing ones, run:
$ gcloud components update [component ids]
Compute Engineを使うなら gcutil をインストールする。
gcloud components update gcutil
必要なものダウンロードしてインストールしてくれる。
The following components will be installed:
--------------------------------------------------------------------------
| Compute Engine Command Line Tool | 1.15.0 | < 1 MB |
| Compute Engine Command Line Tool (Platform Specific) | 1.13.0 | < 1 MB |
--------------------------------------------------------------------------
Do you want to continue (Y/n)?
Creating update staging area...
Installing: Compute Engine Command Line Tool ... Done
Installing: Compute Engine Command Line Tool (Platform Specific) ... Done
Creating backup and activating new installation...
Done!
これでインスタンスを操作するための gcutil というコマンドが使えるようになる。インスタンスの一覧を確認するには listinstances オプションを使う。
gcutil listinstances
こんな感じで一覧が表示されたらOK。
+-----------------+---------------+---------+----------------+-----------------+
| name | zone | status | network-ip | external-ip |
+-----------------+---------------+---------+----------------+-----------------+
| tegetege-demo01 | us-central1-a | RUNNING | 10.240.169.147 | xxx.xxx.xxx.xxx |
+-----------------+---------------+---------+----------------+-----------------+
zsh を使ってる場合は gcutil をインストールしてもそのままではコマンド補完のリストに出てこないので gcloud で gcutil をインストールしたあとに rehash を叩くとよい。
【まとめ】
Google Cloud PlatformのCompute Engine使ってみた