amazon-web-servicesamazon-cloudwatchamazon-cloudwatchlogsamazon-cloudwatch-metricscloudwatch-alarms

remove a custom metrics from aws cloudwatch


i've created successfully a custom metric by SDK but i'm not able to remove it I can't find the option from the web console to remove it (from SDK as well, i cant find a method to remove/cancel it)

//the code is not important, i've pasted it just to show it works

IAmazonCloudWatch client = new AmazonCloudWatchClient(RegionEndpoint.EUWest1);

List<MetricDatum> data = new List<MetricDatum>();

 data.Add(new MetricDatum()
 {
      MetricName = "PagingFilePctUsage",
      Timestamp = DateTime.Now,
      Unit = StandardUnit.Percent,
      Value = percentPageFile.NextValue()
 });

 data.Add(new MetricDatum()
 {
      MetricName = "PagingFilePctUsagePeak",
      Timestamp = DateTime.Now,
      Unit = StandardUnit.Percent,
      Value = peakPageFile.NextValue()
 });


 client.PutMetricData(new PutMetricDataRequest()
 {
      MetricData = data,
      Namespace = "mycompany/myresources"
 });

it created a metric named "mycompany/myresources" but i can't remove it


Solution

  • Amazon CloudWatch retains metrics for 15 months.

    From Amazon CloudWatch FAQs - Amazon Web Services (AWS):

    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)

    So, just pretend that your old metrics don't exist. Most graphs and alarms only look back 24 hours, so old metrics typically won't be noticed, aside from appearing as a name in the list of metrics.