111

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.

MoChaMan
  • 1,219
  • 2
  • 8
  • 6

4 Answers4

124

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.

RonU
  • 5,525
  • 3
  • 16
  • 13
Sébastien Stormacq
  • 14,301
  • 5
  • 41
  • 64
  • 45
    Starting from 9 July 2016, CloudWatch started retaining 5-minute and 1-hour metric data.1-hour data are available for 15 months. As a result, you now have to wait 15 months for unused metrics to expire and disappear. – galbarm Jun 11 '17 at 16:07
  • 5
    Hope you don't have any personal information in those logs that might fall under GDPR protection – lightswitch05 Apr 30 '18 at 18:27
  • 3
    Having personal data in a technical log is probably not a good idea, and not only for GDPR compliance. – Sébastien Stormacq May 02 '18 at 17:42
  • 3
    @SébastienStormacq True, but leaks happen sometimes. – Josiah Nov 05 '19 at 14:47
  • 1
    This is a major issue with the sagemaker endpoint dashboard which has hundreds of unused metrics graphs from previous load tests... – ThisGuyCantEven Aug 30 '22 at 18:30
65

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/

ShamSuf
  • 925
  • 6
  • 9
  • Q: Can I delete any metrics? CloudWatch does not support metric deletion. Metrics expire based on the retention schedules described above. – MoChaMan Feb 20 '18 at 08:19
  • 11
    Well, are you forced to pay for 15 months, even when your metric is no longer used and necessary? – blahblah Jul 24 '19 at 14:39
  • 9
    @programming_and_math Metrics are billed only when the Source sends metrics to CloudWatch and is prorated by the hour plus you pay for the number of APIs 'PutMetricData' consumed/made by the Source. – ShamSuf Aug 02 '19 at 00:30
12

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.

2540625
  • 11,022
  • 8
  • 52
  • 58
0

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

ebol2000
  • 1,195
  • 11
  • 16