Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

how to use gcloud cli to create instance with a startup script i cant yet find the syntax in stackoverflow

how to use gcloud cli to create instance with a startup script i cant yet find the syntax in stackoverflow

Wdavern

I used this:

Wdavern

gcloud compute instances create challenger3 –image-project=debian-cloud –image-family=debian-10 –scopes=storage-rw –metadata=startup-script-url=gs://billstestbuck2021/startupcli.sh

Wdavern

but it maybe too much permissions

2 Answers

You can use –metadata startup-script-url=URL
There is also –metadata-from-file but I could not get it to work for a file in the gcloud CLI home dir

You need to add the option as mentioned in the doc:
https://cloud.google.com/compute/docs/instances/startup-scripts/linux#passing-local
For example:
–metadata-from-file=startup-script=worker-startup-script.sh

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?