Auto Scaling in Amazon Web Services: EC2 + CloudWatch

by Andrii Kozhokaru

Hello all!

Auto scaling configuration based on Amazon EC2 is a particularly cunning task I once solved and have been using
the solution ever since.
No doubt, there can be a pack of options, but I will only cover the simplest one: horizontal scaling of a single
server under a single balancer.

What we do now is setup CloudWatch alarms. CloudWatch-based auto scaling employs a policy - policy, to be configured. An example of such policy is increasing the number of instances by 1. That is first we configure a policy and then we create an alarm, which goes off, let's say, when the Load Average value is exceeding 5 for a minute straight.

The alarm goes off when the Load Average remains less than 3 for over 2 minutes straight.

And this is it. Depending on the load, our scale group can expand up to 3 instances and 1 of them always stays
up. Once again, this has been the simplest example of auto scaling. Naturally, you can change the conditions and
play around with numbers as your own pleasure.