Retrieve dynamic data from your instance
To retrieve dynamic data from within a running instance, use one of the following URIs.
To retrieve user data using the IPv6 address, you must enable it and the instance must be an
instances built on the
AWS Nitro System in a subnet that supports IPv6.
IPv4
http://169.254.169.254/latest/dynamic/
IPv6
http://[fd00:ec2::254]/latest/dynamic/
This example retrieves the high-level instance identity categories.
- cURL
-
IMDSv2
[ec2-user ~]$
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` \
&& curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/dynamic/instance-identity/
rsa2048
pkcs7
document
signature
dsa2048
IMDSv1
[ec2-user ~]$
curl http://169.254.169.254/latest/dynamic/instance-identity/
rsa2048
pkcs7
document
signature
dsa2048
- PowerShell
-
IMDSv2
PS C:\>
[string]$token = Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token-ttl-seconds" = "21600"} -Method PUT -Uri http://169.254.169.254/latest/api/token
PS C:\>
Invoke-RestMethod -Headers @{"X-aws-ec2-metadata-token" = $token} -Method GET -Uri http://169.254.169.254/latest/dynamic/instance-identity/
document
rsa2048
pkcs7
signature
IMDSv1
PS C:\>
Invoke-RestMethod -uri http://169.254.169.254/latest/dynamic/instance-identity/
document
rsa2048
pkcs7
signature
For more information about dynamic data and examples of how to retrieve it, see Instance identity documents.