Introduction to Parameterized Launches

Articles & Tutorials>Introduction to Parameterized Launches
With API version 2006-10-01, Amazon EC2 allows you to supply additional data to instances at launch time. The data, in addition to standard instance-specific metadata, is then made available to those instances. This tutorial provides an example of how to use the parameterized launches feature.

Details

Submitted By: Attila@AWS
Created On: December 5, 2006 3:52 PM GMT
Last Updated: December 6, 2006 9:38 AM GMT

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-keypair
RESERVATION r-fea54097 598916040194 default
INSTANCE i-10a64379 ami-5bae4b32 pending gsg-keypair 0

Check whether your instance is running:

$ ec2-describe-instances  i-10a64379
RESERVATION 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.com
Welcome 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

More details about this feature can be found in the “Using Instance Data” section of the Developer Guide.

Comments

Much better than the other parameterized launch article
Much better than the other parameterized launch article.
M E Henrikson on January 10, 2010 8:30 AM GMT
We are temporarily not accepting new comments.
©2014, Amazon Web Services, Inc. or its affiliates. All rights reserved.