Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

How can I find out the instance id of an ec2 instance from within the ec2 instance?

1 Answer

0 votes
by (18.2k points)

AWS sees to it that the Instance ID is available as a part of the EC2 meta data.

you can use the following command to retrieve the Instance ID.

EC2_instance_id=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`

You can also use the above mentioned command inside of a script to retrieve the instance ID.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

Browse Categories

...