Ankit Singh
Ankit Singh

Reputation: 363

meta data of an instance within AWS and provide a json formatted output

I am AWS newbie and I need to write code that will query the meta data of an instance within aws and provide a json formatted output. I have used the following command to get the output : wget -q -O - http://169.254.169.254/latest/dynamic/instance-identity/document

The code allows for a particular data key to be retrieved individually. Please let me know how this can be achieved using any language or was cli

Upvotes: 1

Views: 835

Answers (1)

Shahad Ishraq
Shahad Ishraq

Reputation: 341

You can take the response body of this request, parse with with json any library like Python's json package and use that. If you want to get more data than this url offers, try http://169.254.169.254/latest/meta-data. This will give you more data to choose from.

Upvotes: 1

Related Questions