Incident Response & Playbooks
The playbook you hope never to use properly
IR is a game plan for being attacked, not a wish: detection → containment → eradication → recovery → lessons. Cloud IR leans on native speed: isolate resources, snapshot evidence, revoke keys, restore from immutable snapshots, and quarantine the attack path.
What you will learn
- Structure an IR loop (detect→contain→eradicate→recover→learn)
- Use cloud-native containment (SG quarantine, snapshot, key revoke)
- Draft and rehearse playbooks per severity class
A good IR loop keeps scope small and impact contained while later phases rebuild. In the cloud that translates to concrete knobs: deny traffic via NACL/SG, detach credentials, snapshot the moment, restore from versioned backup, and capture CloudTrail before touching anything.
What is this?
Phases: detect (Alerting/SIEM), triage (severity, blast radius), contain (killner traffic/network/keys), eradicate (remove the mechanism), recover (restore capacity/data), lessons (retro, controls). Cloud levers: stop instances, revoke IAM/keys (rotate before disable), detach/disable access keys, SG/NACL quarantine, snapshot EBS/volumes/TFS for forensics, object-lock the audit bucket, restore from immutable backup, change passwords/rotate all creds. Evidence: CloudTrail timestamps, instance/volume snapshot, memory/RAM-disk images, DNS/log forensics. Posture: prep (playbooks, runbooks, RACI, war-room channel), drills quarterly, IR tooling (SSM forensics scripts, incident-env workflows).
Why do you need it?
- Incidents are events with timers; playbooks remove the 'what do I do' paralysis.
- Cloud containment levers act in seconds, but only if you know which one to pull.
- Snapshotting before reclaiming preserves the story for root-cause.
- A rehearsed drill is the only way playbooks behave as expected at 3am.
Mental model
A fire drill: alarm (detect), isolate the floor (contain), remove the cause (eradicate), rebuild (recover), and chart the drill (lessons)
Incident response lifecycle
You don't wait for the inspector to teach you the exit route — you rehearse it, and the post-mortem improves the next drill.
How it works
- Detection triggers from GuardDuty/Defender/audit-alerts → IR channel.
- Triage confirms real attack + scope; the war room opens; RACI invoked.
- Containment: quarantine in minutes (network isolation, key revoke) before scale-out.
- Eradication: remove the access/implants; snapshot evidence first.
- Recovery: restore from trusted backups + build-time; audit keeps forensic chain; retro updates controls.
IR loop.
Examples
Containment commands at the border
# 1) quarantine network (IAM-widest deny)aws ec2 create-network-acl ... # deny all egress/ingress on suspicious subnets# 2) snapshot evidence before mutationaws ec2 create-snapshot --volume-id <vol-id> --description "IR-SNAPSHOT-<ts>:preserve"# 3) rotate keys (not just delete): create new, migrate, delete old# 4) object-lock audit trail:aws s3api put-object-legal-hold --bucket sec-logs --key trail.gz --legal-hold {'Status':'ON'}Seconds to isolate, evidence preserved, credentials rotated, audit sacrosanct — the IR first-15-minutes checklist.
In production
- War-room channel + playbook per severity; on-call triggered from detection findings.
- Forensic vault: spot-instance snapshots + audit lock for retrospective reconstruction.
- Quarterly tabletop with fake cloud incident: team walks detection→contain→recover without breaking prod.
Best practices
- Rehearse playbooks; a playbook nobody has run is a checklist someone will improvise at 3am.
- Snapshot twice: one permissive-forensic, one operational-restore — separate concerns.
- Rotate everything credential when containment begins (compromise scope unknown).
- Capture CloudTrail + key logs before killing the instance (evidence dies with the box).
- Blameless retro: controls, not culprits, are the output.
Common mistakes
- Ordering 'delete and ignore' — that's how the same hole reopens next quarter.
- Containing by killing the instance before evidence capture.
- No rehearsal: playbooks exist in a doc nobody opened.
- Fixing the symptom (IP blocked) while the credential/footprint persists.
Debugging tips
- Alert that's actually benign → annotate and hit the 'why' before silencing (recurrence = new attack path).
- Containment rule didn't apply → test the NACL/SG route + source/dest checks at drill time.
- Restore spike fails → backup immutability/config mismatch; test a cold restore quarterly.
- Forensic chain gaps → correlate CloudTrail window with the incident env timeline.
Interview checkpoint
Hands-on lab
- Define a war-room channel + RACI
- Rehearse contain-recover commands against a fake compromise
- Produce the forensic + containment checklist
Tabletop the First 15 Minutes
45 min · advanced
Quick quiz
Before killing a compromised instance you must:
The output of a good retro is: