Skip to content

Instantly share code, notes, and snippets.

@weavenet
Created January 6, 2012 15:51
Show Gist options
  • Save weavenet/1571145 to your computer and use it in GitHub Desktop.
Save weavenet/1571145 to your computer and use it in GitHub Desktop.
Posting Metadata for Asynchronous EC2 Instance Bootstrapping Consumption
Start an instance and specify the metadata with -d.
# ec2-run-instances --region us-east-1 -key 'key' --instance-type 'm1.large' ami-1927f370 -d 'this is the data I need'
RESERVATION r-67bdc406 608324328795 default
INSTANCE i-5ad9aa38 ami-1927f370 pending weaver 0 m1.large 2012-01-06T15:44:47+0000 us-east-1b aki-08ed0761 monitoring-disabled ebs paravirtual xen sg-357c745c default
Retrieve the instance hostname.
# ec2-describe-instances --region us-east-1 i-5ad9aa38 | grep ^INSTANCE | awk {'print $4'}
ec2-50-17-2-102.compute-1.amazonaws.com
Curl the information from the instance specific metadata URL.
# ssh -i ~/key.id ec2-user@ec2-50-17-2-102.compute-1.amazonaws.com 'curl -s http://169.254.169.254/1.0/user-data'
this is the data I need
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment