Scroll to navigation

ec2metadata.1() ec2metadata.1()

NAME

ec2metadata - Query the AWS IMDS (Instance MetaData Service)

SYNOPSIS

ec2metadata [option]

DESCRIPTION

ec2metadata is used to query the AWS IMDS (Instance MetaData Service). The available data is documented at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html . The command line options the tool accepts are for the most part dynamically generated and therefore will change as more endpoints are added. The static command line options are documented in this man page while the dynamic options are not documented here. The tool will display all information available if no command line options are provided.

OPTIONS

Specify the version of the metadata server API to use.
Print all available command line options to standard out.
List the API versions available for accessing IMDS.
Write the requested information to the given file.
Print the version of the tool.
With version 2 of IMDS a token based access method to IMDS was introduced. This option instructs the query to use the token based access method. The token based access method is also the fall back should an attempt to access IMDS without a token fail.
Specify that the tool should produce XML snippets. Using this option produces information that is wrapped in tags that match the API endpoint option. For example when querying the external IPv4 address of an instance with the --xml flag set the resulting output would be <public-ipv4s>IP_ADDRESS</public-ipv4s>

EXAMPLES

ec2metadata --api latest --xml --instance-type

Will print the instance type of the running instance wrapped in XML tags.

ec2metadata --api 2018-08-17 --hostname

Will print the hostname of the running instance according to the information in IMDS. Note the hostname can be set on the system and a system hostname query with hostname command may return a different result.

AUTHOR

Robert Schweikert (rjschwei@suse.com)