- Newest
- Most votes
- Most comments
The issue you're experiencing with ECS Service Auto Scaling not scaling in (decreasing) as expected is a common concern. There are several factors that could be contributing to this behavior:
-
Cooldown periods: Auto Scaling has built-in cooldown periods to prevent rapid fluctuations. Make sure enough time has passed since the last scaling activity.HUMAN EDIT: scale-out cooldown doesn't block scale-in actions in Application AutoScaling -
Multiple scaling policies: If you have multiple scaling policies (e.g., for CPU and memory), scale-in only occurs when all policies agree it's necessary. Check if you have other policies that might be preventing scale-in.
-
Minimum capacity: Ensure that your current task count isn't already at the minimum capacity set for your service.
-
Task protection: If you're using task-level protection, it could prevent tasks from being terminated during scale-in events.
-
Deployment in progress: During ECS deployments, scale-in processes are typically turned off to maintain service stability.
To address this issue:
-
Review your Auto Scaling settings, including cooldown periods and minimum capacity.
-
If you have multiple scaling policies,
consider using a single target tracking policy that combines CPU and memory metrics.HUMAN EDIT: Better option would be to disable scale-in on one policy if you think scale-in should only be tracked on a single metric. HOWEVER, this is generally not advised for CPU + Memory. The goal of this behavior is to only scale-in when BOTH are low at the same time, otherwise you end up with oscillation where CPU wants to scale-out; then Memory scales-in; CPU scales-out, etc -
Check for any active deployments or task protections that might be interfering with scale-in.
-
Ensure that the "Turn off scale-in" option is not enabled for your scaling policy.
-
You can check why Application AutoScaling chose to ignore the low usage alarm via the not-scaled-reasons field
If the issue persists, you may need to manually adjust your task count or review your scaling policy thresholds. Remember that Auto Scaling is designed to be conservative with scale-in actions to maintain service stability, so some delay in scaling in is normal.
Sources
ECS Service auto scaling policy conflict the one to other policy | AWS re:Post
Amazon ECS EC2-backed auto scale-out and scale-in | AWS re:Post
ECS scale-in no SIGTERM signal | AWS re:Post
Relevant content
- asked 10 months ago
- AWS OFFICIALUpdated 4 months ago
Is it the service or the cluster not scaling in? If its the Service, then focus on the Service scaling policy(s) and alarms vs the ASG.