
AWS CloudTrail Explained: Who Did What, When, and Where?
Learn how AWS CloudTrail records account activity, why audit logs matter for cloud security, and how security teams can use event history to investigate suspicious actions.
AWS CloudTrail Explained: Who Did What, When, and Where?
Imagine discovering that an important AWS resource was deleted.
Your first questions would probably be:
- Who deleted it?
- When did it happen?
- Which account or role performed the action?
- Where did the request come from?
- What other actions happened around the same time?
This is where AWS CloudTrail becomes extremely valuable.
Cloud security is not only about preventing bad actions. It is also about having enough visibility to understand what happened when something goes wrong.
What Is AWS CloudTrail?
AWS CloudTrail records activity associated with actions taken through the AWS Management Console, AWS CLI, SDKs, and APIs.
In simple terms:
CloudTrail helps create an audit trail of activity in AWS.
Instead of only knowing that a resource changed, you can investigate the event that caused the change.
A CloudTrail event can provide information such as:
- The identity that made the request
- The AWS service involved
- The API action performed
- The time of the request
- The source IP address
- The AWS Region
- Request parameters
- Response information
This makes CloudTrail extremely useful for security investigations and auditing.
A Simple Example
Suppose an EC2 instance suddenly disappears.
Without logging, you may only know:
The instance is gone.
With CloudTrail, you can search for an event such as:
TerminateInstances You may then discover:
- Which user or role performed the action
- The exact time it happened
- The instance that was targeted
- The source IP address
- How the request was authenticated
That changes the situation from guessing to investigating with evidence.
Why Security Teams Need Logs
Security incidents rarely begin with an obvious message saying:
Your account has been compromised.
Instead, suspicious activity may appear as a series of actions.
For example:
- An unusual identity signs in
- Permissions are changed
- A new access mechanism is created
- Security settings are modified
- Data is accessed
- Resources are created or deleted
Individually, one event may not look serious.
Together, the events can tell a story.
CloudTrail helps provide the timeline.
CloudTrail and Incident Response
During an investigation, analysts often want to answer four basic questions:
1. Who?
Which identity performed the action?
This could be:
- An IAM user
- An assumed role
- An AWS service
- A federated identity
2. What?
Which API action occurred?
Examples include:
-
CreateUser
-
AttachUserPolicy
-
PutBucketPolicy
-
StopLogging
-
RunInstances
-
DeleteTrail
3. When?
What time did the activity occur?
Accurate timestamps help build an incident timeline.
4. Where?
Where did the request originate?
Source IP information and Region data can provide additional investigative context.
Together:
Who + What + When + Where = Better Visibility
Event History vs Long-Term Logging
CloudTrail provides event history that can be useful for reviewing recent management activity.
However, organizations that need stronger auditing, retention, analysis, and investigation capabilities should design a proper logging strategy.
That may include:
- Creating CloudTrail trails
- Sending logs to Amazon S3
- Protecting the log bucket
- Centralizing logs
- Controlling who can modify or delete them
- Integrating logs with monitoring and analytics tools
Security logs become much more valuable when they are retained and protected.
Protect the Audit Trail
There is an important security principle here:
Your security logs need security too.
If an attacker gains access to an environment, they may try to hide their actions.
That means organizations should carefully restrict permission to:
- Disable logging
- Delete logs
- Modify trails
- Change the log destination
- Change bucket policies protecting audit data
An audit trail is only useful if investigators can trust it.
CloudTrail Is Not the Same as CloudWatch
Beginners sometimes confuse CloudTrail and CloudWatch.
A simple way to remember the difference is:
CloudTrail
Think:
Who performed an AWS action?
It focuses heavily on API and account activity.
CloudWatch
Think:
How is my application or resource behaving?
It is commonly used for:
- Metrics
- Logs
- Alarms
- Monitoring
They can work together, but they serve different purposes.
Suspicious Events Worth Investigating
Security teams may pay special attention to sensitive actions involving:
IAM
- Creating users
- Creating access keys
- Attaching privileged policies
- Modifying roles
Logging
- Stopping CloudTrail
- Deleting trails
- Changing log destinations
Storage
- Changing S3 bucket policies
- Changing public access settings
Networking
- Modifying security groups
- Changing network access
The context matters.
An administrative action may be completely legitimate.
The job of security monitoring is to determine whether the activity matches expected behavior.
A Practical Investigation Scenario
Imagine CloudTrail shows:
- A login from an unfamiliar location
- A new access key created shortly afterward
- Administrator permissions attached
- CloudTrail settings modified
One event alone may not prove compromise.
But the sequence is highly suspicious.
This is why timelines matter.
Security analysts do not only examine isolated alerts.
They correlate activity.
CloudTrail + GuardDuty + Security Hub
CloudTrail becomes even more powerful when it is part of a broader security strategy.
A simplified model looks like:
CloudTrail
→ Provides activity visibility
GuardDuty
→ Detects suspicious behavior
Security Hub
→ Helps centralize and prioritize security findings
Together, these services can help teams move from:
What happened?
to:
Is it suspicious?
to:
What should we investigate first?
My CloudTrail Security Checklist
When reviewing an AWS environment, I would ask:
- [ ] Is account activity being logged appropriately?
- [ ] Is there a long-term logging strategy?
- [ ] Are logs stored securely?
- [ ] Is public access prevented?
- [ ] Is access to modify logging tightly controlled?
- [ ] Can security teams search events quickly?
- [ ] Are sensitive administrative actions monitored?
- [ ] Are logs integrated with the broader security workflow?
Final Thought
You cannot investigate what you cannot see.
CloudTrail provides one of the most important capabilities in cloud security:
Visibility.
When something unexpected happens, logs allow you to replace assumptions with evidence.
And in cybersecurity, evidence matters.
If you were investigating a suspicious AWS account, which CloudTrail event would you look for first?
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article