Description
Tell us about your request
I am opening this request on behalf of a customer.
Customer would like the UpdateService API call to fail if the DesiredCount being set is below the minCapacity of configured for the Auto Scaling for the service.
desiredCount is a property from ECS Service and MinCapacity and MaxCapacity are a property of the Application Auto Scaling ScalableTargets.
We confirmed following behaviour is currently allowed on ECS, though I understand customer concerns:
Step 1) Create ECS Service using CreateService [1] API call setting Desired Count property, for example of 12.
Step 2) Create Application Auto Scaling Target using API call RegisterScalableTarget [2] considering Scalable Dimension ecs:service:DesiredCount of the ECS Service and define MinCapacity and MaxCapacity settings, for example, of 12 and 50 respectively.
Step 3) Update ECS Service using UpdateService [3] API call and setting DesiredCount to a value which is lower than then MinCapacity of the Application Auto Scaling Target, for example of 4.
The documentation on the link [4] take into account this behaviour as intentional:
"
If a service's desired count is set below its minimum capacity value, and an alarm initiates a scale-out activity, Service Auto Scaling scales the desired count up to the minimum capacity value and then continues to scale out as required, based on the scaling policy associated with the alarm. However, a scale-in activity does not adjust the desired count, because it is already below the minimum capacity value.
"
However, it's important to note that if there is no alarm triggered (for example, if ECSServiceAverageCPUUtilization remains below the TargetValue of 60%), Application Auto Scaling will not automatically adjust the desired count to match the minimum capacity. This is what was currently happening for customer case.
Considering the above, I am opening this as a feature request to the ECS team for their consideration.
Thank you.
References:
[1] https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html
[2] https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html
[3] https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html
[4] https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-auto-scaling.html
Which service(s) is this request for?
Fargate, ECS
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
What outcome are you trying to achieve, ultimately, and why is it hard/impossible to do right now? What is the impact of not having this problem solved? The more details you can provide, the better we'll be able to understand and solve the problem.
I forwarded this feature request to the customer in hope they provide more information.
Are you currently working around this issue?
How are you currently solving this problem?
After UpdateService API update the service to a value lower than minCapacity of the Auto Scaling for the service, if the Alarm is not triggered, perfoming an additional UpdateService APi call to set DesiredCount = minCapacity.