Sub topic 13
Cost and coverage considerations
This chapter assumes you know basic IAM and S3 concepts, can read JSON, and have used the AWS CLI. It also assumes you have read the earlier chapters on event categories, trails, and multi-Region and organization trails. Here you will learn what CloudTrail costs, what it can miss, and how to balance the two.
What you pay for
CloudTrail charges depend on what you record and where you keep it. Check the CloudTrail pricing page for current rates, because prices change.
- Event history is on by default. It holds 90 days of management events in each Region, and it costs nothing.
- Management events are free to deliver to S3 for the first copy of each event in a Region. Extra copies of the same events, such as a second trail, are charged per event.
- Data events are charged per event delivered. A busy S3 bucket or Lambda function can produce millions of events per day.
- Insights events are charged per event analyzed, on top of the cost of the events they read.
- CloudTrail Lake charges for ingestion and for the data your queries scan.
- Storage and tooling are billed separately by S3, KMS, CloudWatch Logs, and Athena.
Data events are usually the largest line item. Management events are cheap and high value, so the usual advice is to log them everywhere and be selective with data events.
Choosing what to record
Advanced event selectors let you narrow data events by resource type and ARN, as you saw earlier. Narrower selectors cost less and produce less noise. A selector for one sensitive bucket is a good starting point:
aws cloudtrail put-event-selectors \
--trail-name org-audit-trail \
--advanced-event-selectors '[
{
"Name": "Management events",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Management"] }
]
},
{
"Name": "S3 object-level events for one bucket",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:s3:::my-sensitive-bucket/"] }
]
}
]'You can also add a readOnly field selector to log only writes. That cuts volume sharply on read-heavy resources, but you lose the record of who read an object. Decide that on purpose, based on what you need to prove later.
Where the coverage gaps are
Cost pressure leads to gaps, and some gaps exist even with generous settings. Check for these:
- Data events are off by default. A trail with only management events cannot tell you who downloaded an object.
- Event history is short and limited. It covers 90 days and management events only, and you can search it only one Region at a time.
- Single-Region trails miss other Regions. Use a multi-Region trail, or an organization trail for all member accounts.
- Delivery is not instant. Events usually reach S3 within about five minutes, but treat that as typical rather than guaranteed.
- CloudTrail records API activity. It does not record what happens inside an instance, such as commands run on a server, or network traffic. Other services cover those.
- Retention is your job. Logs stay in S3 until a lifecycle rule removes them. Without one, storage cost grows forever. With a short one, you lose evidence.
Balancing cost and retention
A common pattern keeps recent logs easy to reach and moves older logs to cheaper storage. Match the periods to your compliance needs.
| Age of logs | Where to keep them | Reason |
|---|---|---|
| 0 to 90 days | Event history, S3 | Free searching and fast investigation |
| 90 days to 1 year | S3 Standard or CloudTrail Lake | Regular queries with Athena or Lake |
| Over 1 year | S3 Glacier storage classes | Cheap storage to meet retention rules |
Keeping costs visible
Cost problems tend to show up late. Two habits help:
- Review the CloudTrail and S3 lines in Cost Explorer each month. A sudden jump in data events usually means a new workload or a loop in someone's code.
- Tag and document each trail so that nobody creates a duplicate trail that records the same management events again.
Exercise
A team logs data events for every S3 bucket in the account, and the bill has grown sharply. The security team only needs object-level audit for one bucket named payroll-records. What should you change, and what do you give up?
Show answer
Replace the broad data event selector with an advanced event selector that matches eventCategory Data, resources.type AWS::S3::Object, and resources.ARN starting with arn:aws:s3:::payroll-records/. Keep management events on. This cuts volume and cost, but you no longer have object-level records for the other buckets, so you cannot show who read or wrote their objects.