Playing with Amazon Meta Data
21 December 2011
The good thing with cloud computing is that your resource can be allocated anywhere on Earth (at least for now!) and you don"t have to care about it. It will just “work”.
But what if you need to know more? Sure some tools offer you options at creation time to control the provisioning process but what if you need to afterwards?
Information will be added to this page as I experiment the service so please make sure you come visit often!
EC2 hosts
EC2 Metadata tool
From http://aws.amazon.com/code/1825
$ wget http://s3.amazonaws.com/ec2metadata/ec2-metadata
$ chmod u+x ec2-metadata
Then some testing! To get the AMI-ID of the current instance
ec2-metadata -a
public-hostname: ec2-x-x-x-x.compute-1.amazonaws.com
To get the PUBLIC HOSTNAME of the current instance
ec2-metadata -p
public-hostname: ec2-x-x-x-x.compute-1.amazonaws.com
To get the LOCAL IPV4 ADDRESS of the current instance
ec2-metadata -o
public-hostname: ec2-x-x-x-x.compute-1.amazonaws.com
If you don’t want to install this useful tool, you can do it the hard way using wget queries like below…
Find out information about physical hardware
wget -q -O - http://169.254.169.254/latest/meta-data/metrics/vhostmd
Public hostname of the current instance
wget -q -O - http://169.254.169.254/latest/meta-data/public-hostname
0143440600
blog comments powered by Disqus