Menu
Amazon Elastic File System
User Guide

Using Metric Math with Amazon EFS

Using metric math, you can query multiple CloudWatch metrics and use math expressions to create new time series based on these metrics. You can visualize the resulting time series in the CloudWatch console and add them to dashboards. For example, you can use Amazon EFS metrics to take the sample count of DataRead operations divided by 60. The result is the average number of reads per second on your file system for a given 1-minute period. For more information on metric math, see Use Metric Math in the Amazon CloudWatch User Guide.

Following, find some useful metric math expressions for Amazon EFS.

Metric Math: Throughput in MiB/Second

To calculate the average throughput (in MiB/second) for a time period, first choose a sum statistic (DataReadIOBytes, DataWriteIOBytes, MetadataIOBytes, or TotalIOBytes). Then convert the value to MiB, and divide that by the number of seconds in the period.

Suppose that your example logic is this: (sum of TotalIOBytes ÷ 1048576 (to convert to MiB)) ÷ seconds in the period

Then your CloudWatch metric information is the following.

ID Usable Metrics Statistic Period
m1
  • DataReadIOBytes

  • DataWriteIOBytes

  • MetadataIOBytes

  • TotalIOBytes

sum 1 minute

Your metric math ID and expression are the following.

ID Expression
e1 (m1/1048576)/PERIOD(m1)

Metric Math: Percent Throughput

To calculate the percent throughput of the different I/O types (DataReadIOBytes, DataWriteIOBytes, or  MetadataIOBytes) for a time period, first multiply the respective sum statistic by 100. Then divide the result by the sum statistic of TotalIOBytes for the same period.

Suppose that your example logic is this: (sum of DataReadIOBytes x 100 (to convert to percentage)) ÷ sum of TotalIOBytes

Then your CloudWatch metric information is the following.

ID Usable Metric or Metrics Statistic Period
m1
  • TotalIOBytes

sum 1 minute
m2
  • DataReadIOBytes

  • DataWriteIOBytes

  • MetadataIOBytes

sum 1 minute

Your metric math ID and expression are the following.

ID Expression
e1 (m2*100)/m1

Metric Math: Throughput IOPS

To calculate the average operations per second (IOPS) for a time period, divide the sample count statistic (DataReadIOBytes, DataWriteIOBytes, MetadataIOBytes, or TotalIOBytes) by the number of seconds in the period.

Suppose that your example logic is this: sample count of DataWriteIOBytes ÷ seconds in the period

Then your CloudWatch metric information is the following.

ID Usable Metrics Statistic Period
m1
  • DataReadIOBytes

  • DataWriteIOBytes

  • MetadataIOBytes

  • TotalIOBytes

sample count 1 minute

Your metric math ID and expression are the following.

ID Expression
e1 m1/PERIOD(m1)

Metric Math: Percentage of IOPS

To calculate the percentage of IOPS per second of the different I/O types (DataReadIOBytes, DataWriteIOBytes, or MetadataIOBytes) for a time period, first multiply the respective sample count statistic by 100. Then divide that value by the sample count statistic of TotalIOBytes for the same period.

Suppose that your example logic is this: (sample count of MetadataIOBytes x 100 (to convert to percentage)) ÷ sample count of TotalIOBytes

Then your CloudWatch metric information is the following.

ID Usable Metrics Statistic Period
m1
  • TotalIOBytes

sample count 1 minute
m2
  • DataReadIOBytes

  • DataWriteIOBytes

  • MetadataIOBytes

sample count 1 minute

Your metric math ID and expression are the following.

ID Expression
e1 (m2*100)/m1

Metric Math: Average I/O Size in KiB

To calculate the average I/O size (in KiB) for a period, divide the respective sum statistic for the DataReadIOBytes, DataWriteIOBytes, or MetadataIOBytes metric by the same sample count statistic of that metric.

Suppose that your example logic is this: (sum of DataReadIOBytes ÷ 1024 (to convert to KiB)) ÷ sample count of  DataReadIOBytes

Then your CloudWatch metric information is the following.

ID Usable Metrics Statistic Period
m1
  • DataReadIOBytes

  • DataWriteIOBytes

  • MetadataIOBytes

sum 1 minute
m2
  • DataReadIOBytes

  • DataWriteIOBytes

  • MetadataIOBytes

sample count 1 minute

Your metric math ID and expression are the following.

ID Expression
e1 (m1/1024)/m2

Using Metric Math Through an AWS CloudFormation Template for Amazon EFS

You can also create metric math expressions through AWS CloudFormation templates. One such template is available for you to download and customize for use from the Amazon EFS tutorials on GitHub. For more information about using AWS CloudFormation templates, see Working with AWS CloudFormation Templates in the AWS CloudFormation User Guide.