![]()
Eucalyptus is a cloud computing platform that is intended to be API compatible with Amazon’s EC2, but can be installed on your own machines. In the latest stable version available at the time of writing, version 1.4, there is a catch in fetching meta-data and user-data. According to Amazon’s API description, you can get the meta-data by doing an HTTP GET on the URL:
http://169.254.169.254/latest/meta-data
However, this doesn’t work in Eucalyptus 1.4. The correct host to fetch this data from is the gateway for the running instance and the port is 8773. This little script will print the correct host and port:
echo http://$(route -n | awk '$4 ~ ".*G.*" {print $2}'):8773/
Meta-data
You can fetch a list of meta-data keys by getting /latest/meta-data. Fetching the value for a key is as easy as getting /latest/meta-data/key. The following table shows an example of the keys and associated values:
| local-ipv4 | 10.0.2.3 |
| reservation-id | r-412F078F |
| local-hostname | 10.0.2.3 |
| security-groups | [default] |
| product-codes | not yet supported. |
| ami-launch-index | 0 |
| public-hostname | 192.168.1.3 |
| hostname | 192.168.1.3 |
| public-ipv4 | 192.168.1.3 |
| ramdisk-id | emi-F4CB118E |
| kernel-id | eki-90591388 |
| ami-id | emi-7C83135D |
| placement/ | availability-zone |
| public-keys/ | 0=admin_key |
| ancestor-ami-ids | none |
| block-device-mapping | not yet supported. |
| ami-manifest-path | http://cloud1.example.org:8773/services/Walrus/ubuntu804-bucket/ubuntu.8-04.img.manifest.xml |
| instance-type | m1.small |
| instance-id | i-2ECA052C |
User-data
You can supply user-data as an option to ec2-run-instances:
ec2-run-instances <emi> -k <key> -d <user-data>
This data is fetched by getting /latest/user-data.