Search code examples
amazon-web-servicesamazon-ec2amazon-cloudwatch-metrics

Delete temporary autoscaling EC2 memory metrics


I am using Immutable deployment.

I have included script as mentioned at http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/mon-scripts.html to monitor ec2 memory at autoscale level.

Now while every deployment for temporary autoscale cloudwatch metric is created.

How do I delete them when temporary autoscale is deleted?

Or how do I delete cloudwatch metrics created while deployment.

This is because my metric list will increase on every deployment.


Solution

  • It is not possible to delete metrics from Amazon CloudWatch. Metrics will eventually rotate out.

    Yes, this will increase the list of metrics, but typically AWS users would ask for a specific filter of metrics, so it doesn't matter how many different metrics are actually being stored by CloudWatch.

    From the CloudWatch FAQs:

    • 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. For example, if you collect data using a period of 1 minute, the data remains available for 15 days with 1-minute resolution. After 15 days this data is still available, but is aggregated and is retrievable only with a resolution of 5 minutes. After 63 days, the data is further aggregated and is available with a resolution of 1 hour. If you need availability of metrics longer than these periods, you can use the GetMetricStatistics API to retrieve the datapoints for offline or different storage.