How can I use CloudWatch metrics to check if the EBS volumes of my EC2 instance are reaching throughput or IOPS limits?

Last updated: 2022-08-15

I have an Amazon Elastic Compute Cloud (Amazon EC2) instance. I want to view Amazon CloudWatch metrics for one or all Amazon Elastic Block Store (Amazon EBS) volumes attached to my EC2 instance. I want to do this for a specific period of time. How can I do this?

Short description

The AWSSupport-CalculateEBSPerformanceMetrics automation document uses available CloudWatch metrics to calculate and visualize a number of items. This includes aggregate throughput, number of IOPS, and the IO size for EBS volumes. You can perform these tasks for individual EBS volumes or across all the EBS volumes attached to your instance.

The automation document does the following:

  • Pulls CloudWatch metrics for a specific AWS Resource ID (an EBS volume ID or an EC2 instance)
  • Calculates throughput, IOPS, and IO size over a specified period of time
  • Pulls metadata from the provisioned Resource ID to calculate specific throughput and IOPs limits
  • Creates a CloudWatch dashboard and provides a URL to that dashboard

The metrics you see on your CloudWatch dashboard are not real-time metrics, but are based on a time range entered.

Note: Creating this dashboard can result in your account incurring extra charges. For more information, see the CloudWatch pricing guide.

Resolution

Before using the automation

Before you run the AWSSupport-CalculateEBSPerformanceMetrics automation, do the following:

  1. Copy the volume ID or the instance ID of the resource you want to analyze. You need a resource ID to run the automation document.
  2. (Optional) Create and specify an AWS Identity and Access Management (IAM) role for the automation. If you don't choose a role, then AWS Systems Manager Automation uses the permissions of the user who runs the document. For more information, see Running an automation by using an IAM service role .

Run the AWSSupport-CalculateEBSPerformanceMetrics automation from the Systems Manager console

  1. Open the document in the Systems Manager console. Be sure to open the document in the Region where your resources are located.
  2. In the Execute automation document section, choose Simple execution.
  3. In the Input parameters section, enter the following parameters: ResourceId - enter the ID of the EBS volume or EC2 instance you want to analyze StartTime - enter a time in the format yyyy-mm-ddThh:mm:ss and in UTC. For example, 2021-06-09T13:30:10 EndTIme, - enter a time in the format yyyy-mm-ddThh:mm:ss and in UTC. For example, 2021-06-16T13:30:10 Period - choose an option from the list for the period/resolution (in seconds) of the CloudWatch metrics AutomationAssumeRole - choose the IAM role for this run. This step is optional.
  4. Choose Execute.

The final output is a URL to your newly created dashboard which you can see by expanding the Outputs field. Use the dashboard to view the analyzed metrics and their limits. 

Run the AWSSupport-CalculateEBSPerformanceMetrics automation from the AWS Command Line Interface (AWS CLI)

To run the automation from the AWS CLI, use the command below. Be sure to change the following before running the command:

  • Replace the ResourceId value with the Resource Id you want to analyze.
  • Replace the StartTime value with the start time to view the data in CloudWatch (in the format yyyy-mm-ddThh:mm:ss and in UTC).
  • Replace the EndTIme value with the ending time to view the data in CloudWatch (in the format yyyy-mm-ddThh:mm:ss and in UTC).
  • Replace the Period value with the period/resolution (in seconds) of the CloudWatch metrics. You can use one of the following: 60, 300, 900, 3600, 21600, 86400.
  • Replace AutomationAssumeRole value, which is not specified in this example, with the IAM role for this run. This step is optional.
  • Replace the Region us-east-1 with your chosen resource's Region.

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.

aws ssm start-automation-execution --document-name "AWSSupport-CalculateEBSPerformanceMetrics" --document-version "\$DEFAULT" --parameters '{"ResourceId":["i-xxxxxxxxxxxxxxxx"], "StartTime":["2021-06-09T13:30:10"], "EndTime":["2021-06-16T13:30:10"], "Period":["60"], "AutomationAssumeRole":[""]}' --region us-east-1

Did this article help?


Do you need billing or technical support?