- Newest
- Most votes
- Most comments
There's an EventBridge Event for scaledToMax
https://docs.aws.amazon.com/autoscaling/application/userguide/monitoring-eventbridge.html#event-example-1
You could put an SNS target on a Rule tracking this Event to be notified whenever it gets hit.
If you want a metric, you would need to have a Target for this Rule going to CloudWatch logs, and then have a Metric Filter push a metric whenever an Event comes in
For monitoring Task Count, each task in the RUNNING state uploads 1 datapoint, so you can roughly look at the SampleCount statistic for any Service level ECS metric to see how many running tasks there were at a given time https://docs.aws.amazon.com/AmazonECS/latest/developerguide/available-metrics.html#ecs-metrics-dimensions
To monitor 'Attempting to scale due to alarm triggered' causing 'AlreadyAtMaxCapacity' across your multiple clusters, you can implement the following approach:
-
Use Application Auto Scaling to monitor scaling activities. You can retrieve scaling activities, including those that result in 'AlreadyAtMaxCapacity', using the describe-scaling-activities command. To include activities where scaling did not occur, add the --include-not-scaled-activities option to your command.
-
Set up Amazon EventBridge to capture these scaling events. You can create rules that match on the 'AlreadyAtMaxCapacity' status and trigger notifications or custom actions.
-
For easier monitoring across your 100+ clusters, you could create a centralized logging solution. Use AWS Lambda functions triggered by EventBridge to collect and aggregate scaling activity data from all your clusters into a central location, such as an Amazon CloudWatch Log Group or an Amazon S3 bucket.
-
Create CloudWatch alarms based on the aggregated data to alert you when 'AlreadyAtMaxCapacity' events occur frequently, indicating that you may need to adjust your maximum capacity settings.
Regarding graphing the number of active tasks in your clusters on a CloudWatch dashboard:
-
Enable Container Insights for your ECS clusters if you haven't already. This will provide you with detailed metrics about your clusters, including the number of running tasks.
-
Once enabled, you should be able to find a metric called 'RunningTaskCount' in the ECS/ContainerInsights namespace in CloudWatch.
-
You can then create a CloudWatch dashboard and add graphs for the 'RunningTaskCount' metric for each of your clusters.
-
To make it more manageable with 100+ clusters, consider using CloudWatch metric math to aggregate or compare task counts across multiple clusters in a single graph.
By implementing these monitoring strategies, you'll have better visibility into your cluster scaling activities and resource utilization, allowing you to optimize your min and max capacity settings more effectively across your large number of clusters.
Sources
Scaling activities for Application Auto Scaling - Application Auto Scaling
How to monitor high resource usage in Amazon EKS tasks and services | AWS re:Post
answered 2 years ago
Relevant content
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 3 months ago

RunningTaskCount is not available without enabling the very expensive Container Insights !!?!?!?
this doesn't answer to main question: how to track AlreadyAtMaxCapacity