Download the tool from http://s3.amazonaws.com/ec2metadata/ec2-metadata $ wget http://s3.amazonaws.com/ec2metadata/ec2-metadata Check file permissions and make sure that it is executable $ls -l ec2-metadata If not, change the file premissions and make it executable $ chmod u+x ec2-metadata $ ec2-metadata --help $ec2-metadata -a -To get the ami-id of the instance, run $ec2-metadata -p -To get the public hostname, run $ec2-metadata -o -To get the local ipv4, run