GCEMETADATA(1)

πŸ“¦ version 1.1.2, in opensuse-leap 16.0

πŸ›°οΈ gcemetadata.1() β€” Query the Google Compute Engine Metadata Server πŸ’…

✨ NAME ✨

gcemetadata β€” query the Google Compute Engine metadata server. Lowkey a tiny icon, no cap. 🫢

🌸 SYNOPSIS 🌸

gcemetadata [option]

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay bestie, so gcemetadata is the little command that queries the Google Compute Engine metadata server. The available data is documented at https://cloud.google.com/compute/docs/storing-retrieving-metadata β€” go peek, iykyk. ✨

The command-line options this tool accepts are for the most part dynamically generated, so they literally change as more endpoints get added. The static command-line options are documented in this man page; the dynamic options are not documented here.

If you don’t specify any command-line options other than --output or --xml, the tool will display all information available. If you give any specific option, you must use the --query option as well. And if a specific query doesn’t produce any value, or the query results in an error, the data for the requested option will be set to unavailable. πŸŽ€


πŸŽ€ OPTIONS πŸŽ€

  • -a, --api β€” specify the version of the metadata server API to use. 🌈
  • --help β€” print all available command-line options to standard out. πŸ‘‘
  • --identity-format β€” set the format for the identity token. Supported values are full or standard. This changes how much information is encoded in the identity token. The default value is standard, which provides the smallest possible amount of information. 🧚
  • --listapis β€” list the available api versions. 🌸
  • --output β€” write the requested information to the given file. πŸ“
  • --query β€” specify whether to query the project or the instance; possible values are project or instance. If any option other than --output or --xml is specified, the --query option is required. πŸ’–
  • --version β€” print the version of the tool. ⭐
  • --xml β€” tell the tool to produce XML snippets. Using this option produces information wrapped in tags that match the API endpoint option. For example, when querying the name of an instance with the --xml flag set, the resulting output would be <name>my_instance_name</name>. πŸ”₯

πŸ“ EXAMPLES πŸ“

gcemetadata --query project --project-id

Will print the name of the project the instance is running in. Slay. πŸ’…

gcemetadata --query instance --netid 0 --external-ip

Will print the external IPv4 address of the instance. ✨


πŸ’€ CAVEAT πŸ’€

Okay so here’s the caveat, bestie: when you’re requesting all possible information β€” i.e. no argument, or only --output and/or --xml are given β€” the identity information in the resulting output will be shown as unavailable. The reason is that a valid identifier for the identity token generation is not known, and thus no valid token can be generated. No cap, that part matters. 😭

πŸ‘‘ AUTHOR πŸ‘‘

Robert Schweikert (rjschwei@suse.com) 🫢


πŸ’– bye bestie β€” this was gcemetadata.1(), and the footer has no extra source/version/date info beyond that manual-page name. Slay. 🫢✨

πŸ“¦ where this page comes from