Looks like RUNNING_SUM() has been added that does what your need:

Graph with RUNNING_SUM

You can find RUNNING_SUM() under "Add math"->"All functions"

Answer from Kim Rydhof Thor Hansen on Stack Overflow
Top answer
1 of 4
30

Looks like RUNNING_SUM() has been added that does what your need:

Graph with RUNNING_SUM

You can find RUNNING_SUM() under "Add math"->"All functions"

2 of 4
27

You can get a cumulative sum over the current range by using the SUM() function that is operated over the original range containing only the number One (1). Remember, you're looking for a single number in the end, so it's not much of a graph, but you need to turn the single value sum back into a time-series.

  • Define m1 as your metric. This is the metric you will want to use SUM() on.
  • Define an expression e1 as m1/m1. This results in a time-series with every value equal to 1. This is what will allow you convert that SUM back to a time-series.
  • Define an expression e2 as SUM(m1) / e1. This is, effectively, the cumulative sum of m1 divided by one for every data-point in the original time-series. It will be a horizontal line on the graph, which will have every point on that horizontal line being the cumulative sum of metric m1. This is required because Cloudwatch can only plot a time-series on the chart, not a single value.
  • Make m1 and e1 invisible. You need them, but you don't need to see them.
  • Finally, change the chart type from Line to Number, since you only wanted the cumulative sum anyway.

The reason you can't use SUM() directly is because it is a single value. By dividing by a time-series containing all 1's, the entire graph is the result of the SUM(). Then, changing the chart to a Number effectively hides all the math and presents only the "final result".

Discussions

Apparently I don't understand CloudWatch metrics, or how math works
Cost explorer is the easier way to discover this. More on reddit.com
🌐 r/aws
4
8
May 29, 2020
amazon web services - AWS CloudWatch metric math with a cumulative metric's value 30 minutes ago to show rate of change - Stack Overflow
I have a AWS CloudWatch custom metric that represents a cumulative value which continues to increase overtime. I will add that metric to a dashboard, but I also want to show the rate of change of ... More on stackoverflow.com
🌐 stackoverflow.com
amazon web services - How does "Sum" in CloudWatch metrics and alarms work? - Stack Overflow
Sorry for the large image, but it's the best way to to convey what I'm struggling to understand. This is a simple alert that should trigger when a lambda generates 10 or more errors within 1 hour. ... More on stackoverflow.com
🌐 stackoverflow.com
amazon web services - A way to get sum of continous points in cloudwatch for a sparse graph - Stack Overflow
CloudWatch's RUNNING_SUM function will give you the cumulative sum, but it still won't fill in the empty points in your sparse graph. To do that, you can use the FILL function. For example, if your metric is m1, then FILL(RUNNING_SUM(m1), LINEAR) should do the trick. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Grafana
community.grafana.com › t › cloudwatch-cumulative-total-over-time › 38002
CloudWatch cumulative total over time - Grafana - Grafana Labs Community Forums
October 15, 2020 - Is there any way to add a cumulative total over time that would in effect add a metric that continues to grow by adding all previous metrics over time? For example, using AWS/DataSync’s FilesTransferred metric: Of course it’s nice to be able to have the table present a “Total” but I’m hoping/wondering if there’s any way to achieve a cumulative delta within the graph itself as a kind of virtual metric…
🌐
OneUptime
oneuptime.com › home › blog › how to use cloudwatch metrics math expressions
How to Use CloudWatch Metrics Math Expressions
February 12, 2026 - PERIOD(m1) # Returns the period in seconds RATE(m1) # Rate of change per second DIFF(m1) # Difference between consecutive data points RUNNING_SUM(m1) # Cumulative sum over time · IF(condition, trueValue, falseValue) # Example: IF(m1 > 100, m1, 0) -- only show values above 100 · Search expressions let you dynamically find and aggregate metrics: # Find all EC2 instance CPU metrics and average them SEARCH('{AWS/EC2, InstanceId} MetricName="CPUUtilization"', 'Average', 300) This is where Metrics Math really shines. You can alarm on derived metrics that don't exist as standalone CloudWatch metrics.
🌐
AWS
aws.amazon.com › blogs › mt › enhance-cloudwatch-metrics-with-metric-math-functions
Enhance CloudWatch metrics with metric math functions | AWS Cloud Operations Blog
August 24, 2021 - In June 2021, the Amazon CloudWatch team launched 14 new metric math functions. In this blog post, I’ll describe these new functions and show how you can use them to enhance your existing CloudWatch metrics, dashboards, and alarms. Metrics are an important part of observability and monitoring.
🌐
Amazon Web Services
amazonaws.cn › en › new › 2021 › cloudwatch-new-metric-math-functions
CloudWatch adds 16 new Metric math functions
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.
Find elsewhere
🌐
tutorialpedia
tutorialpedia.org › blog › aws-cloudwatch-metric-math-with-a-cumulative-metric-s-value-30-minutes-ago-to-show-rate-of-change
AWS CloudWatch Metric Math: Calculate Rate of Change for Cumulative Metrics Using 30-Minute Ago Values — tutorialpedia.org
We’ll cover the challenges of raw cumulative metrics, key CloudWatch functions, a step-by-step implementation guide, and advanced scenarios to ensure accuracy. ... Cumulative metrics track the total count or sum of an event over time. They start ...
🌐
OpsRamp
opsramp.com › guides › aws-monitoring-tool › cloudwatch-metric-math
Enterprise IT Glossary | HPE | HPE
Explore HPE's enterprise IT glossary for clear definitions of key technology terms across AI, hybrid cloud, compute, networking, storage, security, and more.
🌐
Reddit
reddit.com › r/aws › apparently i don't understand cloudwatch metrics, or how math works
r/aws on Reddit: Apparently I don't understand CloudWatch metrics, or how math works
May 29, 2020 -

Could someone explain this to me like I'm 5?

I'm trying to see (on a chart) how much S3 outgoing bandwidth I'm burning every month. My bill says it's been 457GB last month and 400GB the month before.

Let's say I want to set up a CloudWatch dashboard that shows me this, and I want to look at the past X months, and know how much bandwidth was consumed each month.

I set the statistic to "Sum", period to 30 days, and when I choose the past 3 months, suddenly it says I'm using 800GB over the past couple months. With the configuration I've chosen, doesn't this mean "show the past 3 months, summing up total bandwidth over 30 days"?

If I switch period to 15 minutes and mouse over the data points, it's showing about 300MB every 15 minutes. Is that 300MB of data consumption every 15 minutes? I don't see how that's possible.

(is CloudWatch Metrics maybe not the best place to do this, and I should use the Cost Explorer instead?)

🌐
AWS
aws.amazon.com › blogs › mt › amazon-cloudwatch-metric-math-simplifies-near-real-time-monitoring-of-your-amazon-efs-file-systems-and-more
Amazon CloudWatch Metric Math simplifies near real-time monitoring of your Amazon EFS file systems and more | AWS Cloud Operations Blog
April 4, 2018 - This blog was contributed by Helen Lin, Sr. Product Manager for Amazon CloudWatch and Darryl S. Osborne, Storage Specialist Solutions Architect Today, we’re releasing a new feature in Amazon CloudWatch called Metric Math that makes it easy to perform math analytics on your metrics to derive ...
Top answer
1 of 3
14

You can use some arithmetic to obtain the previous value and then you're able to calculate the percentage of change as you want.

The value you want is: (value_now - value_before) / value_before

Breaking this into 2 parts:

  1. Obtain value_now - value_before. This is the absolute delta of the values.
  2. Obtain value_before. This is the value of the metric in the last datapoint.

Assuming that your metric in Cloudwatch is m.

Step 1: The absolute delta

The absolute_delta can be obtained with: absolute_delta = RATE(m) * PERIOD(m).

Step 2: The previous value

With some arithmetic it is possible to obtain previous_value. Given the definition of absolute delta:

absolute_delta = value_now - value_before

Since we have value_now = m and absolute_delta, then it's a matter of inverting the equation:

value_before = value_now - absolute_delta

Final equation

Just plug everything together and you have your final metric:

change_percentage = 100 * absolute_delta / value_before

In CloudWatch terms:

2 of 3
7

Metric math function RATE() calculates the rate of change per second.

Returns the rate of change of the metric, per second. This is calculated as the difference between the latest data point value and the previous data point value, divided by the time difference in seconds between the two values.

From https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/using-metric-math.html

So to get the rate of change for your period you could do this:

RATE(m1)*PERIOD(m1)

and set the period of the dashboard to the wanted value.

Problem in your case is that you need it for a period of 30 min, I don't think you can set 30 min as period on the CloudWatch dashboard. Closest values would be 15 min or 1 hour.

🌐
Stack Overflow
stackoverflow.com › questions › 67501859 › how-does-sum-in-cloudwatch-metrics-and-alarms-work
amazon web services - How does "Sum" in CloudWatch metrics and alarms work? - Stack Overflow
48 CloudWatch does not aggregate across dimensions for your custom metrics · 21 Cumulative sum of AWS Cloudwatch Metric · 4 AWS CloudWatch GetMetricsData: "Sum" misses points on periods without values · 3 CloudWatch Insights Syntax - Sum() Bytes · 4 How to define a CloudWatch Alarm on the sum of two metrics with CloudFormation?
🌐
Stack Overflow
stackoverflow.com › questions › 78212369 › a-way-to-get-sum-of-continous-points-in-cloudwatch-for-a-sparse-graph
amazon web services - A way to get sum of continous points in cloudwatch for a sparse graph - Stack Overflow
CloudWatch's RUNNING_SUM function will give you the cumulative sum, but it still won't fill in the empty points in your sparse graph. To do that, you can use the FILL function. For example, if your metric is m1, then FILL(RUNNING_SUM(m1), LINEAR) ...
🌐
Javaer101
javaer101.com › en › article › 33114327.html
CloudWatch Insights Syntax - Sum() Bytes - Javaer101
fields @timestamp,srcAddr,dstAddr,srcPort,dstPort,bytes, interfaceId | filter dstPort = 22 | stats sum(bytes) by interfaceId