I want to use Amazon CloudWatch Metrics Insights to identify the Amazon Elastic Compute Cloud (Amazon EC2) instances with the highest CPU usage.
Resolution
To use CloudWatch Metrics Insights to identify the Amazon EC2 instances that use the most CPU, complete the following steps:
-
Open the CloudWatch console.
-
In the navigation pane, choose Metrics, and then choose All metrics.
-
Choose the Multi source query tab.
-
Choose Add query, and then choose EC2.
-
Select the Top 10 instances by highest CPU utilization query.
Note: The Builder view shows the Metric namespace, Metric name, Filter by, Group by, Order by, and Limit options. The Editor view shows the same options in query format.
Example query in the Editor view:
SELECT MAX(CPUUtilization)FROM SCHEMA ("AWS/EC2", InstanceId)
GROUP BY InstanceId
ORDER BY MAX () DESC
LIMIT 10
-
Choose Run in the Editor view, or Graph query in the Builder view.
Note: By default, the query shows you the top 10 instances with the highest CPU usage in your AWS account for your AWS Region. To increase the number of instances, change the value for Limit.
Related information
Query your CloudWatch metrics with CloudWatch Metrics Insights
Amazon EC2 examples