I have a basic SH script that I use to create multiple VMs on GCP, and it works fine, but sequentially. When a number of VMs is say above 4 or 5, it becomes a material delay of time. I noticed that in platforms like Dataflow or Dataproc, an arbitrary number of VMs gets created virtually simultaneously. Is there a way to mimic that functionality in GCE? (after all, these seem to be basic GCE machines anyway).
Right now I use the following (simplified) script:
vms=4
for i in `seq 1 $vms`
do
gcloud compute --project PROJECT disks create VM"$i" --size 50 --zone ZONE --type "pd-ssd"
gcloud beta compute --project=PROJECT instances create VM"$i" --zone=ZONE --machine-type=MACHINE_TYPE --subnet=default --maintenance-policy=MIGRATE --scopes=https://www.googleapis.com/auth/cloud-platform --disk=name=VM"$i",device-name=VM"$i",mode=rw,boot=yes,auto-delete=yes
done
Thanks for any suggestions!