How do you delete an AWS CloudWatch metric?
Solution 1:
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:
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:
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.