Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS EC2 Auto Scaling Groups: I get Min and Max, but what's Desired instances limit for?

When you setup an Auto Scaling groups in AWS EC2 Min and Max bounds seem to make sense:

  • The minimum number of instances to scale down to based on policies
  • The maximum number of instances to scale up to based on policies

However, I've never been able to wrap my head around what the heck Desired is intended to affect.

I've always just set Desired equal to Min, because generally, I want to pay Amazon the minimum tithe possible, and unless you need an instance to handle load it should be at the Min number of instances.

I know if you use ElasticBeanstalk and set a Min to 1 and Max to 2 it sets a Desired to 2 (of course!)--you can't choose a value for Desired.

What would be the use case for a different Desired number of instances and how does it differ? When you expect AWS to scale lower than your Desired if desired is larger than Min?

like image 630
Ray Avatar asked Mar 28 '16 20:03

Ray


People also ask

What is MIN MAX and desired capacity in AWS Auto Scaling group?

For example, the following Auto Scaling group has a minimum size of one instance, a desired capacity of two instances, and a maximum size of four instances. The scaling policies that you define adjust the number of instances, within your minimum and maximum number of instances, based on the criteria that you specify.

What is desired capacity in Auto Scaling group?

The desired capacity must be equal to or greater than the minimum group size, and equal to or less than the maximum group size. Desired capacity: Represents the initial capacity of the Auto Scaling group at the time of creation. An Auto Scaling group attempts to maintain the desired capacity.

What is desired capacity in AWS ASG?

The desired capacity is the initial capacity of the Auto Scaling group after this operation completes and the capacity it attempts to maintain. Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to complete before initiating a scaling activity to set your Auto Scaling group to its new capacity.

What is the maximum size of Auto Scaling group?

The engine might find that one auto scaling group should have a minimum of 4 nodes and a maximum of 8 nodes—while it is currently configured for a MIN of 2 and a MAX of 4. In this case, the engine will recommend upscaling to meet the app requirements.


2 Answers

Here are the explanations for the "min, desired and max" values from AWS support:

MIN: This will be the minimum number of instances that can run in your auto scale group. If your scale down CloudWatch alarm is triggered, your auto scale group will never terminate instances below this number

DESIRED: If you trip a CloudWatch alarm for a scale up event, then it will notify the auto scaler to change it's desired to a specified higher amount and the auto scaler will start an instance/s to meet that number. If you trip a CloudWatch alarm to scale down, then it will change the auto scaler desired to a specified lower number and the auto scaler will terminate instance/s to get to that number.

MAX: This will be the maximum number of instances that you can run in your auto scale group. If your scale up CloudWatch alarm stays triggered, your auto scale group will never create instances more than the maximum amount specified.

like image 94
Bahadir Tasdemir Avatar answered Oct 04 '22 01:10

Bahadir Tasdemir


Think about it like a sliding range UI element.

enter image description here

With min and max, you are setting the lower bound of your instance scaling. Withe desired capacity, you are setting what you'd currently like the instance count to hover.

Example: You know your application will have heavy load due to a marketing email or product launch...simply scale up your desired capacity beforehand:

aws autoscaling set-desired-capacity --auto-scaling-group-name my-auto-scaling-group --desired-capacity 2 --honor-cooldown 

Source

like image 36
Erik Ahlswede Avatar answered Oct 04 '22 02:10

Erik Ahlswede