Auditing Data Platform Activity with AWS CloudTrail
This lesson explains how AWS CloudTrail records API activity across the data platform, answering who did what, when and from where, for audits and investigations.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish management, data and Insights events.
- Configure trails for retention and integrity.
- Query events with Athena or CloudTrail Lake.
Event types
AWS CloudTrail records API activity as three types of event. Management events record control-plane actions that create, change or delete resources, such as creating a Glue job, deleting a table or changing a bucket policy. They are recorded by default, and the last 90 days are available free in the event history.
Data events record operations on the data itself, such as each S3 object read or write, Lambda invocation or DynamoDB item operation. They are very numerous, so they are off by default and cost extra; advanced event selectors enable them for only the buckets or tables that need auditing, such as those holding sensitive data. Insights events, also off by default, flag unusual rates of API calls or errors, which can reveal a runaway script or misuse. The following table summarises the types.
| Event type | Records | Default |
|---|---|---|
| Management events | Control-plane actions: creating a Glue job, deleting a table, changing a bucket policy | Recorded; 90 days of free event history |
| Data events | High-volume data-plane operations: S3 object reads and writes, Lambda invocations, DynamoDB items | Off; extra cost, so enable selectively with advanced event selectors |
| Insights events | Unusual rates of API calls or errors | Off |
Which CloudTrail event type?
Trails and integrity
The CloudTrail event history keeps only 90 days of management events. For longer retention and for data events, a trail delivers events to an Amazon S3 bucket, where they can be kept for years under a lifecycle policy, and optionally to CloudWatch Logs, where metric filters and alarms can alert on specific actions, such as a deleted table.
In a multi-account organisation, an organisation trail created in the management account or a delegated administrator account logs every account centrally, into a bucket that member accounts cannot modify. Log file integrity validation adds signed digest files that prove the log files have not been altered or deleted since CloudTrail delivered them, which audits and investigations often require.
Trails and integrity
Querying events
CloudTrail events can be analysed in two ways. A trail delivers log files to Amazon S3, where Amazon Athena queries them with SQL; a table with partition projection on the account, Region and date prefixes keeps queries fast and cheap. This approach also lets CloudTrail data be joined with other data in the lake and used in custom reports, and it is available to every customer.
CloudTrail Lake collects events into managed event data stores with long retention and queries them with SQL directly, across the whole organisation, with no tables or partitions to define; it can also ingest AWS Config configuration items and events from outside AWS. The exam guide names CloudTrail Lake, but it closed to new customers on 31 May 2026. Organisations that already use it can continue to do so, while new designs query trail logs in S3 with Athena. The following table summarises the options.
| Option | How |
|---|---|
| Athena over trail logs | Query S3 trail logs with partition projection on account, Region and date prefixes; join with other lake data; available to all customers |
| CloudTrail Lake (existing customers) | Events in event data stores with long retention, queried with SQL, organisation-wide, with no pipeline; closed to new customers since 31 May 2026 |
The following diagram shows the path from a change to a Glue job to the Athena query that finds who made it.

Querying CloudTrail
Who changed the pipeline?
A Glue job's script location was changed last week and the job now produces wrong results. The team needs to know who changed it and when.
SELECT eventtime, useridentity.arn, requestparameters
FROM cloudtrail_logs
WHERE eventsource = 'glue.amazonaws.com'
AND eventname = 'UpdateJob'
AND "timestamp" >= '2026/09/30'
ORDER BY eventtime DESC;Athena queries the organisation trail's logs in S3, with a table that uses partition projection on the date prefix, so only the relevant days are scanned. (Organisations that already use CloudTrail Lake can run the same query against an event data store; it closed to new customers on 31 May 2026.) To see who read sensitive objects in S3, rather than who changed configuration, the trail would also need S3 data events for that bucket.
Which CloudTrail events show who read objects in a sensitive bucket?
Show answer
S3 data events, which must be enabled. Management events show changes such as deleting a bucket.
Exam Tips
Remember for the exam
- To find out who deleted a Glue table or a bucket, use CloudTrail management events.
- To find out who read objects in a sensitive bucket, use CloudTrail S3 data events.
- For SQL over long periods of API activity, query trail logs in S3 with Athena; CloudTrail Lake serves only existing customers since May 2026.
- To prove that logs have not been altered, use log file integrity validation.
- To log every account centrally, use an organisation trail.