Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ec2-tools + how to get meta data
  • Loading branch information
sdepold committed Jun 30, 2011
1 parent 2e1f83e commit 524fe91
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,4 +1,6 @@
*.priv
*.pem
elb-tools
as-tools
cw-tools
ec2-tools
6 changes: 6 additions & 0 deletions download_tools.sh
Expand Up @@ -19,3 +19,9 @@ wget http://ec2-downloads.s3.amazonaws.com/CloudWatch-2010-08-01.zip
unzip CloudWatch*
rm -rf CloudWatch*.zip
mv CloudWatch* cw-tools

rm -rf ec2-api-tools*
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
unzip ec2-api-tools*
rm -rf ec2-api-tools*.zip
mv ec2-api-tools* ec2-tools
9 changes: 8 additions & 1 deletion initialize_autoscale.sh
@@ -1,12 +1,19 @@
sh "$1.settings.sh"

### Read current value
elb-describe-lbs --region $REGION
elb-describe-instance-health $LB_NAME --region $REGION
as-describe-launch-configs $LC_NAME --region $REGION
as-describe-auto-scaling-groups $SG_NAME --region $REGION
mon-describe-alarms --region $REGION

### Install

# Set up load balancer
elb-create-lb $LB_NAME --headers --listener "lb-port=80,instance-port=80,protocol=http" --availability-zones $ZONE

#Setup Load Balancer Health Check
elb-configure-healthcheck $LB_NAME --headers --target "HTTP:80/index.php" --interval 5 --timeout 2 --unhealthy-threshold 2 --healthy-threshold 2
elb-configure-healthcheck $LB_NAME --headers --target "HTTP:80/" --interval 5 --timeout 2 --unhealthy-threshold 2 --healthy-threshold 2 --region $REGION

# Setup instance launch config
as-create-launch-config $LC_NAME --image-id $LC_IMAGE_ID --instance-type $INSTANCE_SIZE --group $SECURITY_GROUP --region $REGION --key $KEY_PAIR
Expand Down
7 changes: 6 additions & 1 deletion settings.sh
Expand Up @@ -2,12 +2,17 @@
export AWS_AUTO_SCALING_HOME="`pwd`/as-tools"
export AWS_CLOUDWATCH_HOME="`pwd`/cw-tools"
export AWS_ELB_HOME="`pwd`/elb-tools"
export EC2_HOME="`pwd`/ec2-tools"

# only needed for ec2-tools
export EC2_PRIVATE_KEY="`pwd`/xxx.pk.pem"
export EC2_CERT="`pwd`/xxx.cert.pem"

export JAVA_HOME="/usr/lib/jvm/java-6-sun/jre"
export AWS_CREDENTIAL_FILE="`pwd`/credentials"

# temporarily add bin folders to PATH
PATH="$AWS_AUTO_SCALING_HOME/bin:$AWS_CLOUDWATCH_HOME/bin:$AWS_ELB_HOME/bin:$PATH" # TODO only do this once...
PATH="$EC2_HOME/bin:$AWS_AUTO_SCALING_HOME/bin:$AWS_CLOUDWATCH_HOME/bin:$AWS_ELB_HOME/bin:$PATH" # TODO only do this once...

# set you custom stuff
ZONE="eu-west-1a" # <=== Availability Zone
Expand Down

0 comments on commit 524fe91

Please sign in to comment.