Research · Cloud Security

Building an AWS Security Detection Lab with CloudTrail and GuardDuty

14 min read By Sushil Ojha
AWSCloudTrailGuardDutyEventBridge

Cloud breaches rarely begin with a Hollywood exploit. More often they begin with a key that lived too long, a role that trusted too widely, or an API call nobody was watching. AWS gives you extraordinary visibility — CloudTrail, GuardDuty, EventBridge, CloudWatch — and then politely waits to see whether you will wire them into a detection habit or leave them as expensive decoration.

This write-up sketches a practical detection lab: enough architecture to investigate suspicious activity with confidence, without pretending a weekend project replaces a mature SOC. The point is muscle memory — ingest, detect, route, investigate, improve.

Design goals for a lab that teaches real habits

  • Capture management-plane activity that matters (IAM, STS, S3 policy changes, security group edits)
  • Use managed detection where it is strong (GuardDuty) instead of re-implementing commodity findings poorly
  • Route alerts to humans with context — not only to a ignored SNS topic
  • Practice investigation: actor, resource, API history, blast radius, containment
  • Document what you would promote to production controls and evidence

Baseline architecture

  1. CloudTrail — multi-region trail to a dedicated logging bucket with tight access and lifecycle rules
  2. GuardDuty — enabled in lab accounts; findings represent high-signal starting points
  3. EventBridge — rules that match GuardDuty findings and selected CloudTrail events
  4. Notification / ticketing — SNS email for the lab; webhook or queue later
  5. Investigation notes — a simple runbook template you fill every time

Optional but valuable: CloudWatch Logs metric filters for specific API calls, AWS Config for drift, and IAM Access Analyzer for unintended sharing.

What to alert on first (resist boiling the ocean)

  • Root login and unexpected console logins
  • IAM user / access key creation, policy changes, role trust edits
  • Disablement of CloudTrail, GuardDuty, or logging buckets
  • Security group rules opening broad ingress
  • Suspicious S3 access patterns and public ACL/policy changes
  • GuardDuty findings for credential compromise and instance compromise

Breadth comes later. First prove you can wake up, understand one alert, and take a containment step without guessing.

Investigation workflow

  1. Alert received with finding type and resource ARN
  2. Identify actor: IAM user, role session, or assumed-role chain
  3. Pull CloudTrail around the event window — before and after
  4. Enumerate reachable resources and sensitive data exposure
  5. Contain: disable keys, revoke sessions, isolate instances, restore policies
  6. Record timeline, impact, and detection gaps for the next lab iteration

Lab exercises worth repeating

  • Create a temporary access key, use it oddly, watch GuardDuty / Trail correlation
  • Modify a bucket policy toward public access and ensure the alert path fires
  • Simulate disabling CloudTrail (in a disposable account) and verify fail-safe notifications
  • Assume a role across accounts and trace the session in logs

Always use disposable accounts and guardrails. A detection lab that becomes your production account is a cautionary tale, not a curriculum.

Promoting lab lessons to production

  • Centralize trails into a security logging account with immutable storage patterns
  • Encode EventBridge rules as infrastructure-as-code
  • Feed findings into the real ticketing / IR process with severity mapping
  • Measure MTTA on cloud identity findings the way you would on endpoint malware
  • Keep evidence: configs, sample tickets, and tuning decisions for SOC 2 / ISO monitoring narratives

Closing thought

Cloud detection is not about collecting every log on earth. It is about routing the right signals into investigation workflows and proving you can respond. CloudTrail plus GuardDuty plus EventBridge is a credible baseline that scales before heavy SIEM integration. Build the habit in a lab, then harden it in production — with owners, runbooks, and evidence that survives an audit and an incident alike.

← Work & Write-ups