Note: | This feature is supported from API version 2006-10-01 and its supporting command-line tools. |
This feature allows you to supply additional data to instances at launch time. This data, in addition to standard instance-specific metadata, is made available to those instances.
Launch your AMIs using the
ec2-run-instances command, supplying your data
using either the -d or
-f flag:
$ec2-run-instances ami-5bae4b32 -d "My data goes here" -k gsg-keypairRESERVATION r-fea54097 598916040194 default INSTANCE i-10a64379 ami-5bae4b32 pending gsg-keypair 0
Check whether your instance is running:
$ec2-describe-instances i-10a64379RESERVATION r-fea54097 598916040194 default INSTANCE i-10a64379 ami-5bae4b32 domU-12-34-31-00-00-05.usma1.compute.amazonaws.com running gsg-keypair 0
Once your instance is running, log in using ssh
$ssh -i id_rsa-gsg-keypair root@domU-12-34-31-00-00-05.usma1.compute.amazonaws.comWelcome to your Linux 6.4.21 node Half a mind is a terrible thing to waste.#
Retrieve the data you supplied when launching the AMI:
#curl http://169.254.169.254/1.0/user-dataMy data goes here
Retrieve instance-specific metadata:
#curl http://169.254.169.254/1.0/meta-data/ami-idami-5bae4b32#curl http://169.254.169.254/1.0/meta-data/ami-manifest-path<your-s3-bucket>/getting-started.manifest.xml#curl http://169.254.169.254/1.0/meta-data/ami-launch-index0#curl http://169.254.169.254/1.0/meta-data/instance-idi-10a64379#curl http://169.254.169.254/1.0/meta-data/hostnamedomU-12-34-31-00-00-05.usma1.compute.amazonaws.com#curl http://169.254.169.254/1.0/meta-data/local-ipv4216.182.234.123#curl http://169.254.169.254/1.0/meta-data/reservation-idr-fea54097#curl http://169.254.169.254/1.0/meta-data/security-groupsdefault
Note: | More details about this feature can be found in the “Using Instance Data” section of the Developers Guide. |