Possible Duplicate:
Find out the instance id from within an ec2 machine
I am looking for the simplest way to find the id of an instance from within this instance itself.
I looked at the shell variables: no luck. How can I get it ?
My only solution right now is to write to the java api (1) to describe instances and (2) to finding the one matching ip address or dns and get its id. Anything simpler ?
thanks
didier
You can use the Instance Metadata API to retrieve the instance ID. Simply make a HTTP GET request to http://169.254.169.254/latest/meta-data/instance-id
from within the instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With