AutoScale – example

The following is my favorite example for AutoScaling based on CPU utlization

Notes:

  • I prefer the cool down to be 10 minutes to let the started instance enough time to initilize
  • Make sure that the specified AZ are enabled in ELB, oterwize health check will fail
How to:

Step 1:

as-create-launch-config AS-CONF-[name] --image-id [ami-id] --instance-type [instance-type] --group [sec-group] --key [key-pair]

Step 2:

as-create-auto-scaling-group AS-GRP-[name] --launch-configuration AS-CONF-[name] --availability-zones us-east-1a us-east-1b us-east-1c us-east-1d --min-size 1 --max-size 3 --load-balancers [ELB-Name]

Step 3:

as-put-scaling-policy AS-PL-UpScale-[name] --auto-scaling-group AS-GRP-[name] --adjustment=1 --type ChangeInCapacity --cooldown 600

Step 4:

mon-put-metric-alarm AS-HighCPUAlarm-[name] --comparison-operator GreaterThanThreshold --evaluation-periods 1 --metric-name CPUUtilization --namespace "AWS/EC2" --period 600 --statistic Average --threshold 80 --alarm-actions [POLICY-ARN_from_previous_step] --dimensions "AutoScalingGroupName=AS-GRP-[name]"

Step 5:

as-put-scaling-policy AS-PL-DownScale-[name] --auto-scaling-group AS-GRP-[name] --adjustment=-1 --type ChangeInCapacity --cooldown 600

Step 6:

mon-put-metric-alarm AS-LowCPUAlarm-[name] --comparison-operator LessThanThreshold --evaluation-periods 1 --metric-name CPUUtilization --namespace "AWS/EC2" --period 600 --statistic Average --threshold 40 --alarm-actions [POLICY-ARN_from_previous_step] --dimensions "AutoScalingGroupName=AS-GRP-[name]"

Download the example

Author:

There is no additional info about this author.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


9 − eight =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>