Searching and Alerting on CloudTrail Data
This lesson explains the options for searching and alerting on CloudTrail data, which depend on speed, scale and cost. AWS CloudTrail Lake stopped accepting new customers on 31 May 2026; existing customers can keep using it, and new customers query trails with Amazon Athena or use Amazon Security Lake.
Learning outcomes
After completing this lesson, you will be able to:
- Choose between CloudTrail Lake, Athena, CloudWatch Logs and Security Lake for analysis.
- Identify the API events most worth alarming on.
- Reconstruct a principal's activity by pivoting on key fields.
Options
CloudTrail data can be analysed with four services, each suited to a different need. CloudTrail Lake stores events in managed event data stores with retention of up to several years and queries them with SQL across the organisation, with no tables or pipelines to manage. It can also ingest AWS Config items and events from outside AWS, and it offers dashboards, but it has accepted no new customers since 31 May 2026, so it suits only organisations that already use it. Athena runs low-cost SQL over the trail's log files in S3; partition projection on account, Region and date keeps queries fast.
CloudWatch Logs, fed by the trail, supports metric filters and alarms on important events, such as root sign-ins, and Logs Insights for interactive queries. EventBridge receives events as they happen, so a rule can react immediately to a specific API call, such as disabling a key that was just created outside an approved process. The following table summarises the options.
| Tool | Best for |
|---|---|
| CloudTrail Lake (existing customers) | SQL over managed event data stores with multi-year retention, organisation-wide, no tables to manage; can ingest Config items and non-AWS events; dashboards |
| Athena | Cheap SQL over trail logs in S3, with partition projection on account, Region and date |
| CloudWatch Logs | Metric filters and alarms on important events; Logs Insights for interactive queries |
| EventBridge | Reacting immediately to specific API calls |
Analysing CloudTrail data
Events worth alarming on
Certain API events indicate potential security issues and warrant alarms. The following list describes the events most worth alarming on.
- Root user activity and failed console sign-ins.
- Changes to IAM policies, security groups or CloudTrail configuration.
- Scheduling of KMS key deletion.
- Someone disabling GuardDuty, or a security group opened to 0.0.0.0/0 (which an EventBridge rule can revert automatically).
Events worth an alarm
Investigating
Pivot on access key ID, role session name, source IP and time window to reconstruct what a principal did, then correlate with Security Lake or Detective.
The following diagram shows the order of the response and the questions the query answers.

Everything a leaked key did
An access key was found in a public repository. Before deactivating it, the responder wants to know its full history across the organisation. The organisation trail's logs in the log archive bucket are queried with Athena, through a table that uses partition projection on account, Region and date:
SELECT eventtime, recipientaccountid, awsregion, eventsource, eventname,
sourceipaddress, useragent, errorcode
FROM cloudtrail_org_logs
WHERE useridentity.accesskeyid = 'AKIAIOSFODNN7EXAMPLE'
AND "timestamp" >= '2026/09/01'
ORDER BY eventtime;The results answer the containment questions: did the key create new users, keys or roles (persistence)? Did it read secrets or download data? From which IP addresses, so they can be blocked and searched for elsewhere? Only then is the key deactivated, followed by a search for any credentials it created.
How can you react immediately to a particular API call?
Show answer
With an EventBridge rule that matches the CloudTrail event.
Exam Tips
Remember for the exam
- For SQL over API activity in new designs, use Athena over the trail logs; CloudTrail Lake serves existing customers only.
- To alarm on root user activity, create a metric filter on CloudTrail logs in CloudWatch.
- To react immediately to a particular API call, create an EventBridge rule on the CloudTrail event.
- For cheap SQL over years of logs in S3, use Athena with partition projection.
- To find everything a leaked key did, query by accessKeyId.