How do I use CloudWatch to view the aggregate Amazon EBS performance metrics for an EC2 instance?

3 minute read
0

I want to check Amazon Elastic Block Store (Amazon EBS) performance metrics for my Amazon Elastic Compute Cloud (Amazon EC2) instance.

Short description

Amazon EC2 instances have a limited bandwidth for Amazon EBS volumes. For an Amazon EBS-optimized instance, EBS I/O traffic uses a dedicated bandwidth. To help you understand whether your instance is under-provisioned or over-provisioned, monitor aggregate performance across all attached EBS volumes. For Nitro instances, use Amazon CloudWatch to view Amazon EBS performance metrics, such as I/O operations per second (IOPS) and throughput.

Note: To publish custom CloudWatch metrics for Xen-based instances, refer to the AWS Knowledge Center articles for Linux instances and Windows instances.

Resolution

The following resolution is operating system (OS) agnostic and works for all EC2 instances that are based on the Nitro platform. It uses the EBSReadOps, EBSWriteOps, EBSReadBytes, and EBSWriteBytes metrics in the AWS/EC2 namespace to calculate the following metrics and graph them in CloudWatch. This task uses the metric math feature in CloudWatch.

  • Avg Read IOPS = Sum(EBSReadOps) / PERIOD
  • Avg Write IOPS = Sum(EBSWriteOps) / PERIOD
  • Avg Total IOPS = (Sum(EBSReadOps) + Sum(EBSWriteOps)) / PERIOD
  • Avg Read Throughput = Sum(EBSReadBytes) / PERIOD
  • Avg Write Throughput = Sum(EBSWriteBytes) / PERIOD
  • Avg Total Throughput = (Sum(EBSReadBytes) + Sum(EBSWriteBytes)) / PERIOD

This method graphs the following burst metrics for some *.4xlarge instances. It also graphs these metrics for smaller instances that burst to their maximum performance for only 30 minutes at least once every 24 hours:

  • EBSIOBalance%
  • EBSByteBalance%

Graph all relevant metrics

1.    Open the CloudWatch console. Choose your AWS Region from the navigation bar.

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

3.    Choose Source, and then enter the following CloudWatch source:

{
    "metrics": [
        [ "AWS/EC2", "EBSIOBalance%", "InstanceId", "INSTANCE_ID", { "id": "m1", "visible": false } ],
        [ ".", "EBSByteBalance%", ".", ".", { "id": "m2", "visible": false } ],
        [ ".", "EBSReadOps", ".", ".", { "id": "m3", "stat": "Sum", "visible": false } ],
        [ ".", "EBSWriteOps", ".", ".", { "id": "m4", "stat": "Sum", "visible": false } ],
        [ ".", "EBSReadBytes", ".", ".", { "id": "m5", "stat": "Sum", "visible": false } ],
        [ ".", "EBSWriteBytes", ".", ".", { "id": "m6", "stat": "Sum", "visible": false } ],
        [ { "expression": "m3/PERIOD(m3)", "label": "Avg Read IOPS", "id": "r_io", "visible": false } ],
        [ { "expression": "m4/PERIOD(m4)", "label": "Avg Write IOPS", "id": "w_io", "visible": false } ],
        [ { "expression": "(m3+m4)/PERIOD(m3)", "label": "Avg Total IOPS", "id": "t_io" } ],
        [ { "expression": "(m5/PERIOD(m5))/1024^2", "label": "Avg Read Throughput (MiB/s)", "id": "r_tp", "visible": false } ],
        [ { "expression": "(m6/PERIOD(m6))/1024^2", "label": "Avg Write Throughput (MiB/s)", "id": "w_tp", "visible": false } ],
        [ { "expression": "((m5+m6)/PERIOD(m5))/1024^2", "label": "Avg Total Throughput (MiB/s)", "id": "t_tp" } ]
    ],
    "view": "timeSeries",
    "stacked": false,
    "period": 300,
    "title": "EC2 aggregate EBS graphs"
}

Note: Replace INSTANCE_ID with your instance ID.

4.    Choose Update.

5.    In the Graphed metrics tab, select the check box next to the metric that you want to view.

6.    (Optional) To set an alarm for any of these metrics, choose the bell icon under the Actions column.

If the instance isn't running in the same Region as the Region that's selected in the CloudWatch console, then you see blank graphs.

By default, EC2 metrics are available at 5-minute intervals with basic monitoring. For 1-minute resolution, turn on detailed monitoring. EBSIOBalance% and EBSByteBalance% metrics are available only for basic monitoring.