Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EC2 Metadata of instance
Options:
--all Show all metadata information for this host (also default).
-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.
-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
-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.
root@ip-172-31-17-16:~# uname -a
Linux ip-172-31-17-16 4.4.0-1048-aws #57-Ubuntu SMP Tue Jan 9 21:45:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@ip-172-31-17-16:~# ec2metadata
ami-id: ami-e6245b9a
ami-launch-index: 0
ami-manifest-path: (unknown)
ancestor-ami-ids: unavailable
availability-zone: ap-southeast-1a
block-device-mapping: ami
root
instance-action: none
instance-id: i-06f869c066c
instance-type: t2.medium
local-hostname: ip-172-31-17-16.ap-southeast-1.compute.internal
local-ipv4: 172.31.17.16
kernel-id: unavailable
mac: unavailable
profile: default-hvm
product-codes: unavailable
public-hostname: ec2-52-221-219-4.ap-southeast-1.compute.amazonaws.com
public-ipv4: 52.221.219.4
public-keys: unavailable
ramdisk-id: unavailable
reserveration-id: unavailable
security-groups: launch-wizard-18
user-data: unavailable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.