Skip to main content
AWS CloudTrail Architecture

Module Overview

Estimated Time: 2-3 hours | Difficulty: Intermediate | Prerequisites: IAM, S3, basic logging concepts
AWS CloudTrail is a service that enables governance, compliance, and operational and risk auditing of your AWS account. It records API calls made to AWS services and delivers log files to an S3 bucket. Think of CloudTrail as the security camera system for your AWS account — it records who did what, when, and from where. When an S3 bucket gets deleted at 2 AM and nobody claims responsibility, CloudTrail is how you find out which access key made the call and from which IP address. It is non-negotiable for any production AWS environment. What You’ll Learn:
  • CloudTrail event types and structure
  • Trail configuration and multi-region setup
  • CloudTrail Lake for advanced querying
  • CloudTrail Insights for anomaly detection
  • Security investigation workflows

How CloudTrail Works


Event Types

Management Events

Operations on AWS resources (control plane):

Data Events

Operations on data within resources:

Insights Events

Unusual API activity detection:

Event Structure


Creating a Trail

Multi-Region Trail

CloudFormation


CloudTrail Lake

Create Event Data Store

CloudTrail Lake is a managed data lake purpose-built for CloudTrail events. Instead of the old workflow (S3 -> Athena -> query), Lake lets you run SQL queries directly against your events. The trade-off: Lake costs more per GB than S3+Athena for large volumes, but eliminates the operational overhead of maintaining Glue tables, partitions, and Athena workgroups. For teams without a dedicated data platform, Lake is usually the right choice.

Query with SQL


CloudTrail Insights

Enable Insights

Insights Event Example


Security Monitoring

CloudWatch Alarms

EventBridge Rules


Investigation Workflow


Best Practices

Enable Multi-Region

Attackers may target regions you don’t actively use

Log Validation

Enable log file integrity validation for forensics

Use Lake

CloudTrail Lake enables SQL queries without S3/Athena setup

Enable Insights

Detect unusual API activity patterns automatically

Security Checklist


🎯 Interview Questions

Management Events (Control Plane):
  • Operations on AWS resources
  • CreateBucket, DeleteUser, StartInstances
  • Logged by default
  • Lower volume
Data Events (Data Plane):
  • Operations on data within resources
  • GetObject, PutObject, Invoke
  • Not logged by default (extra cost)
  • High volume
  1. Identify compromised credentials: Find the access key or role
  2. Timeline analysis: Query all events from that identity
  3. Source IP analysis: Check for unusual IPs or geolocations
  4. Resource access: Identify what was accessed/modified
  5. Lateral movement: Check for AssumeRole or CreateAccessKey
  6. Scope assessment: Determine if other accounts affected
Use CloudTrail Lake SQL queries for efficient analysis.
  1. Enable log file validation: Creates digest files with hashes
  2. KMS encryption: Encrypt logs at rest
  3. S3 bucket policy: Prevent deletion/modification
  4. Object Lock: Enable S3 Object Lock for immutability
  5. Cross-account: Store logs in separate security account
  6. MFA Delete: Require MFA for log deletion

Hands-On Lab

1

Create Organization Trail

Set up multi-region trail with encryption and validation
2

Enable Data Events

Configure S3 and Lambda data event logging
3

Set Up CloudTrail Lake

Create event data store and run sample queries
4

Create Alarms

Set up CloudWatch alarms for root account usage
5

Investigate

Use CloudTrail Lake to investigate a simulated incident

Next Module

AWS Config

Configuration compliance and change management