I want to reduce and prevent unnecessary charges that I incur in Amazon CloudWatch.
Resolution
To identify your CloudWatch usage charges, review your AWS Cost and Usage Reports. To reduce and prevent unnecessary charges, review the CloudWatch services, and implement cost-effective methods. It's a best practice to turn on billing alerts to monitor future AWS costs.
Turn off unnecessary CloudWatch custom metrics
Amazon CloudWatch prorates detailed monitoring and custom metrics by the hour and charges you when you send metrics to CloudWatch.
Turn off detailed monitoring for instances, Auto Scaling group launch configurations, and API gateways.
Also turn off monitoring for custom metrics. Custom metrics incur charges when services send metric requests to CloudWatch through the PutMetricData API operation. This includes events from Amazon Simple Storage Service (Amazon S3), Amazon Simple Email Service (Amazon SES), Amazon Kinesis Data Streams dimensions and metrics, and AWS Elastic Beanstalk enhanced health reporting. The unified CloudWatch agent also uses the PutMetricData API operation to publish metrics.
To show only custom metrics, open the CloudWatch console, choose Metrics. Then, in the Search for any metric, dimension or resource ID field, enter NOT AWS.
Optimize CloudWatch metric API calls
Charges vary for each CloudWatch metric API operation. If your API operation exceeds the AWS Free Tier quota, then you incur charges. Metrics that third-party monitoring tools capture, such as GetMetricData and GetMetricWidgetImage, aren't included in the AWS Free Tier. For more information, see Is it better to use GetMetricData or GetMetricStatistics for CloudWatch metrics?
To reduce charges from CloudWatch API operations and third-party monitoring tools, use the following best practices:
- Make ListMetrics API calls through the AWS Management Console.
- To reduce the API volume operations and associated charges, batch multiple PutMetricData requests into one API operation and pre-aggregate metric data into a StatisticSet.
- For third-party monitoring tools, use metric streams to determine a cost effective deployment and retrieve only the metrics that you monitor or that you use in workloads.
Remove unnecessary CloudWatch alarms
Each CloudWatch alarm incurs charges for the metric it monitors. For example, if you create multiple alarms on a single metric, then you incur charges for each alarm. To reduce charges from CloudWatch alarms, remove unnecessary alarms.
For more information, see Automating Amazon CloudWatch alarm cleanup at scale.
Delete unnecessary CloudWatch dashboards
Charges for CloudWatch dashboard usage occur in the following situations:
- You exceed the AWS Free Tier quota of three dashboards with a maximum of 50 metrics for each dashboard.
- You make calls to the dashboard APIs GetDashboard, ListDashboards, PutDashboard, and DeleteDashboards that exceed the AWS Free Tier quota.
- You use the Exception: GetMetricWidgetImage API operation.
To reduce charges, delete unnecessary dashboards. If you use AWS Free Tier, then use only three dashboards. Also make dashboard API operations through the AWS Management Console.
Reduce unnecessary CloudWatch Logs ingestion and storage
CloudWatch logs incur charges from ingestion, archival storage, and analysis.
View your metrics on the CloudWatch graph or dashboard to monitor the volume of logs that workloads generate. For high ingestion charges, see How do I identify the log group that causes a sudden increase in my CloudWatch Logs bill? To reduce ingestion charges, check logging levels and remove unnecessary log ingestion. Also, it's a best practice to use infrequent access logs to cost-effectively store your logs.
The retention policy determines how long CloudWatch Logs maintains data. To reduce archival charges, modify the retention policy to a shorter retention period to limit data that's stored over time.
Analysis charges occur when you use Log Insights to query logs or Live Tail to analyze your logs in real time. To reduce the charges that Logs Insights incurs, set your queries to run with shorter timeframes so that CloudWatch scans less data. To reduce the charges that Live Tail incurs, minimize your session usage time.
Remove unnecessary CloudWatch Contributor Insights rules
If you exceed one Contributor Insights rule each month or more than one million log events match the rule each month, then you incur charges. View your Contributor Insights reports and remove unnecessary rules.
Remove unnecessary CloudWatch canaries
CloudWatch Synthetics incurs charges when you exceed 100 canary runs each month. For each canary run, you might incur additional charges for other AWS services that you use, such as AWS Lambda, Amazon S3, CloudWatch Logs, and CloudWatch metrics.
To reduce charges, remove unnecessary canaries.
Limit CloudWatch Internet Monitor city networks
CloudWatch Internet Monitor incurs charges for each monitored resource and city networks. You might also incur additional charges for diagnostic logs that you publish to CloudWatch Logs.
To reduce charges, set a limit for the maximum number of city networks that you monitor.
Turn off unnecessary Container Insights observability
Container Insights incurs charges based on the metrics that Container Insights collects and the log data that Container Insights ingests. If you use enhanced observability for Amazon Elastic Kubernetes Service (Amazon EKS), then you get charged for each Container Insights metric and log observation.
To reduce charges, turn off enhanced observability on your Amazon Elastic Container Service (Amazon ECS) or Amazon EKS clusters.
Related information
Analyzing, optimizing, and reducing CloudWatch costs
Cost Optimization with AWS