Search code examples
amazon-ecsaws-auto-scaling

How Target capacity % is calculated in AWS ECS capacity provider


While creating capacity provider in AWS ECS. the value Target capacity % we are filling, after crossing this value our cluster scale-in, but I am curious how this value of the current cluster is calculating and if I am want to check what is the current value of the cluster where can I check this. I have not found any data in cludwatch side.


Solution

  • For ECS Capacity Providers using managed scaling you will have an Autoscaling group associated with the Capacity Provider. The Autoscaling group will have a Target Tracking scaling policy associated with it which tracks a metric (often CPU utilization but could be what ever is most appropriate for your solution).

    A Target tracking autoscaling policy tracks a target value for the metric. When using ECS Capacity providers with managed scaling the Target Capacity % you configure for the Capacity Provider is used as the Target Value for the Target Tracking scaling policy.

    So as an example if your Target Tracking autoscaling policy is tracking CPUUtilization and you specify a Target Tracking % of 60% then the Capacity Provider will work on a best efforts basis to keep aggregate CPU Utilization at 60%. This will result in a scale out event when the CPUUtilization is greater than 60% and a scale in event when it is less than 60%.

    You can see the scaling events in the AWS CloudWatch Management console Alarms view as the scale out or scale in actions are triggered. You will be able to see the metric your Target Tracking autoscaling policy is tracking in the AWS loudWatch console Metrics view.