Lesson 3 of 6 Incident Response and Forensics

Collecting Forensic Evidence and Finding the Root Cause

This lesson explains how evidence collection and investigation establish what happened, how the attacker got in and how far they went, while preserving the integrity of the evidence.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain the order in which volatile and persistent evidence is collected.
  • Move and protect evidence in a separate forensics account.
  • Describe how Amazon Detective speeds up investigations.
  • Explain how an incident is traced back to its root cause.

Collecting evidence

Forensic evidence is volatile. Memory is lost when an instance stops, logs may be rotated or deleted by an attacker, and every action a responder takes on a running system changes it. Evidence is therefore collected in order of volatility, starting with memory and running processes, and before containment actions such as stopping the instance destroy it. Each item must be documented so that its integrity can be demonstrated later. The following list describes the types of evidence to collect.

  • EBS snapshots of affected volumes.
  • Memory, captured with tools run through Systems Manager before shutdown.
  • Instance metadata, console output and screenshots.
  • Logs: CloudTrail, flow logs, DNS logs, application logs.

Record who collected what and when: the chain of custody.

The following diagram follows evidence from a compromised instance's volume into a separate forensics account.

Moving evidence encrypted with aws/ebs, which cannot be shared. The responder snapshots the volume, copies the snapshot re-encrypted with a customer managed key the forensics account may use, and shares the copy; the analyst attaches a volume from it read-only to an isolated instance and records SHA-256 hashes.
The scenario is illustrative.
Put in order

Order of volatility

Exam skills 2.2.1

Arrange evidence collection from the most volatile to the least volatile.

Log in to try this activity Interactive activities are free with an account.

Moving and protecting evidence

Evidence should be analysed in a separate forensics account, away from the compromised environment and any attacker who may still have access to it. Moving evidence between accounts raises two problems: encrypted snapshots can be shared only if the receiving account can use the key, and the evidence must be stored so that it cannot be altered. The following list describes the relevant practices.

  • Snapshots encrypted with the AWS managed aws/ebs key cannot be shared: copy them re-encrypted with a customer managed key the forensics account can use, then share.
  • Store files in S3 with Object Lock and versioning, and record hashes.
Spot the bug

A snapshot that cannot be shared

Exam skills 2.2.1

Find the lines that stop this evidence snapshot from reaching the forensics account.

Log in to try this activity Interactive activities are free with an account.

Amazon Detective

Investigating a finding manually means querying several log sources and piecing together what an identity or resource did over time. Amazon Detective does this automatically. It ingests CloudTrail management events, VPC Flow Logs, GuardDuty findings and EKS audit logs, and builds a behaviour graph that links users, roles, IP addresses, instances and other entities. For each entity it shows a profile with timelines of activity, unusual API calls, new geolocations and changes from its normal behaviour. Finding groups collect related findings, possibly from several accounts, into one investigation. Detective helps answer how an incident happened and what else was affected; it does not detect threats itself, which is GuardDuty's role.

True or false

What Detective does

Exam skills 2.2.5

Check what Amazon Detective ingests and provides.

Log in to try this activity Interactive activities are free with an account.

Finding the root cause

Containing an incident without finding its root cause leaves the door open for the attacker to return. Root cause analysis traces the attacker's activity back to the initial access and forward to everything they touched, and then fixes the weakness that allowed the incident with lasting controls rather than one-off cleanup. The following list describes how to do so.

  • Trace activity by key, session, IP and time with Athena, Security Lake or, for existing customers, CloudTrail Lake; map it to MITRE ATT&CK.
  • Work back to initial access: leaked keys, a vulnerable app, misconfiguration or phishing.
  • Document a timeline and fix the cause with lasting controls (SCPs, detections, IaC changes, runbooks).
Sort into groups

Initial access or lasting fix?

Exam skills 2.2.5

Sort each item into the initial access vector found by root cause analysis or the lasting control that fixes it.

Log in to try this activity Interactive activities are free with an account.
Worked example

Moving an encrypted volume to the forensics account

The compromised instance's volume is encrypted with the AWS managed aws/ebs key, which cannot be shared. The responder snapshots it, copies the snapshot re-encrypted with a customer managed key that the forensics account may use, and shares the copy:

SNAP=$(aws ec2 create-snapshot --volume-id vol-0abc123 \
  --description "IR-2026-042 evidence i-0a1b2c3d" \
  --tag-specifications 'ResourceType=snapshot,Tags=[{Key=incident,Value=IR-2026-042}]' \
  --query SnapshotId --output text)
aws ec2 wait snapshot-completed --snapshot-ids $SNAP

COPY=$(aws ec2 copy-snapshot --source-region eu-west-1 --source-snapshot-id $SNAP --encrypted \
  --kms-key-id arn:aws:kms:eu-west-1:111111111111:key/forensics-share-key \
  --description "IR-2026-042 evidence (shareable)" --query SnapshotId --output text)
aws ec2 wait snapshot-completed --snapshot-ids $COPY
aws ec2 modify-snapshot-attribute --snapshot-id $COPY --attribute createVolumePermission \
  --operation-type add --user-ids 666666666666

In the forensics account, an analyst creates a volume from the shared snapshot, attaches it read-only to an isolated analysis instance, and records SHA-256 hashes of the disk image in the chain-of-custody log stored in an Object Lock bucket.

Check yourself

Which service investigates the context of a GuardDuty finding with the least effort?

Show answer

Amazon Detective.

Exam Tips

Remember for the exam

  • To investigate the context of a GuardDuty finding with the least effort, use Amazon Detective.
  • To share an encrypted snapshot with the forensics account, re-encrypt it with a customer managed key and grant access.
  • To make evidence immutable, use S3 Object Lock and record hashes.
  • Capture memory before shutting down the instance.
  • To group related findings into one investigation, use Detective finding groups.