2 out of my 26 ECS services in us-west-2 do not scale in to 1 task as desired.
The service configuration is like:
- Min tasks: 1
- Max tasks: 3
- Scale out criteria: ECSServiceAverageCPUUtilization > 40% or ECSServiceAverageMemoryUtilization > 60%
- Scale in period: 120 seconds
- Scale out period: 60 seconds
Behavior:
- The service had 1 task running
- The service scaled out to 2 tasks when the CPUUtilization > 40% for 3 datapoints within 3 minutes based on the target tracking alarm for scale out in aws Cloudwatch. The desired tasks showed 2.
- After a while, the target tracking alarm for scale in was in alarm state when CPUUtilization < 36% for 15 datapoints within 15 minutes. At this point, MemoryUtilization < 54% for 15 datapoints within 15 minutes.
By right it should auto scale in. I was expecting the desired tasks to be automatically updated to 1 and in the ecs service event history, there should be 3 entries that indicated a task had been deregistered, had begun draining and then stopped. But the desired tasks stayed at 2 and no entries were found in the event history that a task had been stopped.
This problem doesn't happen to all the services. Is this a known bug in AWS? Or is it due to some wrong configuration in the ECS service?