2 Answers
- Newest
- Most votes
- Most comments
1
That command uses a HTTP GET to access the instance metadata service IMDS. IMDSv1 allows a GET request but IMDSv2 uses a PUT request - is it possible that the instance has been configured to use IMDSv2?
0
To get the same result now on a IMDSv2 host you now run:
TOKEN=`curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/placement/region
answered 8 months ago
Relevant content
- asked 8 months ago
- asked 2 years ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
The host is running AL2023 with IMDSv2.
Then you'll need to do a PUT to get the IMDSv2 token then a GET to retrieve the data: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMI-launch-index-examples.html