Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Startup script reading metadata set at GCE level do not seem to work…

Hello, 

it took me a while  to get this lab working through the console. I fix my issue just by setting the metadata "lab-logs-bucket" directly at the VM level when creating it rather than at the GCE service level.

But the documentation says for the metadata set at the GCE service level "All instances in this project inherit these key-value pairs".

Are any special permissions required ? But it shouldn’t because it says the VM inherit these metadata…

Or is the URL to access these metadata different than "http://metadata.google.internal/computeMetadata/v1/instance/attributes/" ?

I don’t understand what I did wrong.

Thank you in advance

1 Answers

This is an interesting question. When you’re using project-wide metadata, things are slightly different. 

Following Mattias, let’s break this down, and look at the elements of the situation:

When you’re using the URL http://metadata.google.internal/computeMetadata/v1/instance/attributes/lab-logs-bucket, you can break that path down into a logical sentence, like "I need the lab-logs-bucket attribute from the list of attributes from this instance in v1 of the computeMetadata". When we set the metadata for an instance, this path works. But not when we use the project-wide metadata. If the information is not populating automatically, do we need to use a different URL?

Check out Google’s Storing and retrieving instance metadata for the full information, and the final answer

I know this isn’t the direct answer, but hope this helps you find the answer is just within your grasp

Matthieu Lienart

Thank you Stephen, I have to confessed I had overlooked that article. When they say "Project metadata propagates to all virtual machine (VM) instances within the project", I just assumed project level metadata where accessible through "/instance/" as well.

[ACG] Stephen Sennett

That’s the trick; I’d thought the same too initially until I read that article. Interesting stuff!

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?