How do I use CloudWatch Metrics Insights to identify the EC2 instances that have the most CPU utilization?

2 minute read
0

I want to use Amazon CloudWatch Metrics Insights to identify the Amazon Elastic Compute Cloud (Amazon EC2) instances that have the most CPU utilization.

Resolution

When you identify the Amazon EC2 instances with high CPU utilization, you can adjust the instance types, implement auto scaling policies, or reduce CPU usage.

To use Amazon CloudWatch Metrics Insights to identify the instances that have the most CPU utilization, complete the following steps:

  1. Open the CloudWatch console.

  2. In the navigation pane, choose Metrics, and then choose All metrics.

  3. Choose the Multi source query tab.

  4. Choose Add query, and then choose EC2.

  5. Choose the pre-built query Top 10 instances by highest CPU utilization.
    Note: In Builder view, the metric namespace, metric name, filter by, group by, order by, and limit options are shown. In Editor view, the same options as Builder view are shown in query format.
    Example query in Editor view:

    SELECT MAX(CPUUtilization)
    FROM SCHEMA ("AWS/EC2", InstanceId)
    GROUP BY InstanceId
    ORDER BY MAX () DESC
    LIMIT 10
  6. Choose Run in the Editor view or Graph query in the Builder view.

Note: When you change the Limit keyword value, the query indicates the instances with the most CPU usage in your AWS account for your AWS Region.

Related information

Query your metrics with CloudWatch Metrics Insights

Amazon EC2 examples

AWS OFFICIAL
AWS OFFICIALUpdated a month ago