I want to calculate the average throughput and number of input/output operations per second (IOPS) of my Amazon Elastic Block Store (Amazon EBS) volume in Amazon CloudWatch.
Short description
To calculate the average throughput and number of IOPS of your volume, use math expressions with CloudWatch metrics.
To monitor the data in your EBS volumes, create CloudWatch alarms. Or, use the AWSSupport-CalculateEBSPerformanceMetrics automation document. The automation uses CloudWatch metrics to calculate aggregate throughput, number of IOPS, and the I/O size for EBS volumes. You can calculate metrics for individual EBS volumes or across all the EBS volumes that are attached to your Amazon Elastic Compute Cloud (Amazon EC2) instance.
Resolution
Manually calculate throughput
Complete the following steps:
- Open the CloudWatch console.
- Under Metrics, choose All metrics.
- Choose EBS namespace, and then choose Per-Volume metrics.
- Select the following metrics for the EBS volume:
To calculate average IOPS, select VolumeReadOps, VolumeWriteOps, and VolumeIdleTime.
To calculate average throughput, select VolumeReadBytes, VolumeWriteBytes, and VolumeIdleTime.
- Choose the Graphed metrics tab.
- For Statistic, choose Sum.
- For Period, choose the period of time that you want to view.
- Note the metric IDs in front of each graphed metric, such as m1, m2, m3, and so on.
- For Add math, choose Start with empty expression, and then enter the following expressions to calculate the expected average value.
To calculate the average IOPS in Ops per second, enter:
(m1+m2)/(PERIOD(m1))
Note: In the preceding expression, m1 is VolumeReadOps and m2 is VolumeWriteOps.
To calculate the average throughput in bytes per second when the volume is active, enter:
(m1+m2)/(PERIOD(m1)-(IF(m3>59, 59, m3)))
Note: In the preceding expression, m1 is VolumeReadBytes, m2 is VolumeWriteBytes, and m3 is VolumeIdleTime.
To calculate the average throughput in bytes per second, enter:
(m1+m2)/(PERIOD(m1))
Note: In the preceding expression, m1 is VolumeReadBytes and m2 is VolumeWriteBytes.
Throughput and IOPS are per-second measurements. So, when VolumeIdleTime is longer than 59 seconds, metric data points that are based in VolumeIdleTime X Period calculation can generate higher values than expected. Also, the average value of throughput and IOPS might differ from the actual average value because of micro-bursts. CloudWatch doesn't aggregate EBS volume metrics at the per-second interval. For more information, see How do I identify whether my EBS volume experiences micro-bursting and make sure that it doesn't affect performance?
Use automation to calculate throughput
Prerequisites:
- You must have a resource ID to run the automation document. Copy the volume ID or the instance ID of the resource that you want to analyze.
- Make sure that your AWS Identity and Access Management (IAM) user or role has the required permissions to use the AWSSupport-CalculateEBSPerformanceMetrics runbook. For more information, see the Required IAM permissions section of AWSSupport-CalculateEBSPerformanceMetrics.
Use the Systems Manager console
To run the Systems Manager runbook, complete the following steps:
- Open the Systems Manager console in the AWS Region where your resources are located.
- In the navigation pane, choose Documents.
- In the search bar, enter CalculateEBSPerformanceMetrics.
- Select the AWSSupport-CalculateEBSPerformanceMetrics document.
- Choose Simple execution.
- Choose Execute.
- After the automation completes, view the analyzed metrics and their quotas in the Outputs section in your dashboard.
Use AWS CLI
Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
Run the following start-automation-execution AWS CLI command:
aws ssm start-automation-execution --document-name "AWSSupport-CalculateEBSPerformanceMetrics" --document-version "\\$DEFAULT" --parameters '{"ResourceId":\["i-example12345"\], "StartTime":\["2021-06-09T13:30:10"\], "EndTime":\["2021-06-16T13:30:10"\], "Period":\["60"\], "AutomationAssumeRole":\[""\]}' --region us-east-1
Note: Replace i-example12345 with the resource ID that you want to analyze, 2021-06-09T13:30:10 with your start time, 2021-06-16T13:30:10with your end time, us-east-1 with the Region for your resource.