Search code examples
amazon-ecsamazon-cloudwatch

In CloudWatch Metrics Insights, is it possible to graph metrics grouped by task instance or instance ID?


I'm running a my-api-service-TEST container in amazon ECS. The container contains two running task instances of my-api-service.
Currently, when graphing CPUUtilization Max I get an aggregation of both instances in the one graph.
Is it possible to display each instance's CPU usage separately? So I get a graph for each task running in that container?


Solution

  • The metrics available are all aggregated for ECS container. For deeper analysis on the metrics data, we can use CloudWatch Logs Insights queries.

    For example:

    stats avg(CpuUtilized) as CPU, avg(MemoryUtilized) as Mem by TaskId
    | filter Type="Task"
    | sort Mem, CPU desc
    

    Please refer this AWS forum post for more details. Hope it helps.