gcloudコマンド
$ gcloud -v
Google Cloud SDK 0.9.46
bq 2.0.18
bq-nix 2.0.18
compute 2015.01.22
core 2015.02.05
core-nix 2014.10.20
dns 2015.01.15
gcutil 1.16.5
gcutil-nix 1.16.5
gsutil 4.8
gsutil-nix 4.6
sql 2015.01.31
$ gcloud compute copy-files -h
Usage: gcloud compute copy-files [[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC ...] [[USER@]INSTANCE:]DEST [optional flags]
Copy files to and from Google Compute Engine virtual machines.
optional flags:
--dry-run If provided, prints the command that would be run to
standard out instead of executing it.
--format FORMAT Format for printed output.
--help Display detailed help.
--plain Suppresses the automatic addition of ssh/scp flags.
--project PROJECT_ID Google Cloud Platform project ID to use for this
invocation.
--quiet, -q Disable all interactive prompts.
--ssh-key-file SSH_KEY_FILE
The path to the SSH key file.
--trace-token TRACE_TOKEN
Token used to route traces of service requests for
investigation of issues.
--zone ZONE The zone of the instance to copy files to/from.
-h Print a summary help and exit.
positional arguments:
[[USER@]INSTANCE:]SRC [[[USER@]INSTANCE:]SRC ...]
Specifies a source file.
[[USER@]INSTANCE:]DEST
Specifies a destination for the source files.
GCEからローカルへファイルコピー
gcloud compute --project "プロジェクトID" copy-files --zone "ゾーン名" GCEインスタンス名:ファイルパス ローカルのコピー先パス
ローカルからGCEへファイルコピー
gcloud compute --project "プロジェクトID" copy-files --zone "ゾーン名" ローカルのファイルパス GCEインスタンス名:コピー先パス
Tips
ゾーンを指定しないでコマンド実行した場合、対話式のゾーン選択となります。
For the following instances:
- [GCEインスタンス名]
choose a zone:
[1] asia-east1-a
[2] asia-east1-c
[3] asia-east1-b
[4] europe-west1-d
[5] europe-west1-a (DEPRECATED)
[6] europe-west1-b
[7] europe-west1-c
[8] us-central1-f
[9] us-central1-a
[10] us-central1-c
[11] us-central1-b
Please enter your numeric choice: