Skip to content

How do I check the resource usage for my Amazon ECS tasks and container instances?

2 minute read
0

I want to check the resource usage of an Amazon Elastic Container Service (Amazon ECS) cluster at the task and container instance level.

Resolution

To view the resource usage of your Amazon ECS tasks and container instances, complete the following steps:

  1. Open the Amazon CloudWatch console.
  2. In the navigation pane, under Logs, choose Logs insights.
  3. Select your log group.
    Note: Log groups for Amazon ECS use the /aws/ecs/containerinsights/cluster-name/performance naming convention.
  4. In the date range filter, select your time frame.
  5. For Query, enter the following query:
    fields @timestamp, @log, @logStream, @message
    | filter ispresent(TaskId) and TaskId like /task-id/ and Type = "Container" and ContainerName = "container-name"
    | display TaskId, ContainerName, CpuUtilized, MemoryUtilized
    Note: Replace task-id with your task ID and container-name with your container instance name.

Now, you can view the CPU and memory utilization for your Amazon ECS tasks and container instances. To save this data view, create a custom metric filter.

Related information

What do I need to know about CPU allocation in Amazon ECS?

How Amazon ECS manages CPU and memory resources

Install the CloudWatch agent with Prometheus metrics collection on Amazon ECS clusters

AWS OFFICIALUpdated a year ago