Skip to content

adampblack/aws-instance-meta-data-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

AWS instance meta data service

Reference: AWS User Guide - Instance data retrieval

Contents:


Versions

According to the AWS documentation, "the earlier versions are available to you in case you have scripts that rely on the structure and information present in a previous version."

curl http://169.254.169.254/
1.0
2007-01-19
2007-03-01
2007-08-29
2007-10-10
2007-12-15
2008-02-01
2008-09-01
2009-04-04
2011-01-01
2011-05-01
2012-01-12
2014-02-25
2014-11-05
2015-10-20
2016-04-19
2016-06-30
2016-09-02
2018-03-28
2018-08-17
2018-09-24
2019-10-01
2020-10-27
2021-01-03

The way that this would be used.

For the latest:

curl http://169.254.169.254/latest/meta-data/

For a specific version (e.g. 2021-01-03):

curl http://169.254.169.254/2021-01-03/meta-data/

[Back to top]


Options

Using latest version:

curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
events/
hostname
iam/
identity-credentials/
instance-action
instance-id
instance-life-cycle
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups

[Back to top]


Amazon machine image (AMI) ID

curl http://169.254.169.254/latest/meta-data/ami-id
ami-07f990e4e7551b774

[Back to top]


Amazon machine image (AMI) launch index value

When running up new instances (aws ec2 run-instances) and running up multiple instances of the same AMI (using the count option).

Each instance will be launched with a unique index started from a zero-index (0) and incrementing by 1 for each additional instance.

Reference: AWS User Guide - Amazon Launch Index

curl http://169.254.169.254/latest/meta-data/ami-launch-index
0

[Back to top]


Amazon manifest path

curl http://169.254.169.254/latest/meta-data/ami-manifest-path
(unknown)

[Back to top]


Block device mapping

curl http://169.254.169.254/latest/meta-data/block-device-mapping/
ami

One level deeper:

curl http://169.254.169.254/latest/meta-data/block-device-mapping/ami
xvda(python3)

[Back to top]


Events

curl http://169.254.169.254/latest/meta-data/events/
maintenance/(python3)

One level deeper:

curl http://169.254.169.254/latest/meta-data/events/maintenance
history

One level deeper:

curl http://169.254.169.254/latest/meta-data/events/maintenance/history
[](python3)

[Back to top]


Hostname

curl http://169.254.169.254/latest/meta-data/hostname
ip-123-45-67-89.us-east-1.compute.internal(python3)

[Back to top]


IAM

curl http://169.254.169.254/latest/meta-data/iam
security-credentials/(python3)

One level deeper:

curl http://169.254.169.254/latest/meta-data/iam/security-credentials
example_iam_role(python3)

[Back to top]


Instance action

curl http://169.254.169.254/latest/meta-data/instance-action
none(python3)

[Back to top]


Instance ID

curl http://169.254.169.254/latest/meta-data/instance-id
i-1234d5bf6f789b123(python3)

Instance life cycle

curl http://169.254.169.254/latest/meta-data/instance-life-cycle
on-demand(python3)

[Back to top]


Instance type

curl http://169.254.169.254/latest/meta-data/instance-type
t3.micro(python3)

[Back to top]


Local hostname

curl http://169.254.169.254/latest/meta-data/local-hostname
ip-172-12-34-56.us-east-1.compute.internal(python3)

[Back to top]


Local IP4

curl http://169.254.169.254/latest/meta-data/local-ipv4
172.12.34.56(python3)

[Back to top]


MAC address

curl http://169.254.169.254/latest/meta-data/mac
12:3a:c4:a5:c6:d7(python3)

[Back to top]


Metrics

curl http://169.254.169.254/latest/meta-data/metrics/
vhostmd(python3)

One level deeper:

curl http://169.254.169.254/latest/meta-data/metrics/vhostmd
<?xml version="1.0" encoding="UTF-8"?>(python3) 

[Back to top]


Network

curl http://169.254.169.254/latest/meta-data/network/
interfaces/(python3)

One level deeper:

curl http://169.254.169.254/latest/meta-data/network/interfaces
macs/(python3)

One level deeper:

curl http://169.254.169.254/latest/meta-data/network/interfaces/macs
12:3a:c4:a5:c6:d7(python3)

[Back to top]


Placement

curl http://169.254.169.254/latest/meta-data/placement/
availability-zone
region(python3)

One level deeper (availability-zone):

curl http://169.254.169.254/latest/meta-data/placement/availability-zone
us-east-1a(python3)

One level deeper (region):

curl http://169.254.169.254/latest/meta-data/placement/region
us-east-1(python3)

[Back to top]


Profile

curl http://169.254.169.254/latest/meta-data/profile
default-hvm(python3)

[Back to top]


Public hostname

curl http://169.254.169.254/latest/meta-data/public-hostname
ec2-123-234-123-234.us-east-1.compute.amazonaws.com(python3)

[Back to top]


Public IP4

curl http://169.254.169.254/latest/meta-data/public-ipv4
123.234.123.234(python3)

[Back to top]


Public keys

curl http://169.254.169.254/latest/meta-data/public-keys/
0=example_public_key(python3)

[Back to top]


Reservation ID

curl http://169.254.169.254/latest/meta-data/reservation-id/
r-1d23bb4567f89e1c2(python3)

[Back to top]


Security groups

curl http://169.254.169.254/latest/meta-data/security-groups
example_security_group

[Back to top]


Services

curl http://169.254.169.254/latest/meta-data/services/
domain
partition(python3) 

One level deeper (domain):

curl http://169.254.169.254/latest/meta-data/services/domain
amazonaws.com(python3) 

One level deeper (partition):

curl http://169.254.169.254/latest/meta-data/services/partition
aws(python3)

[Back to top]

About

AWS cloud instance meta data service - Inputs and Outputs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published