AWS Autoscaling
Auto Scaling Group
An Auto Scaling Group is created when the environment is provisioned. This group defines the specifics of how web nodes are added or removed to the environment. The scaling behavior is defined by attaching policies to the group.
ASG Parameters
The auto scaling group (ASG) has two important settings that act as lower and upper limits of how many nodes will be running regardless of any other configuration. These can be thought of as safety limits for automatic scaling.
- Minimum Capacity: This is the minimum number of web nodes that will be running at any given time. This value will ensure that the minimum number of nodes are always running, regardless of any other policies attached to the group.
- Maximum Capacity: This is the maximum number of nodes that will be running at any given time. More nodes then this will never be added to the group, regardless of any other policies attached to the group.
An example of these settings would be a Minimum Capacity of 3 web nodes and a Maximum capacity of 30 web nodes.
Auto Scaling Policy
Target Tracking: There is a monitor in place for the average CPU usage of the ASG. The policy will try to maintain an average of 25% CPU usage. It will add and remove web nodes in order to try and maintain an average of 25% for the web node ASG.
- There are warm-up periods defined to prevent too many nodes from being added at one time. This ensures that the load is continually monitored and the desired number of nodes is adjusted without excessively adding new nodes.
- Once the load decreases nodes are removed as needed to maintain the average of 25% CPU average. The nodes are removed one by one to prioritize availability and ensure that they are not removed too quickly.
Simple Scaling: There is also a “fail safe” simple scaling policy in place that will add a web node if the average of the ASG CPU usage is above 35% for at least one minute. It will wait 60 seconds before adding another node if the CPU usage remains above 35%.