Reputation: 373
I'm trying to understand how Scaling Policy and Desired Instances fit with each other.
Suggest I'm having the following scenario.
Scaling Policy:
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)?
Upvotes: 4
Views: 1271
Reputation: 269246
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
.
Upvotes: 5
Reputation: 3349
If you manually set the desired value, the auto scaling group (almost) instantly scales (in/out) to that number.
Upvotes: 0