I want to reduce my AWS CloudTrail costs and still maintain effective event logging and compliance.
Resolution
Review and consolidate CloudTrail trails
Multiple trails that record the same events can cause increased CloudTrail costs:
- Identify all current trails in your AWS account and across your organization.
- Check for duplicate trails that record the same management events.
- Keep one trail for management event logs (which is free), and turn off management event recording on other trails.
For more information, see Consolidate and query AWS CloudTrail data across accounts and regions using AWS CloudTrail Lake.
Optimize event logs
To reduce costs, be selective about the events that you log.
For management events:
- Edit your trail and uncheck "Read" events if they're not critical. Keep only "Write" events selected. For more information on how to update a trail, see Updating a trail with the CloudTrail console.
- Turn off high-volume services such as AWS Key Management Service (AWS KMS) and Amazon Relational Database Service (Amazon RDS) if they aren't essential for your compliance needs.
To exclude AWS KMS and Amazon RDS events, use the following AWS Command Line Interface (AWS CLI) command:
Note: If you receive errors when you run AWS CLI commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you use the most recent AWS CLI version.
aws cloudtrail put-event-selectors --trail-name TrailName --event-selectors '\[{"ReadWriteType": "All","IncludeManagementEvents":true,"ExcludeManagementEventSources": \["kms.amazonaws.com","rds.amazonaws.com"\]}\]'
For data events:
Manage CloudTrail Lake usage
If you use CloudTrail Lake, then take the following actions:
Monitor costs with Cost Explorer
Use AWS Cost Explorer to analyze CloudTrail usage and costs.
Optimize trail configuration
Consider your log needs and adjust your trail configuration through the following actions:
- If appropriate for your use case, change from multi-Region to single-Region logging.
- If you turn on single-Region logging for your home Region only, then you can't view logs for global services that are available in the us-east-1 Region. This includes services such as AWS Identity and Access Management (IAM).
For more information, see Receiving CloudTrail log files from multiple Regions.
Manage retention and storage
Improve your log retention and storage strategy through the following actions:
Regularly review and optimize
Regularly review and optimize your CloudTrail and CloudWatch configurations through the following actions:
Related information
AWS CloudTrail pricing
Managing CloudTrail trail costs
Logging data events