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.

2 Antworten
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
EXPERTE
beantwortet vor 8 Monaten
profile pictureAWS
EXPERTE
überprüft vor 8 Monaten
0
Akzeptierte Antwort

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
beantwortet vor 8 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen