GCP/Metadata service

From Ever changing code
< GCP
Revision as of 21:52, 30 January 2023 by Pio2pio (talk | contribs) (→‎Programmatically query metadata)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Programmatically query metadata

# Query the boot image for the VM
curl "http://metadata.google.internal/computeMetadata/v1/instance/image" -H "Metadata-Flavor: Google"

# Query metadata directory listings. Any metadata entry ending in a trailing slash is a directory.
curl "http://metadata.google.internal/computeMetadata/v1/instance/" -H "Metadata-Flavor: Google"
attributes/
cpu-platform
description
disks/
guest-attributes/
hostname
id
image
licenses/
machine-type
maintenance-event
name
network-interfaces/
preempted
remaining-cpu-time
scheduling/
service-accounts/
tags
virtual-clock/
zone