コード
PROJECT=myproject NAME=db01 TYPE=g1-small DISK_SIZE=10GB ZONE=asia-east1-a gcloud compute --project $PROJECT \ instances create $NAME \ --zone $ZONE \ --machine-type $TYPE \ --tags http-server,https-server,trains \ --image-family ubuntu-1604-lts \ --image-project ubuntu-os-cloud \ --boot-disk-size $DISK_SIZE \ --boot-disk-type pd-standard \ --boot-disk-auto-delete \ --boot-disk-device-name $NAME-disk \ --metadata=sshKeys="user:$(cat /Users/thr3a/.ssh/id_rsa.pub)"
その他のオプション
$ ./gcp.sh WARNING: You have selected a disk size of under [200GB]. This may result in poor I/O performance. For more information, see: https://developers.google.com/compute/docs/disks#performance. Created [https://www.googleapis.com/compute/v1/projects/myproject/zones/asia-east1-a/instances/db01]. NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS db01 asia-east1-a g1-small 10.240.0.3 xxxxxxx RUNNING