Tuesday, December 14, 2010

Amazon EC2 Auto Scaling

I setup Amazon Auto scaling which I found simple to setup and very effective.

Here are the list of commands that I used to setup from the command line :

(1) as-create-launch-config lc --image-id ami-9ecc3af7 --instance-type t1.micro -I amazonid -S secretkey
This command creates the launch configuration and references the AMI.


(2) as-create-auto-scaling-group group1 --launch-configuration lc --availability-zones us-east-1a --min-size 1 --max-size 2 --default-cooldown 180 --load-balancers  petstore --health-check-type ELB --grace-period 240 -I amazonid -S secretkey
This command sets up the auto scaling group.

(3) as-put-scaling-policy testScaleUp -g group1 --adjustment=1 --type PercentChangeInCapacity -I amazonid -S secretkey
This command sets up the auto-scaling policy. This command will return an arn number which will be used in the next command.

(4) mon-put-metric-alarm HighCPUAlarm --comparison-operator GreaterThanThreshold --metric-name CPUUtilization --namespace "AWS/EC2" --period 60 --statistic Average --threshold 5 --evaluation-periods 1 --dimensions "AutoScalingGroupName=group1" --alarm-actions arn:aws:autoscaling:us-east-1:868507589665:scalingPolicy:30b3c8d3-1b07-4064-b795-d196db923655:autoScalingGroupName/group1:policyName/testScaleUp -I amazonid -S secretkey

This command sets up the alarm to spawn new instances when CPU utilization goes above the threshold.

(5) as-put-scaling-policy testScaleDown --auto-scaling-group group1 "--adjustment=-1" --type ChangeInCapacity -I amazonid -S secretkey
This command sets up auto scaling policy for scaling down the instances. Also, this policy command will return an arn number which should be used in the next command.

(6) mon-put-metric-alarm LowCPUAlarm --comparison-operator LessThanThreshold --metric-name CPUUtilization --namespace "AWS/EC2" --period 60 --statistic Average --threshold 2 --evaluation-periods 3 --dimensions "AutoScalingGroupName=group1" --alarm-actions arn:aws:autoscaling:us-east-1:868507589665:scalingPolicy:44fa2f7a-b763-438c-b35a-18926b809182:autoScalingGroupName/group1:policyName/testScaleDown -I amazonid -S secretkey

This command sets up alarm for scaling down instances when the CPU utilization goes below the threshold.


Overall, the above 6 steps are required to setup the Amazon EC2 Auto Scaling in the application. You can play around with the lower and upper threshold cutoff to spawn and remove EC2 instances.

For more information on Auto Scaling, you can visit the Amazon AWS website.

Monday, December 6, 2010

Auto-Scaling Web Sites Using Amazon EC2 and Scalr

http://aws.amazon.com/articles/1603

This tutorial has live examples

Use Amazon SQS to Build Self-Healing Applications

This is a video

http://aws.amazon.com/articles/1466

Auto-scaling Amazon EC2 with Amazon SQS

http://aws.amazon.com/articles/1464

Relating to Amazon SimpleDB

http://aws.amazon.com/articles/1292

Migrating data from RDBMS to SimpleDB and using DBLoader

A simple iphone application development

http://aws.amazon.com/articles/1183

Shows Java tools for iPhone application development

Deploying Distributed J2EE Applications Using Amazon EC2

http://aws.amazon.com/articles/1084

Deploying Distributed J2EE Applications Using Amazon EC2

Building a Struts-Based Web Application on Amazon S3

http://aws.amazon.com/articles/606

Building a Struts-Based Web Application on Amazon S3

Lifeguard - This is a pool manager aimed at Amazon's EC2 and SQS services

http://code.google.com/p/lifeguard/

Lifeguard - This is a pool manager aimed at Amazon's EC2 and SQS services

JetS3t - Open source library to wrap Amazon S3 and CloudFront

http://jets3t.s3.amazonaws.com/index.html

JetS3t - Open source library to wrap Amazon S3 and CloudFront

QueryTool for Amazon Simple DB

http://coderslike.us/2009/04/15/query-tool-for-amazon-simpledb/

This is a simple tool to test queries on Amazon Simple DB.

Typica - a library to interface to AWS

http://code.google.com/p/typica/

The library to wrap calls to AWS, yet to be evaluated...

Amazon SQS: The Queue as Glue

This video gives an high level introduction to Amazon SQS

http://aws.amazon.com/articles/871

Amazon Web Services: Overview of Security Processes

A good article on "Amazon Web Services: Overview of Security Processes "

http://aws.amazon.com/articles/1697

Super Simple SimpleDB Example using Java and Typica

Tutorial and sample code to tryout Amazon SimpleDB.

http://aws.amazon.com/articles/2159

Developing Java Web Applications with Apache Tomcat and AWS

http://aws.amazon.com/articles/2241

A good tutorial on using AWS toolkit for Java and Eclipse plugin to develop and deploy Java web applications on Tomcat.

Tips for Securing Your EC2 Instance

http://aws.amazon.com/articles/1233

This article describes best practices and commands to cover the amazon ec2 security practices.

Running MySQL on Amazon EC2 with EBS (Elastic Block Store)

http://aws.amazon.com/articles/1663

This tutorial describes one approach to using Amazon EC2's Elastic Block Store (EBS) as a persistent storage mechanism for a production MySQL database server, including snapshot backup and restore.

The tutorial covers various aspects of MySQL database management. I am still searching for tutorial on MySQL replication.

Sunday, December 5, 2010

Cloud Deployment Management - SaaS solutions to manage clouds

There are few companies that are providing this service as SaaS - like kaavo and Rightscale

Both the comapnies aim at providing solution to their customers in the form of managing and deploying instances on multiple cloud platforms like Amazon EC2, etc. They also provide solution to manage private cloud infrastructure.

The solution covers building and managind AMIs, monitoring instances, replicating instances, etc.

How to Save a Snapshot of your Amazon EC2 Instance

This is another of excellent blog demonstrating steps - "How to Save a Snapshot of your Amazon EC2 Instance"

This is the link - http://www.philchen.com/2009/05/19/how-to-save-a-snapshot-of-your-amazon-ec2-instance

Some more links on building / migrating AMIs

XEN to EC2



XEN to VMWare


VMWare to XEN

VMWare to EC2

How to create an Amazon Elastic Compute Cloud EC2 Machine Image (AMI)

This is a very useful blog posted which describes "How to create an Amazon Elastic Compute Cloud EC2 Machine Image (AMI)"

I am yet to try out the steps but worth trying out.

Here's the link - http://www.philchen.com/2009/02/14/how-to-create-an-amazon-elastic-compute-cloud-ec2-machine-image-ami