Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

What is being missed in this command for GCE and GCS lab?

When i do this via console it works but when i run this via shell, its not working. The command i am using is gcloud compute instances create anandvm1 –machine-type=f1-micro –zone=us-west2-b –scopes=storage-rw –metadata-from-file=FILE=/home/anandppatil431983/worker-startup-script.sh –metadata=lab-logs-bucket=gs://anandlabnew/

1 Answers

Per documentation, it should be --metadata-from-file=startup-script, but you have --metadata-from-file=FILE. Additionally, documentation states that the path to the script should be relative, which in your case should be worker-startup-script.sh. You provided an absolute path of /home/anandppatil431983/worker-startup-script.sh.

This is what worked for me:

gcloud compute instances create lab-instance --machine-type=f1-micro --metadata=lab-logs-bucket=gs://lab-bucket-challenge-accepted --metadata-from-file startup-script=worker-startup-script.sh --scopes storage-rw

Note: I set the region and zone beforehand by running gcloud config set compute/region us-west and gcloud config set compute/zone us-west2-b.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?