aws cloudwatch metric overwrite/override

1.8k views Asked by At

I am using AWS CLI client to develop a custom monitoring system. The requirement is that data points needs to be overridden or overwritten, but when using:

aws cloudwatch put-metric-data 

I don't see any parameter to overwrite or override a data point if it has already been published. I tested this and found that that when a data point is pushed two or more times, it doesn't overwrite it but adds it (and then you can perform sums, averages, etc.). But for this specific requirement, instead of adding the data points we need to preserve just the last point. Is there any way to do that?

1

There are 1 answers

1
helloV On BEST ANSWER

Sorry. No way to do that. There is no concept of overwriting metric data in Cloudwatch.

One can argue deleting an existing metric data and add a new data with the same timestamp and dimension. But Cloudwatch metrics by design cannot be deleted once published. It will disappear after 2 weeks (default lifecycle policy for the metrics is 2 weeks).

So there is no way to preserve the last datapoint for the same timestamp. You have to do some kind of post processing after fetching the data. But if you are using Cloudwatch alarm or dashboard, there is nothing you can do.