Instance environment variables

后端 未结 1 1973
情深已故
情深已故 2021-02-07 08:41

I have several Google Compute Engine instances, and have set instance metadata on each, under the assumption these are available on the instance itself as an environment variabl

1条回答
  •  别那么骄傲
    2021-02-07 09:44

    It may be worth studying Metadata querying a bit more, but my guess is that you are attempting to get custom metadata, which is resulting in it not being found. Make sure you are using the attributes directory to access any custom metadata.

    For example, this will get the built-in tags metadata:

    curl "http://metadata.google.internal/computeMetadata/v1/instance/tags" \
        -H "Metadata-Flavor: Google"
    

    while this will get your custom metadata for attribute foo:

    curl "http://metadata.google.internal/computeMetadata/v1//attributes/foo" \
        -H "Metadata-Flavor: Google"
    

    0 讨论(0)
提交回复
热议问题