Attributing Every Action with Traceability and Audit Logging
This lesson explains traceability, which attributes every action to a person or system at a known time with an unalterable record, underpinning investigation, compliance and the confidence to give teams autonomy.
Learning outcomes
After completing this lesson, you will be able to:
- Identify which record answers each question.
- Attribute actions through shared roles with source identity.
- Explain how audit data is protected from tampering.
What records what
Different questions are answered by different records, and an investigation usually needs several of them. The following table identifies the source for each common question.
| Question | Source |
|---|---|
| Who called which AWS API, and when? | CloudTrail management events; data events for S3 objects, Lambda invocations and DynamoDB items |
| What did this resource look like last Tuesday? | AWS Config configuration history |
| Which network flows occurred? | VPC Flow Logs, Transit Gateway Flow Logs |
| Who requested this object or page? | S3 server access logs, ELB, CloudFront and API Gateway access logs |
| Which instance looked up this domain? | Route 53 Resolver query logs |
These records are joined during an investigation: Athena queries over the log archive, or Amazon Security Lake, which normalises them to the OCSF format, allow SQL across sources. CloudTrail Lake offered managed SQL over CloudTrail events but closed to new customers on 31 May 2026.
Attributing actions to people
An audit trail is useful only if each action can be traced to a person or system. With IAM Identity Center, CloudTrail records the user's name in the role session, so actions are attributable without any IAM users. Shared and chained roles are harder: when a person assumes one role and then another, later events show only the second role. The sts:SourceIdentity attribute solves this: it is set when the first role is assumed, cannot be changed afterwards, persists through role chaining and appears in every CloudTrail event, so every action is attributed to the original person.
Session tags carry attributes such as department into sessions, for both access control and audit, and automation should use meaningful role session names, such as the pipeline execution ID, so that its actions can be traced to the run that made them.
Who really did it?
Protecting audit data
Audit data is evidence only if it cannot have been altered, and an attacker's first move is often to remove traces. Logs are therefore delivered to a separate Log Archive account, where workload administrators have no write access, and stored with S3 Object Lock so that they cannot be deleted or overwritten during the retention period. CloudTrail log file validation proves that delivered files have not been changed.
Encryption with customer managed KMS keys whose policies restrict decryption limits who can read the logs, and SCPs prevent anyone in member accounts from stopping or modifying the organisation trail and the Config recorders.
Attributing actions through a shared role
Several engineers assume the same operations role, and CloudTrail shows only the role session, so an investigation cannot tell who deleted a security group. The role's trust policy now requires each engineer to set their own identity, which then follows the session through role chaining and appears in every CloudTrail record:
{
"Effect": "Allow",
"Principal": { "AWS": "arn:aws:iam::111111111111:role/EngineerBase" },
"Action": ["sts:AssumeRole", "sts:SetSourceIdentity"],
"Condition": { "StringLike": { "sts:SourceIdentity": "*@example.com" } }
}Investigators then query the organisation trail in the log archive bucket with Athena:
SELECT eventtime, recipientaccountid, eventname, useridentity.arn,
useridentity.sessioncontext.sourceidentity AS person
FROM cloudtrail_logs
WHERE eventname = 'DeleteSecurityGroup'
AND "timestamp" >= '2026/10/01'Because the source identity cannot be changed once set, a person cannot hide behind a second role in the chain. The trail's bucket lives in the log archive account with S3 Object Lock and log file validation, so the evidence itself is protected.
Which CloudTrail feature detects unusual API activity, such as a sudden burst of write calls?
Show answer
CloudTrail Insights, which compares management events with a baseline and records an Insights event when call or error rates are unusual.
Exam Tips
Remember for the exam
- To know which person acted through a shared role, use sts:SourceIdentity.
- To query audit history with SQL, use Athena over the log archive or Security Lake; CloudTrail Lake is closed to new customers.
- To see a resource's past configuration, use AWS Config history.
- Enable CloudTrail data events selectively where object-level audit is required.
- Tamper-proof logs need a separate account, Object Lock and log file validation.