aws_ cloudwatch_ log_ group cost estimation
A log group for storing application and AWS service logs. Priced by ingestion ($0.50/GB), storage ($0.03/GB-month), and queries.
An aws_
First, ingestion. Every log line written costs $0.50/GB (in us-east-1; other regions similar). This is the dominant cost for high-volume applications. A microservice writing 10 GB/day of structured JSON logs pays $150/month in ingestion alone, per service.
Second, storage. Stored logs are billed at $0.03/GB-month. Cheap compared to ingestion, but adds up over long retention windows. Default retention is "Never Expire," which is almost always wrong.
Third, query execution. CloudWatch Logs Insights queries cost $0.005/GB scanned. A query over a year of logs across multiple log groups can scan terabytes, costing tens of dollars per query. Not catastrophic, but watch for runaway query patterns.
Other features add cost: - Log archival to S3 (CreateExportTask): the export itself is free, but stored S3 data is billed at S3 rates (much cheaper than CloudWatch storage long-term). - Subscription filters to Kinesis or Lambda: free for the subscription; cost is on the destination resource. - Vended logs (logs written by AWS services like VPC Flow Logs, ALB logs): same ingestion + storage pricing as regular logs.
c3x estimates the per-log-group cost only when retention_
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_cloudwatch_log_group" "api" {
name = "/aws/lambda/api-function"
retention_in_days = 30
tags = {
Environment = "production"
}
}Pricing dimensions
What you actually pay for when you provision aws_.
| Dimension | Unit | What's being charged |
|---|---|---|
| Ingestion | per GB ingested | Every log line written. Dominant cost for verbose applications. $0.50/GB in us-east-1 |
| Storage | per GB-month | Stored logs after ingestion, billed by retention period. $0.03/GB-month |
| Logs Insights queries | per GB scanned | Cost of running ad-hoc queries against logs. $0.005/GB scanned |
| Vended logs | same as standard logs | VPC Flow Logs, ALB access logs, etc. written to CloudWatch use the same per-GB rates. |
| Log group level (Infrequent Access tier) | per GB ingested | Setting log_ $0.25/GB ingestion |
Optimization tips
Common ways to reduce aws_ cost without changing the workload.
Set retention_ in_ days on every log group
Storage cost in long-running accountsDefault is infinite retention. Most logs have value for 7-30 days. Setting retention = 30 cuts long-term storage cost by an order of magnitude.
Reduce log verbosity in production
70-90%Many applications log at DEBUG level in production. Each log line costs $0.50/GB. Switching to INFO or WARN and trimming verbose tracing payloads can cut log bills by 70-90%.
Archive cold logs to S3
90%+ on long-term log storageSet up a Lambda or use CreateExportTask to move logs older than 30 days to S3 (then to Glacier). S3 storage is ~10x cheaper than CloudWatch, Glacier 100x cheaper.
Use Infrequent Access tier for compliance-only logs
50% on ingestionIf a log group is only kept for compliance and rarely queried, log_
Drop high-volume health-check logs
Workload-dependentHealth-check, heartbeat, and constant-polling endpoints generate huge log volumes for no value. Filter them at the application or use log subscription filters.
FAQ
Why is my CloudWatch Logs bill so high?
Usually ingestion, not storage. A single Lambda function logging large request/response payloads at DEBUG can ingest 50+ GB/day. Across services it adds up. Audit log levels and verbose tracing first.
Are VPC Flow Logs billed as CloudWatch Logs?
Yes if you write VPC Flow Logs to CloudWatch (the default). They're often surprisingly large, multi-GB per day even for small VPCs. Writing them to S3 instead avoids CloudWatch ingestion fees, but you lose some real-time query capability.
Does c3x estimate CloudWatch Logs cost from Terraform alone?
Not without usage data. Log volume is application-specific and can't be inferred from the resource definition. Add expected daily_
What's the Infrequent Access log class?
A cheaper tier for logs you rarely query in real-time. Halves ingestion cost ($0.25/GB) but limits features: no subscription filters, no live tail, no Insights interactive queries (you can still query, just slower). Right for audit/compliance archives.
Related resources
More AWS resources
Further reading
- CloudWatch custom metrics cost: cardinality is the whole bill
Custom metrics are $0.30/metric/month, but each metric-name + dimension-value combination is a separate billable metric, so high cardinality explodes the bill. Here's how to control it.
- Azure Application Insights cost: you pay per GB of telemetry
Application Insights bills by data ingested (around $2.30 per GB after a free allowance) plus retention beyond 90 days. Sampling and trimming noisy telemetry are the main levers. Here is how the ingestion-based model works.
- Microsoft Sentinel cost: per GB of security data ingested
Sentinel bills per GB of data ingested and analyzed (on top of Log Analytics storage), with commitment tiers that discount at volume. High-volume log sources drive the bill. Filtering and tiering ingestion are the levers. Here is the model.
- CloudWatch Logs cost optimization: cutting the $0.50/GB bill
Ingestion at $0.50/GB dominates CloudWatch Logs bills. Source-side filtering, structured logging, IA tier, and S3 migration for high-volume groups typically cut the bill 50-80%. Here's the full breakdown and migration playbook.
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_.