Amazon CloudWatch Metric Math - Rolling Average

Viewed 416

So I am trying to visualize a AWS CloudWatch Metric with Tolerance via AWS Managed Grafana.

For example, this is my current graph (and I want to add tolerance lines to it):

enter image description here

I want to add some tolerance lines too see which spikes go outside of the expected range.

I could technically do this by enabling CloudWatch anomaly detection and using ANOMALY_DETECTION_BAND(a) as my metric math but I am trying to replicate a dashboard we currently have which uses a 6 week rolling average with a simple multiplier as the upper and lower thresholds.

My thought was that I can accomplish this using metric math by leveraging a combination of SLICE, RUNNING_SUM, and DATAPOINT_COUNT but no matter what combination I try I can't seem to find the right mix.

Does anyone know how I can using Metric Math to create a time series where each data point is either:

  • The average of the last x amount of time data points (Ex: the last 6 days worth of data points)
  • The average of the last x data points.

If I can figure out either of these solutions I can do the rest but I am having a hard time just getting "the last x data points" instead of referencing the entire query when doing any metric math operation.

I could maybe find a way to do this with built in Grafana functionality as well but I couldn't find a great way to do it. (Still new to Grafana).

0 Answers
Related