AWS Scheduled Autoscaling

AUTOSCALE SETUP
There are 3 steps
1.Create Autoscale Launch Configuration
2.Create Autoscale Group
3.Create Autoscale Policy

Creating Launch Configuration:

#as-create-launch-config unni-autoscale –image-id ami-5766173e –region us-east-1 –instance-type t1.micro –key unni –group unni

Verify Lauch Configuration:

#as-describe-launch-configs –region us-east-1

Creating Autoscaling Group

#as-create-auto-scaling-group unni-autoscale-test –launch-configuration unni-autoscale –region us-east-1 –availability-zones us-east-1a –min-size 1 –max-size 3 –load-balancers unni-autoscale

Verify Autoscaling Group

#as-describe-auto-scaling-groups unni-autoscale-test –headers –region us-east-1

Autoscale Policy has 3 Options
1.Maintain a fixed number of instances
2.Scale UP and Down based on the demand
3.Scale UP and Down based on schedule

SCALE UP AND DOWN BASED ON SCHEDULE

CHECKING MY AUTOSCALE SETUP OVERALL
#as-describe-auto-scaling-groups unni-autoscale-test –headers –region us-east-1
#as-describe-policies –headers
#as-describe-launch-configs
#as-describe-scheduled-actions –headers
#as-describe-scheduled-actions scale-down-schedule –headers –region us-east-1

Auto Scaling supports only the future date and time. The expected format is “YYYY-MM-DDThh:mm:ssZ” in UTC/GMT time zone only.

Scale Up Cron
Cron Task : 30 1 1-31 1-12 1,2,3

#as-put-scheduled-update-group-action scale-up-schedule –auto-scaling-group unni-autoscale-test –recurrence “30 15 1-31 1-12 1,2,3” –desired-capacity 2 –region us-east-1

Scale Down Cron

#as-put-scheduled-update-group-action scale-down-schedule –auto-scaling-group unni-autoscale-test –recurrence “30 17 1-31 1-12 1,2,3” –desired-capacity 1 –region us-east-1

The above cron-task will create a instance at 9pm IST and terminate it at 11pm IST.
We can control the number of instances by controlling the desired-capacity variable.

Reference
http://www.newvem.com/how-to-configure-aws-cloud-auto-scaling-to-scale-based-on-a-schedule/
http://alestic.com/2011/11/ec2-schedule-instance

http://www.newvem.com/9-guidlines-for-scheduling-aws-ec2-instances/

Advertisements

One thought on “AWS Scheduled Autoscaling

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s