|
|
|
|
|
by asamarin
3705 days ago
|
|
Yes, of course they're correct; however, invoking gcloud is comparatively much slower than just curl'ing against the metadata server (you know, no Python code to interpret in the latter case). With regards to JSON, not sure what you mean, since getting e.g. instance zone from metadata server gives you a plain text string like "projects/<PROJECT_NUMBER>/zones/europe-west1-d". AFAIK, the only way to get JSON-like results is by making recursive requests, such as: $ curl -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/?recursive=true"
And even in that case, you can choose plain text format by appending "alt=text" as query string parameter: $ curl -H 'Metadata-Flavor: Google' "http://metadata/computeMetadata/v1/instance/?recursive=true&alt=text"
|
|