Auditing and Governance with CloudTrail
In a shared cloud account you must be able to answer: Who did what, when, from where – and is everything still compliant? AWS answers with CloudTrail (activity), AWS Config (configuration) and AWS Organizations (guard-rails).
AWS CloudTrail
Every API call – console click, CLI command, SDK call, service action – is recorded as an event.
{
"eventTime": "2026-11-18T09:42:11Z",
"eventSource": "s3.amazonaws.com",
"eventName": "PutBucketPolicy",
"userIdentity": { "type": "IAMUser", "userName": "ravi" },
"sourceIPAddress": "49.36.112.18",
"requestParameters": { "bucketName": "acme-reports" },
"errorCode": null
}
| Feature | Notes |
|---|---|
| Event history | Last 90 days of management events, free, per Region |
| Trail | Delivers events to an S3 bucket (and optionally CloudWatch Logs) for long-term retention; can cover all Regions and all accounts of an organisation |
| Management events | Control-plane actions – create, delete, change permissions |
| Data events | High-volume data access – S3 object reads/writes, Lambda invokes (extra cost) |
| CloudTrail Lake / Athena | Query events with SQL |
| Log file integrity validation | Prove logs were not tampered with |
Investigations: “Who deleted the table?” → filter by eventName = DeleteTable; “What did this access key do?” → filter by userIdentity.accessKeyId.
AWS Config
Records the configuration of resources over time and evaluates rules:
- Is every S3 bucket encrypted and not public?
- Do all EBS volumes use encryption?
- Is MFA enabled for the root user?
Non-compliant resources are flagged and can be auto-remediated with SSM Automation. Conformance packs bundle rules for standards such as CIS benchmarks.
AWS Organizations and guard-rails
| Feature | Purpose |
|---|---|
| Organizations | Many accounts (dev, prod, security) under one management account, consolidated billing |
| Organizational units (OUs) | Group accounts by purpose |
| Service Control Policies (SCPs) | Maximum permissions for an account – e.g. deny leaving ap-south-1, deny disabling CloudTrail |
| IAM Identity Center | Single sign-on across accounts |
| Control Tower | Automated landing zone with best-practice guard-rails |
Tagging and cost governance
Tag resources consistently (Project, Env, Owner, CostCenter); activate cost-allocation tags; use AWS Budgets alerts and Cost Explorer. Tag policies can enforce tags.
CloudTrail answers “who did what”, Config answers “what does it look like and is it compliant”, SCPs prevent actions before they happen.
Practise it
Virtual lab · Amazon Web Services · 30 min
Investigate a security incident with AWS CloudTrail
A bucket with customer data became public. Use CloudTrail event history to find who did it, when and from where, trace everything that user did, fix the bucket, then create a multi-region trail with log file validation so the evidence is kept long-term.
Quick revision
- CloudTrail records every API call: identity, time, IP, parameters.
- Event history = 90 days; trails store logs in S3 long-term.
- Management vs data events.
- Config tracks configuration and compliance rules.
- Organizations + SCPs set account-wide guard-rails.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.