EC2-METADATA(8) | System Manager's Manual | EC2-METADATA(8) |
ec2-metadata - Retrieve instance metadata from within a running EC2 instance
ec2-metadata [options]
The ec2-metadata program is a utility to retrieve EC2 instance metadata from within a running EC2 instance.
Instance metadata is data about your instance that you can use to configure or manage the running instance. Instance metadata is divided into categories, for example, host name, events, and security groups.
You can also use instance metadata to access user data that you specified when launching your instance. For example, you can specify parameters for configuring your instance, or include a simple script. You can build generic AMIs and use user data to modify the configuration files supplied at launch time. For example, if you run web servers for various small businesses, they can all use the same generic AMI and retrieve their content from the Amazon S3 bucket that you specify in the user data at launch. To add a new customer at any time, create a bucket for the customer, add their content, and launch your AMI with the unique bucket name provided to your code in the user data. If you launch more than one instance at the same time, the user data is available to all instances in that reservation. Each instance that is part of the same reservation has a unique ami-launch-index number, allowing you to write code that controls what to do. For example, the first host might elect itself as an initial master node in a cluster.
ec2-metadata will print all known metadata fields by default. The following options can be used to restrict the output to the selected fields.
May 4 2020 |