Jul
08
When you have several instances running and performing the same job, it’s often very helpful to add tasks into SQS with instance ID attached (that way you can also back-verify that item in queue comes from authorized instance). As it comes out, Amazon has already implemented instance meta-data tool, so no need to implement your own! EC2 Instance Meta-data Query Tool is very simple to install and use, just follow the on-site instructions and you would be done in no time. Here’s how I did it:
$ cd /usr/local/src $ wget http://s3.amazonaws.com/ec2metadata/ec2-metadata $ chmod u+x ec2-metadata $ mv ec2-metadata /usr/bin
and to find out instance ID:
ec2-metadata -i
For other options:
ec2-metadata -help




no comment untill now