How to save AWS Cloudwatch resources metric data point in some other database - amazon-web-services

As I know that AWS CloudWatch store metric datapoint for 15 months with variable data point sampling like
01 sec DP for 3 hours
60 sec DP for 15 Days
300 sec DP for 63 Days and so on
But there is no data available before 15 months also the available data is not helpful due to large data sample size
In my case, I am looking for some metric of ALB like
Max Active Connection per minute,
Max Request count per minute(RPM) &
New connection count
before 15 months, somehow I was able to identify max RPM via parsing ALB access logs.
I am looking for some solution which is easy to use and storing data in time serise DB (ex: influx DB)

Use&configure Telegraf Amazon CloudWatch Statistics Input Plugin and save CloudWatch metrics into InfluxDB.

Related

How to subtract CloudWatch Sum Statisitic with 1hr period from datapoint 24 hours in the past?

I'm trying to monitor the change in traffic on our application between days. We currently have a metric plotting the sum of 1 day between sequential days, however this comes with a 24 hr delay as we need to wait for the current day's traffic.
I'm trying to figure out a way to produce a graph that sums data over a 1hr period, and subtracts the same datapoint from 24 hrs in the past.
I can't figure out a way to do this with metric math. Anyone have any suggestions? Preferably within AWS, thanks!
You can set up an export of the CloudWatch logs into S3. Then you can use Athena to write SQL queries of arbitrary complexity, which you can then visualize using QuickSight.
It is not going to be as near-realtime as CloudWatch: there may be about a few hours' lag in S3 export. For a real-time solution, you may consider streaming logs into a Kinesis Datastream and then create a custom Lambda to process the logs and push them into a QuickSight dataset.

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.
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.

AWS - dynamoDB price and usage

I would like to make serverless service. Service would be made like this.
API gateway -> lambda -> dynamoDB
DynamoDB will count sum of read/write real usage time? If I read dynamoDB hourly and each read time would be 1 sec, then
( 24 hour * 30 days * 1 sec ) / 60 sec * DyanmoDB read hour price =
real cost price?
What if I send 100 requests in a sec with 10 unit DynamoDB, DB would not be able to read as much as I request?
If you exceed your read or write capacity that you provisioned, you requested will/may be rejected and your application will need to have a provision to retry the read/write.
Dynamodb will sometimes absorb read/writes beyond what you have provisioned, so you might get away with it sometimes, but it's not guaranteed, so you still need to account for it in your design.

How do you delete an AWS CloudWatch metric?

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.
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.
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/
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.
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

How long does metrics data in AWS cloudwatch maintained

Their API reference says the date start date should be less than 14 days from the current date. I would like to know whether the data older than this is deleted and not available
Metrics used to be kept for 2 weeks, but as #sfgeorge points out, AWS has increased storage times.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch.html
When you use the mon-put-data command,
you must use a date range within the
past two weeks. There is currently no
function to delete data points. Amazon
CloudWatch automatically deletes data
points with a timestamp more than two
weeks old.
As of November 1st, 2016, the retention window for AWS metrics in CloudWatch has expanded from 14 days to 15 months.
Note that the data granularity will be reduced when you widen your range beyond the past 15 days:
One minute data points are available for 15 days.
Five minute data points are available for 63 days.
One hour data points are available for 455 days (15 months).
As found in https://aws.amazon.com/ec2/faqs/ :
Q: Will I lose the metrics data if I disable monitoring for an Amazon EC2 instance?
You can retrieve metrics data for any Amazon EC2 instance up to 2 weeks from the time you started to monitor it. After 2 weeks, metrics data for an Amazon EC2 instance will not be available if monitoring was disabled for that Amazon EC2 instance. If you want to archive metrics beyond 2 weeks you can do so by calling mon-get-stats command from the command line and storing the results in Amazon S3 or Amazon SimpleDB