Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

startup script

For this challenge lab I copied and pasted the script into the startup script box and it worked perfectly. I was stuck on this for a while because I was thinking it was looking for a URL and file name to the location of the script. I had copied the script to the bucket I had created and pointed it there. This obviously did not work. I clicked the Learn more link and it says if I put a metadata "startup-script-url" key with the bucket url+filename in the value it would pick it up and run it from the bucket. Didn’t work. What am I missing or am I getting ahead of myself? Thanks.

Khurram Bhatti

I did the same and it did not work for me too. So may be it is not possible, or some other workaround is required to do this.

Jolly

Did your instance have a scope or service account that allowed it to read from the bucket? You could also use the startup-script-url to point to the external http url. The script does not have to be a google storage bucket. This has the advantage of not needing any IAM permissions to reach it. This worked for me.

1 Answers

Hello!  It definitely is possible to pass the script by reference, like this, but you have to be very careful about how you provide the info–and make sure it’s readable, as Jolly noted in a comment.  Check out this link for more info about this.

The simplest test would be to pass the public link to my script in github: https://raw.githubusercontent.com/ACloudGuru/gcp-cloud-engineer/master/compute-labs/worker-startup-script.sh  If you get that working, next try a link to a public GCS object you control.  Then maybe try a private object that is accessible by the service account + scopes that you grant to the instance.

Cheers!

Mattias

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?