Tech Junkie Blog - Real World Tutorials, Happy Coding!: Iaas With AWS: Retrieve Instance Data

Monday, September 28, 2020

Iaas With AWS: Retrieve Instance Data

An instance metadata is data about your instance that you can use to configure your instances.  They are divided into categories.  Anyone who have access to the instance can view the metadata, therefore you should not store anything sensitive that could be accessed such as "User Data"

You can get more information here at Amazon's website:

You can access your metadata with this URL

Here are the steps to retrieve your instance data:

 1.  Connect to your AWS Linux instance and type curl

You will be shown all the other endpoints that you can get access to. For example
if you want to get access instance-id like this curl
meta-data/instance-id, you will get the instance-id of your instance

2. If you don't want to remember the URL all the time you can download a tool on
your instance and run it locally without using the endpoint and curl command.
First you want to download the tool with the command
Once the tool has been downloaded you need to change the permission on the
ec2-metadata so that you have execution rights on the file with this command
Now you can access the metadata using the tool, first let's see what commands are\
available by typing ec2-metadata -help
So to access the metadata you could either type
ec2-metadata -p
ec2-metadata --public-hostname

Connect to EC2 Instance Using The Browser

No comments:

Post a Comment

Search This Blog