get region from cli in Cape Town

0

I'm using: curl http://169.254.169.254/latest/meta-data/placement/region from the command line to get my host's location but I see I get no result when running this curl command in Cape Town.

Danie
已提问 8 个月前289 查看次数
2 回答
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?

profile pictureAWS
专家
已回答 8 个月前
profile pictureAWS
专家
已审核 8 个月前
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
Danie
已回答 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则