Posted On: Jun 25, 2021

Amazon CloudWatch Metric Math now supports 14 new functions including RUNNING_SUM, TIME_SERIES, and DATAPOINT_COUNT. Two new FILL variants, two logarithmic functions, two functions for calculating the difference between each datapoint, and five time functions are also now supported. With CloudWatch Metric Math, you can aggregate and transform metrics to create custom visualizations of your health and performance metrics. The new functions announced today allow you to view the logarithmic values of your metric, better visualize the change in latency over time, and calculate the cumulative sales of a product.

The new fill variants, REPEAT and LINEAR, make it easier to get more natural graphs from sparse metrics. The TIME_SERIES function allows you to plot a scalar value, such as the average or maximum value of a metric, as a time series. The DATAPOINT_COUNT function can be used to count events such as the number of hosts with errors over time. The new time functions can be used to create alarms that only trigger within certain time frames, or use different thresholds during different time frames. For example, using the DAY function you can alarm on a metric with a threshold that changes at the weekend.

All of these functions are included in the predefined Metric Math templates available in the CloudWatch console. Go to the metrics tab, click graphed metrics and select the math expression dropdown. You can use these predefined expressions with a single click or use them as a starting point to customize to your needs.

Metric Math is available in all AWS Regions where CloudWatch is available. You can use Metric Math expressions in calls to the GetMetricData API and to define dashboards using the API, AWS SDK and AWS Cloud Formation. See Metric Math syntax and functions for more details.