LoginSignup
231
182

More than 5 years have passed since last update.

よく使うgcloudコマンドたち

Last updated at Posted at 2017-05-10

一般

自分のプロジェクト一覧を表示

gcloud projects list

cloud sdkのプロパティを見る

gcloud config list

プロジェクト切り替え

gcloud config set project <your-project-id>

GCE

インスタンス一覧を見る

gcloud compute instances list

インスタンスの作成(centos-7で)

gcloud compute instances create <your-instance-name> --project <your-project-name> --image-family centos-7

使用可能なimage一覧を見る

gcloud compute images list

インスタンスの起動・停止

gcloud compute instances start <your-instance-name>
gcloud compute instances stop <your-instance-name>

インスタンスにssh

gcloud compute ssh <your-instance-name>

通常のsshコマンドで接続できるように設定

gcloud compute config-ssh
~/.ssh/configに稼働中のインスタンスへの接続設定が作られる。
ssh <your-instance-name>.<zone>.<your-project-id>
ssh [tab]で

インスタンスへローカルのファイルをコピーする

gcloud compute copy-files <local-path> <your-instance-name>:<remote-path> --zone <zone>

インスタンスにあるファイルをローカルにコピーする

gcloud compute copy-files <your-instance-name>:<remote-path> <local-path> --zone <zone>

231
182
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
231
182