Difference between revisions of "GCP/Metadata service"
< GCP
Jump to navigation
Jump to search
(Created page with "=[https://cloud.google.com/compute/docs/metadata/querying-metadata Programmatically query metadata]= <source lang=bash> # 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/disks/0/" -H "Metadata-Flavor: Google" device-name in...") |
|||
Line 5: | Line 5: | ||
# Query metadata directory listings. Any metadata entry ending in a trailing slash is a directory. | # Query metadata directory listings. Any metadata entry ending in a trailing slash is a directory. | ||
curl "http://metadata.google.internal/computeMetadata/v1/instance | 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 | |||
</source> | </source> |
Latest revision as of 22:52, 30 January 2023
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