How do you delete an AWS CloudWatch metric?

Amazon Web-ServicesAmazon DynamodbAmazon Cloudwatch

Amazon Web-Services Problem Overview


I am decommissioning a service in Amazon Web Services DynamoDB. We have various metrics and alarms for our DyDB tables. I am able to delete the alarms using 'aws cloudwatch delete-alarms --alarm-names ...' but I do not see any AWS CLI command to delete metrics.

I know metrics keep data for 2 weeks. Is it possible that the metrics will automatically disappear in 2 weeks when no more data is being stored in it? I see no documentation stating that, unfortunately.

Amazon Web-Services Solutions


Solution 1 - Amazon Web-Services

You're correct: there is no API to delete AWS Cloudwatch Metrics. Just wait two weeks after your last metric has been pushed. It will disappear automatically.

Solution 2 - Amazon Web-Services

Since November 1, 2016, CloudWatch has extended the retention of metrics (both custom and AWS NameSpace) from previous 14 days to 15 months.

But the CW console limits the search of metrics to 2 weeks after a metric is last ingested (which means if there is a metric in which no datapoints has been pushed for past 14 days then the CW console will not display it but you can still get it using the cli get-metric-statistics or by tweaking the console url to refer the correct resource name and start and end time older than 14 days).

And there is no api to delete the metrics. https://aws.amazon.com/cloudwatch/faqs/

Solution 3 - Amazon Web-Services

https://aws.amazon.com/cloudwatch/faqs/

> Amazon CloudWatch FAQs > >[…] > > Q: What is the retention period of all metrics? > > CloudWatch retains metric data as follows: > * Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution custom metrics. > * Data points with a period of 60 seconds (1 minute) are available for 15 days > * Data points with a period of 300 seconds (5 minute) are available for 63 days > * Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months) > * Data points that are initially published with a shorter period are aggregated together for long-term storage. > > […] > > Q: Can I delete any metrics? > > CloudWatch does not support metric deletion. Metrics expire based on the retention schedules described above.

Solution 4 - Amazon Web-Services

In support of the above, this is still an issue unfortunately. To read more on the AWS forum, please see: https://forums.aws.amazon.com/message.jspa?messageID=281904

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMoChaManView Question on Stackoverflow
Solution 1 - Amazon Web-ServicesSébastien StormacqView Answer on Stackoverflow
Solution 2 - Amazon Web-ServicesShamSufView Answer on Stackoverflow
Solution 3 - Amazon Web-Services2540625View Answer on Stackoverflow
Solution 4 - Amazon Web-Servicesebol2000View Answer on Stackoverflow