LoginSignup
3
3

More than 5 years have passed since last update.

gcloudを使ってインスタンスの構築・削除を行う

Posted at

About

gcloudを触ってみたので、メモとして書いておく。

Environment

$ gcloud -v
Google Cloud SDK 0.9.80

bq 2.0.18
bq-nix 2.0.18
core 2015.09.25
core-nix 2015.09.03
gcloud 2015.09.25
gsutil 4.15
gsutil-nix 4.14

前提

  • gcloud authで認証済み
  • プロジェクトも作成済み

操作する

インスタンスの起動

$ gcloud compute instances create test01 --boot-disk-auto-delete --image centos-7 --maintenance-policy TERMINATE --preemptible --zone asia-east1-a

今回はpreemptibleにしたかったので--preemptible--maintenance-policy TERMINATEをつけている。--zoneの指定をしないと、対話的に聞かれるのでやっておいた方がいい。

便利コマンド

$ gcloud compute images list # 利用できるimageのリスト
$ gcloud compute machine-types list # machine-typeのリスト

インスタンスを停止する

$ gcloud compute instances stop test02 --zone asia-east1-a

これも--zoneの指定をしないと対話的に聞かれるので付けておいたほうが良さそう。

リンク

gcloud compute instances - Cloud SDK — Google Cloud Platform

3
3
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
3
3