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
preguntada hace 8 meses290 visualizaciones
2 Respuestas
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
EXPERTO
respondido hace 8 meses
profile pictureAWS
EXPERTO
revisado hace 8 meses
0
Respuesta aceptada

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
respondido hace 8 meses

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas