Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Desired instances VS. Scaling policy [closed]

I'm trying to understand how Scaling Policy and Desired Instances fit with each other.

Suggest I'm having the following scenario.

  • Min: 0
  • Max:4
  • Desired Instances: 2

Scaling Policy:

  • Scale out: When CPU avg > 60%
  • Scale in: When CPU avg < 20%

Initial state: 2 instances are up.

Step one:

Increasing the CPU of both instance to average of 90%.

Step two occurs:

Auto Scaling increases the number of instances to 3.

Step three:

Keeping the average CPU of the machines around 40%, so that no scale out or scale in will trigger.

Step four:

Now we have three instance, no scale out, or in trigger, but the desired instances is two. What rule should "win"?

The desired instances of 2 (one instance will be removed)?

Or the scaling policy (nothing should change, keep the 3 instances up)?

like image 731
user3150947 Avatar asked Oct 14 '25 16:10

user3150947


1 Answers

Auto Scaling will always try to give you the number of instances indicated by the Desired Capacity.

For example, when starting an auto scaling group with Desired Capacity = 2, auto scaling will launch 2 instances. Changing the Desired Capacity to 3 would then cause auto scaling to launch 1 additional instance (total = 3).

Scaling Policies tell auto scaling to change the Desired Capacity.

For example, an Amazon CloudWatch alarm triggered by CPU exceeding a given threshold could be configured to trigger a Scaling Policy. The Scaling Policy could be configured with a rule of Add 1 instance, which would cause the Desired Capacity to increment by 1. (Note: Desired Capacity will always stay within the boundaries of the Min and Max, so a scaling policy might not actually change the Desired Capacity.)

In your example Step 1 caused a CloudWatch alarm to trigger, which executed a scaling policy that increased Desired Capacity from 2 to 3. There are no competing rules to "win".

Scaling adjustment types can be of: ChangeInCapacity, ExactCapacity and PercentChangeInCapacity.

like image 64
John Rotenstein Avatar answered Oct 17 '25 06:10

John Rotenstein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!