Welcome to Day 28 of the 30 Days AWS Security Challenge. We've spent 27 days on prevention and detection, but even the best setup can't guarantee something never goes wrong. Today we talk about what to actually do when it does, calmly and methodically, rather than in a panic.
Why You Need a Plan Before You Need It
The worst time to figure out your incident response process is during an actual incident. If the first time you think about who has access to what, how to isolate a resource, or who needs to be notified is while something is actively happening, you'll make slower and worse decisions under pressure. A written plan, even a simple one, turns a stressful, ambiguous situation into a series of known steps.
The Four Broad Phases
Most incident response, on AWS or anywhere else, follows a similar shape:
- Detection, recognizing that something is actually happening
- Containment, stopping the situation from getting worse
- Eradication and recovery, removing the cause and restoring normal operation
- Post incident review, understanding what happened and improving for next time
Detection: You've Already Built This
If you've followed this challenge in order, detection is largely covered already. GuardDuty (Day 15) flags suspicious activity, Security Hub (Day 17) consolidates findings, and CloudTrail (Day 14) gives you the detailed record to investigate once something is flagged. Incident response doesn't start from nothing, it starts from an alert generated by tools you've already set up.
Containment: Stop the Bleeding First
Once you know something is wrong, the immediate priority is limiting further damage, not necessarily fully understanding the root cause yet. On AWS, common containment actions include:
- Isolating a compromised EC2 instance by changing its Security Group to deny all traffic, rather than terminating it immediately, since you may need it later for investigation
- Disabling or rotating credentials for a compromised IAM user or access key
- Revoking active sessions tied to a compromised role
- Temporarily tightening an SCP (from Day 7) across an Organizational Unit if the incident spans multiple accounts
A useful principle here: contain first, investigate second. It's tempting to want to fully understand what happened before acting, but every minute spent investigating while an attacker still has access is a minute they can keep going.
Eradication and Recovery: Fix the Actual Cause
Once contained, the next step is figuring out and removing the actual root cause, whether that's a leaked credential, a vulnerable dependency, or a misconfigured resource, and restoring affected systems to a known good state. This is where the detailed record from CloudTrail becomes essential, letting you trace exactly what the compromised identity or resource actually did, so you know what else might need to be checked or restored, not just the entry point itself.
Recovery might mean restoring from a clean backup, redeploying from a known good container image, or rotating every credential the compromised identity had access to, not just the one that was obviously compromised.
Post Incident Review: The Step Most Teams Skip
After things are back to normal, it's tempting to just move on. Don't skip this step. A blameless post incident review asks what happened, why existing controls didn't catch it earlier, and what specific changes would prevent a similar incident going forward. This is also where you feed lessons back into the practices from this entire challenge, maybe a Config Rule needs to be added, maybe an IAM policy was broader than it needed to be, maybe a GuardDuty finding was seen but not acted on quickly enough.
Building a Simple Runbook
You don't need an elaborate document to start. A basic incident response runbook should cover: who gets notified and how, which AWS accounts and resources are considered critical, the specific console steps for common containment actions like isolating an instance or rotating a key, and who has authority to make decisions during an active incident. Even a single page covering these basics is far better than figuring it out from scratch mid incident.
A Practical Example
Say GuardDuty flags an EC2 instance communicating with a known malicious IP. Following a basic runbook, the on call engineer immediately changes that instance's Security Group to block all traffic, contains the situation, then uses CloudTrail to trace what the instance's IAM role actually accessed during the suspected compromise window. Credentials tied to that role are rotated, the instance is replaced from a clean image rather than trusted again, and a post incident review afterward identifies that the original vulnerability came from an outdated dependency Inspector had already flagged three weeks earlier but nobody had prioritized.
Key Takeaways
- Build your incident response plan before you need it, not during an active incident
- Detection largely comes from tools you've already set up throughout this challenge, like GuardDuty and CloudTrail
- Contain first, investigate second, since stopping ongoing damage takes priority over full understanding
- Use CloudTrail's detailed record during recovery to understand the full scope of what was accessed
- Always run a blameless post incident review and feed what you learn back into your existing controls
Tomorrow we look at how everything in this challenge maps to formal compliance programs like SOC 2, HIPAA, and PCI DSS.
Loading article