Skip to Content
Google Cloud Platform for Developers
book

Google Cloud Platform for Developers

by Ted Hunter, Steven Porter
July 2018
Intermediate to advanced
506 pages
16h 2m
English
Packt Publishing
Content preview from Google Cloud Platform for Developers

Querying metadata from within instances

As mentioned, metadata is made available to running instances through internally resolved API calls to http://metadata.google.internal/computeMetadata/v1/. The API is structured very similarly to a traditional filesystem, where values can be deeply nested.

To perform a query from within a running instance, simply perform an HTTP GET with the required header Metadata-Flavor: Google. The API interprets trailing slashes on resources as directories, causing any nested values for that key to be listed. For example, performing a GET on the base URL http://metadata.google.internal/computeMetadata/v1/ returns the following:

instance/oslogin/project/

This shows that there are three top-level directories that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Google Cloud Platform in Action

Google Cloud Platform in Action

John J. (JJ) Geewax
Google Cloud Platform for Architects

Google Cloud Platform for Architects

Vitthal Srinivasan, Loonycorn Ravi, Judy Raj

Publisher Resources

ISBN: 9781788837675Supplemental Content