Thursday, May 3, 2012

Auto Scaling On Amazon Cloud Computing.

First check the URL to understand Auto Scaling http://aws.amazon.com/autoscaling/
And download Auto Scaling developer tool http://aws.amazon.com/developertools/2535

After download follow the stapes:

unzip AutoScaling-2011-01-01.zip
cd AutoScaling-1.0.49.1/

Set the enviroment in /root/.bashrc on your box.
------------------------------------------------------------------------
export AWS_AUTO_SCALING_HOME=/opt/AutoScaling-1.0.49.1/
set AWS_AUTO_SCALING_HOME=/opt/AutoScaling-1.0.49.1/
export PATH=$PATH:$AWS_AUTO_SCALING_HOME/bin
set PATH=%AWS_AUTO_SCALING_HOME%/bin

export AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com
set AWS_AUTO_SCALING_URL=https://autoscaling.ap-southeast-1.amazonaws.com
------------------------------------------------------------------------

You need to be using an elastic load balancer to configure auto scaling. Configuring autoscaling consists of three steps:
1) Create launch configuration
2) Create auto scaling group
3) Create auto scaling trigger

Create launch configuration
Launch configuration provides information about the instance to be launched. You can see that an AMI, instance type, availability zone and security groups are specified when a launch configuration is created.

as-create-launch-config MY_Group --image-id ami-a2b7f3f0 --instance-type m1.small -I Your_access_key -S Your_Secret_key

Create autoscaling group
A launch configuration is attached with an autoscaling group. The group consists of pool of instances. You can specify minimum and maximum size of the pool.

as-create-auto-scaling-group sbsgroup --launch-configuration MY_Group --availability-zones ap-southeast-1b --min-size 1 --max-size 10 --desired-capacity 1 -I Your_access_key -S Your_Secret_key


To check
as-describe-auto-scaling-groups sbsgroup --headers -I Your_access_key -S Your_Secret_key
----------------------------------------------------------------
Output:
AUTO-SCALING-GROUP GROUP-NAME LAUNCH-CONFIG AVAILABILITY-ZONES MIN-SIZE MAX-SIZE DESIRED-CAPACITY
AUTO-SCALING-GROUP sbsgroup MY_Group ap-southeast-1b 1 10 1
INSTANCE INSTANCE-ID AVAILABILITY-ZONE STATE STATUS LAUNCH-CONFIG
INSTANCE i-e6d671b2 ap-southeast-1b InService Healthy MY_Group
-----------------------------------------------------------------

Create autoscaling trigger
The trigger defines the conditions to start or stop ec2 instances. For example:

as-create-or-update-trigger my-latency-trigger --auto-scaling-group sbsgroup --dimensions "LoadBalancerName=myloadbalancer" --measure Latency --period 60 --statistic Average --lower-threshold 0.25 --upper-threshold 0.75 --breach-duration 300 --lower-breach-increment=-1 --upper-breach-increment 1 --namespace "AWS/ELB" --unit Seconds

Now, we have created a latency trigger with 0.25 as the lower threshold and 0.75 seconds as the upper threshold. If your website latency goes beyond 0.75 seconds, this trigger will be activated and hence an instance will be launched (as specified by upper breach increment).

Its Done.! @ Linux Administration Blog.!

4 comments:

Social network website design said...

Yes these are important things now days for every computer person.

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city

Rapyder Cloud said...
This comment has been removed by the author.
Rapyder Cloud said...

Great information on how to set up Auto Scaling On Amazon Cloud Computing. Cloud services will demand expertise in distributed services, procurement, risk assessment and service negotiation. Many enterprises are only modestly equipped to handle this kind of work at the moment.
know more about Cloud consultants