Monitor Amazon ECS using CloudWatch - Amazon Elastic Container Service

Monitor Amazon ECS using CloudWatch

You can monitor your Amazon ECS resources using Amazon CloudWatch, which collects and processes raw data from Amazon ECS into readable, near real-time metrics. These statistics are recorded for a period of two weeks so that you can access historical information and gain a better perspective on how your clusters or services are performing. Amazon ECS metric data is automatically sent to CloudWatch in 1-minute periods. For more information about CloudWatch, see the Amazon CloudWatch User Guide.

Amazon ECS provides free metrics for clusters and services. For an additional cost, you can turn on Amazon ECS CloudWatch Container Insights for your cluster for per-task metrics, including CPU, memory, and EBS filesystem utilization. For more information about Container Insights, see Monitor Amazon ECS containers using Container Insights.

Considerations

The following should be considered when using Amazon ECS CloudWatch metrics.

  • Any Amazon ECS service hosted on Fargate has CloudWatch CPU and memory utilization metrics automatically, so you don't need to take any manual steps.

  • For any Amazon ECS task or service hosted on Amazon EC2 instances, the Amazon EC2 instance requires version 1.4.0 or later (Linux) or 1.0.0 or later (Windows) of the container agent for CloudWatch metrics to be generated. However, we recommend using the latest container agent version. For information about checking your agent version and updating to the latest version, see Updating the Amazon ECS container agent.

  • The minimum Docker version for reliable CloudWatch metrics is Docker version 20.10.13 and newer.

  • Your Amazon EC2 instances also require the ecs:StartTelemetrySession permission on the IAM role that you launch your Amazon EC2 instances with. If you created your Amazon ECS container instance IAM role before CloudWatch metrics were available for Amazon ECS, you might need to add this permission. For information about the container instance IAM role and attaching the managed IAM policy for container instances, see Amazon ECS container instance IAM role.

  • You can disable CloudWatch metrics collection on your Amazon EC2 instances by setting ECS_DISABLE_METRICS=true in your Amazon ECS container agent configuration. For more information, see Amazon ECS container agent configuration.