Posted On: Nov 13, 2019

Amazon CloudWatch Metric Math now supports sort, slice, remove empty and conditional statements. 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 sort metrics by performance indicators, slice the results to retrieve the highest or lowest values, and apply conditional logic using IF/AND/OR statements. All the new functions can be used to define alarms that take actions like sending notifications and auto scaling your service.  

Sorting metrics on a graph makes it easier to identify outliers and helps to reduce mean time to resolution. Using the SORT function you can order metrics by indicators like average, minimum or maximum. The conditional and boolean statements such as IF/AND/OR can be used to combine metrics for visualization or alarming. For example, you can create alarms that trigger autoscaling up when CPUUtilization or Memory are greater than 80% or scale down when CPUUtilization and Memory are less than 80%. There is also a function to remove empty metrics where no data is available. 

To help you get started, there is now a set of 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 Cloud Formation. See Metric Math syntax and functions for more details.