Created
March 26, 2015 00:06
-
-
Save nathenharvey/b73acc86d7b14e6481b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Required knife ec2, ec2 command line tools, and some AWS_ environment variables | |
# set-up some varirables | |
export JAVA_HOME=`/usr/libexec/java_home -v 1.7` | |
export NUM_INSTANCES=1 | |
# security group | |
export SG=sg-29d3c14c | |
# Intermediate workstation | |
export AMI=ami-3605295e | |
# launch the instances | |
# requires the ec2 cli tools | |
ec2-run-instances $AMI -t t1.micro --region us-east-1 --instance-count $NUM_INSTANCES --aws-access-key $AWS_ACCESS_KEY_ID -W $AWS_SECRET_ACCESS_KEY -k $AWS_KEYPAIR_NAME -g $SG | |
# wait a minute for the instances to become available | |
sleep 60 | |
# run a knife ec2 server list to get the IP addresses | |
knife ec2 server list |grep $AWS_KEYPAIR_NAME | grep $AMI | grep running |awk '{print $2}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment