CloudWatch Logs sets retention to Never Expire by default. Every Lambda invocation, every container debug line, and every verbose log lands in a group that never deletes anything. Storage compounds at $0.03 per GB-month, forever, and the bill grows with the log volume.
Field Insight: The Hidden Cost Trap
By default, AWS CloudWatch Logs sets retention to Never Expire, causing verbose Lambda and container debug logs to compound storage charges at $0.03/GB-month forever.
A worked example
One account had 40 log groups with no retention policy holding 800 GB of logs, costing $24 a month and growing. Setting 30-day retention on the debug groups and 90 days on the audit groups cut the stored volume by two-thirds in a month, saving about $16 a month, $192 a year, with nothing lost that anyone needed.
A closer look
Log retention is a default nobody changes. CloudWatch Logs creates every log group with retention set to Never Expire, and most teams never revisit it. Lambda functions log on every invocation. Containers log on every request. Debug logging that was turned on for one incident stays on. The storage compounds at $0.03 per GB-month, and because the groups never expire, the bill grows with the log volume instead of levelling off. A group that held 10 GB a year ago can hold 100 GB now, and the only way to know is to look.
| Log groups | Stored | Monthly cost |
|---|---|---|
| No retention, debug | 500 GB | $15 |
| No retention, audit | 300 GB | $9 |
| Total without retention | 800 GB | $24 |
The fix is not to stop logging. It is to decide how long each log needs to live. Debug logs are useful for a week. Application logs are useful for a month or a quarter. Audit logs are the only ones that need a long retention, and even those are cheaper in S3 than in CloudWatch Logs. Set the policy per group, export what compliance requires, and let the rest expire. The groups that matter keep their history. The ones that do not stop compounding.
Before you act
Before setting retention, confirm which log groups hold audit or compliance data. Those need a longer retention or an export to S3, not a 7-day expiry. Check whether any team or tool reads old logs: a dashboard that queries 90 days back will break if the logs expire after 30. Set retention per group, not account-wide, and export the audit logs first.
Automated Detection: Flagging CloudWatch Log Groups Set to Never Expire with Boto3
import boto3 def audit_cw_log_retention(region='us-east-1'): logs = boto3.client('logs', region_name=region) never_expire = [] total_bytes = 0 for page in logs.get_paginator('describe_log_groups').paginate(): for lg in page.get('logGroups', []): if 'retentionInDays' not in lg: never_expire.append(lg['logGroupName']) total_bytes += lg.get('storedBytes', 0) gb = total_bytes / (1024 ** 3) print(f'[{region}] Log groups without retention policy: {len(never_expire)} ({gb:.2f} GiB stored)') return never_expire if __name__ == '__main__': audit_cw_log_retention() What to do with the results
Set a retention policy on every log group: 7 to 30 days for debug and Lambda logs, 90 days for audit and application logs, longer only where compliance requires it. Export anything you must keep to S3, where storage is cheaper, and let the log groups expire.
Running ad-hoc scripts in a single account or region does not scale across enterprise AWS Organizations. Sustained cloud cost governance requires automated anomaly detection, cross-account STS role assumption, and scheduled auditing.
- 📦 Install Free Single-Account CLI:
pip install aws-finops-auditor(PyPI | GitHub) - 💼 Managing Multiple Accounts or Client Infrastructure?
- Practitioner License ($149/yr): Single-account CLI scanner, compliance exports, and dynamic bash remediation.
- Consultancy & Agency Pack ($999/yr): Automated multi-account STS role assumption, CloudFormation StackSets, and branded executive PDF showback reports.
👉 Get the AWS Cloud Cost Auditor on Gumroad
- 🆓 Try the Free Lite Edition ($0+): AWS FinOps Auditor (Lite Version) on Gumroad
Which AWS service generates the most unexpected waste in your environment? Let me know in the comments.



