GCP/Metadata service

From Ever changing code
< GCP
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