How to Retrieve Metadata of AWS EC2 Machine

Author - Webner
22.11.2021
|
0 Comments
||

Metadata is data about your EC2 instance that is used to manage and configure the instance. Developers use the metadata in the script in order to configure the instances and their resources.

Please login to your EC2 machine and run the following command:

# curl http://169.254.169.254/latest/meta-data

Curl command will retrieve the information associated with your EC2 machine, check the below image.
AWS

I have checked few metadata of the AWS EC2 machine, please check below:

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/hostname
OutPut: ip-172-31-2-247.ap-south-1.compute.internal

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/security-groups
OutPut: launch-wizard-1

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/public-hostname
OutPut: ec2-13-233-163-92.ap-south-1.compute.amazonaws.com

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/hostname
OutPut: ip-172-31-2-247.ap-south-1.compute.internal

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/instance-id
OutPut: i-049a37cb6053d0813

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/instance-type
OutPut: t2.micro

[ec2-user@ip-172-31-2-247 ~]$ curl http://169.254.169.254/latest/meta-data/public-hostname
OutPut: ec2-13-233-163-92.ap-south-1.compute.amazonaws.com

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *