How can I find out the instance id
of an ec2 instance from within the ec2 instance?
Amazon-web-services – How to get the instance id from within an ec2 instance
amazon ec2amazon-web-services
Related Topic
- R – “UNPROTECTED PRIVATE KEY FILE!” Error using SSH into Amazon EC2 Instance (AWS)
- Amazon-web-services – What data is stored in Ephemeral Storage of Amazon EC2 instance
- Amazon-web-services – How to add swap to an EC2 instance
- Jquery – How to return JSON data using jQuery.post() to a Coldfusion 8 cfc
- Amazon-web-services – Cannot ping AWS EC2 instance
Best Answer
See the EC2 documentation on the subject.
Run:
If you need programmatic access to the instance ID from within a script,
Here is an example of a more advanced use (retrieve instance ID as well as availability zone and region, etc.):
You may also use
curl
instead ofwget
, depending on what is installed on your platform.