EC2-METADATA(8)
β¨ EC2-METADATA(8) β¨
okay so bestie, welcome to the System Manager's Manual page for ec2-metadata β yes that's the section 8 one, the big-girl sysadmin section, and honestly? iconic. π
πΈ NAME πΈ
ec2-metadata β retrieve instance metadata from inside a running EC2 instance. no cap, it just reaches out and grabs the tea about the box you're literally sitting on. π
π¦ SYNOPSIS π¦
ec2-metadata [options]
β¨ DESCRIPTION β¨
The ec2-metadata program is a utility to retrieve EC2 instance metadata from within a running EC2 instance. π«Ά
So what even is instance metadata? It's data about your instance that you can use to configure or manage the running instance, and it's split up into categories β think host name, events, security groups, all that. π
You can also use instance metadata to access user data that you specified when launching your instance. Like, you can specify parameters for configuring your instance, or just yeet a whole simple script in there. The whole point? You can build generic AMIs and then use user data to modify the configuration files supplied at launch time. π
for example β say you run web servers for various small businesses. They can all use the same generic AMI and just retrieve their content from the Amazon S3 bucket that you specify in the user data at launch. Adding a new customer at any time is literally just: 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. slay. π§
And here's the part everyone forgets: 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's part of the same reservation has a unique ami-launch-index number, which lets you write code that controls what to do. For example, the first host might elect itself as an initial master node in a cluster. main character energy, honestly π
π OPTIONS π
so here's the vibe β ec2-metadata will print all known metadata fields by default. The following options can be used to restrict the output to the selected fields. π
--allβ Show all metadata information for this host (also default). yes bestie, it's the default and an option, it contains multitudes β¨-a,--ami-idβ The AMI ID used to launch this instance π-l,--ami-launch-indexβ The index of this instance in the reservation (per AMI). π¦-m,--ami-manifest-pathβ The manifest path of the AMI with which the instance was launched. πΈ-n,--ancestor-ami-idsβ The AMI IDs of any instances that were rebundled to create this AMI. it's giving lineage π-b,--block-device-mappingβ Defines native device names to use when exposing virtual devices. π-i,--instance-idβ The ID of this instance π«Ά-t,--instance-typeβ The type of instance to launch. For more information, see Instance Types. π-h,--local-hostnameβ The local hostname of the instance. π-o,--local-ipv4β Public IP address if launched with direct addressing; private IP address if launched with public addressing. π-k,--kernel-idβ The ID of the kernel launched with this instance, if applicable. β-z,--availability-zoneβ The availability zone in which the instance launched. Same as placement. π-R,--regionβ The region in which the instance launched. πΊοΈ-c,--product-codesβ Product codes associated with this instance. π-p,--public-hostnameβ The public hostname of the instance. π-v,--public-ipv4β NATted public IP Address π-u,--public-keysβ Public keys. Only available if supplied at instance launch time. π-r,--ramdisk-idβ The ID of the RAM disk launched with this instance, if applicable. π§-e,--reservation-idβ ID of the reservation. ποΈ-s,--security-groupsβ Names of the security groups the instance is launched in. Only available if supplied at instance launch time. π‘οΈ-d,--user-dataβ User-supplied data. Only available if supplied at instance launch time. π-t,--tagsβ Print EC2 resource tags if permitted in EC2 Instance Metadata Options. π·οΈ--quietβ Don't print metadata keys. π€«-h,--helpβ Show summary of options. π
ngl bestie, you may have clocked that-tand-heach show up twice in that list. that's exactly how the page reads β not a typo on my end, and definitely not me being messy. i'm just the messenger. πβ¨
π₯ SEE ALSO π₯
- Instance metadata and user data β
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.htmlπ - EC2 Instance Metadata Query Tool β
https://aws.amazon.com/code/ec2-instance-metadata-query-tool/π οΈ - Work with instance tags in instance metadata β
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#work-with-tags-in-IMDSπ·οΈ
and that's the whole page, periodt. this one landed in the world on May 4 2020 β the System Manager's Manual edition, EC2-METADATA(8) and all. go forth and fetch your metadata, bestie. you got this π«Άβ¨π
π¦ where this page comes from
- epel 9: amazon-ec2-utils 2.2.0-2.el9 Β· MIT AND CC-BY-SA-4.0
- fedora 43: amazon-ec2-utils 2.2.0-7.fc43 Β· MIT AND CC-BY-SA-4.0
- fedora 44: amazon-ec2-utils 2.2.0-9.fc44 Β· MIT AND CC-BY-SA-4.0
- nixpkgs unstable: amazon-ec2-utils 2.2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms