Auto Scaling

Posted on Posted in AWS

Autoscaling – ensures you have correct number of Ec2 to handle load of your application, whether to scale up or scaled down. AutoScaling groups are the cornerstone of any self-healing application on AWS.

Auto scaling is not really intended to respond to instantaneous spikes in traffic, as it will take some time to spin-up the instances that will handle the additional traffic.

Pricing – Autoscaling is FREE

Benefits: you can scale your resource depending on the demand of your application, hence you only pay for what you actually use, instead for example allocating too much memory on your servers but peak usage only occurs on certain days, as per below:



  • Autoscale can only be in on one region, but can have multiple Availability zones
  • Autoscale does rebalancing activities to make sure scaling is balanced among AZs this occurs under the following conditions
    • you issue a request to change AZ for your group
    • explicit call for termination of instance
    • AZ had insufficient capacity recovers
    • Spot market price
  • Autoscale launches new instances before termination old ones

Scale Out Occurances:

  • Manual Scaling
  • Dynamic Scaling
  • Scheduled Scaling

Scale In Occurances:

  • Manually decrease size
  • create scaling policy to decrease size depending on demand
  • scheduled scale

Autoscaling cooldowns – ensures that auto scaling does not launch or terminate additional instance before previous scaling takes effect. (does not apply if instance becomes unhealthy). Default cooldown period is 300 seconds

Cooldown periods are not supported for step scaling policies or scheduled scaling.

Default termination policy 

  • Check if there are any instances in multiple AZ
    1. if Yes select AZ with most instance
    2. if No select instance with oldest config – TERMINATE
  • Are there multiple instance with oldest config
    1. if yes select instance with most closest to billing hour
    2. if No Terminate
  • Are there multiple instance closest to billing hour
    1. if yes select at random then terminate
    2. if no terminate

Possible termination policies:

  • OldestInstance
  • newInstance
  • oldestLaunchConfiguration
  • closestToNextInstanceHour
  • Default

Instance Protection – protects an instance from getting deleted

Lifecycle Hooks – events you want to trigger when autoscaling occurs, ie create notification or perform some lambda function

Standby State – you can put an instance on standby state, meaning it is still part of the scaling group but it does not handle application, this is useful for example if you want to upgrade application and just put the instance on standby while others handle the traffic

Leave a Reply