How To Find The Instance ID In AWS EC2

Published Date Author: , Posted January 8th, 2011 at 7:43:47pm

UPDATE:

# yum install ec2-utils
# rpm -ql ec2-utils
/etc/udev/rules.d/51-ec2-hvm-devices.rules
/opt/aws/bin/ec2-metadata
/sbin/ec2udev
# ec2-metadata -i | awk '{print $2}'

Just wrote a script for BudgetTravel.com and needed to determine the Instance ID. Here is how:

$ wget http://s3.amazonaws.com/ec2metadata/ec2-metadata
$ chmod u+x ec2-metadata
$ ./ec2-metadata -i
# ec2-metadata -i | awk '{print $2}' > /etc/instanceid

Link to the docs: http://aws.amazon.com/code/1825?_encoding=UTF8&jiveRedirect=1

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.