Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 38 ยท Monitoring and Detection

Cloud Incident Response

Learn how to respond to a cloud security incident: preparation, detection, containment, evidence, eradication, recovery and lessons learned, with a timeline-building exercise.

An incident is any event that threatens the confidentiality, integrity or availability of your systems or data: a leaked access key, ransomware on a virtual machine, a public database or a compromised admin account. No matter how good your prevention is, one will eventually happen. What separates a small incident from a disaster is usually how well you prepared and how calmly and systematically you respond.

Cloud incident response follows the same phases as the classic NIST model, but the tools differ. Instead of unplugging a cable, you revoke a credential, change a security group or snapshot a disk through an API. Evidence is in logs and snapshots rather than on a seized server. This lesson walks through the phases, then lets you practise the most important analysis skill: building a timeline and estimating the blast radius from audit logs.

Respond only in environments you are authorised to manage. If you suspect an incident in a system you do not own, report it to the owner instead of investigating it yourself.

The incident response lifecycle

flowchart LR
    P["1. Prepare"] --> D["2. Detect and analyse"]
    D --> C["3. Contain"]
    C --> E["4. Eradicate"]
    E --> R["5. Recover"]
    R --> L["6. Learn"]
    L --> P

Lessons learned feed back into preparation, so each incident makes the next one smaller.

1. Prepare

Most of the work happens before anything goes wrong:

  • Write a short incident response plan with roles (incident commander, communications, technical lead), contact lists and escalation rules.
  • Have pre-approved break-glass accounts with strong MFA and an audited process for emergency access.
  • Make sure logging is on and centralised (see cloud logging and audit trails).
  • Prepare runbooks for common cases: leaked key, compromised instance, public storage, ransomware, compromised user.
  • Practise with tabletop exercises and game days, and keep tooling ready (a forensics account, snapshot automation, known-good images).

2. Detect and analyse

An alert or an outside report starts the process (see alerting and SIEM). Triage: is it real, how severe is it, what is affected? Record every action and its time in a shared incident log from the very first minute. Establish the scope: which identities, resources, regions and data are involved.

3. Contain

Containment stops the damage from growing while keeping evidence. Prefer reversible, targeted actions:

Situation Containment examples
Leaked access key Deactivate (do not yet delete) the key; revoke active sessions; add a deny policy
Compromised user Disable sign-in, reset credentials, revoke sessions and tokens, require MFA re-enrolment
Compromised instance Move it to an isolated security group with no traffic, snapshot the disks and memory if possible, do not terminate yet
Public storage Block public access, then review access logs for what was read
Malicious workload Scale to zero or cordon the node; keep the image and logs

Preserving evidence matters: snapshot before you change or delete anything, and never run recovery steps on the only copy of compromised data.

4. Eradicate

Remove the attacker's foothold: delete rogue users, roles, keys, functions and scheduled jobs; patch the vulnerability that let them in; rotate every secret the attacker could have seen. Attackers often create persistence (an extra access key, a trusted external role, a new federation provider), so search for changes made during the incident window.

5. Recover

Restore service from known-good sources: rebuild instances from clean images rather than "cleaning" them, restore data from backups made before the compromise, and re-enable access gradually. Monitor closely for signs of the attacker returning.

6. Learn

Within days, hold a blameless post-incident review: what happened, how it was detected, what worked, what slowed you down and what will change. Turn each finding into a tracked action, such as a new detection rule, a tighter permission or an updated runbook.

The skill that matters most: timelines and blast radius

Two questions drive nearly every investigation: what is the sequence of events? and what did the attacker reach? Both come from the audit log. The next exercise starts from a leaked key and reconstructs the story from invented events.

Python Build a timeline and blast radius from audit events

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The output reveals three important facts: data was read, a new user with a policy was created to keep access, and the activity came from a single unfamiliar address. Deleting only the original key would leave backup-svc as a backdoor. That is why eradication includes a hunt for persistence.

Cloud-specific tips

  • Automate containment for well-understood cases (for example, a function that quarantines an instance when a detection fires), but keep humans in the loop for high-impact actions.
  • Use infrastructure as code so you can rebuild quickly and compare the live state with the intended state.
  • Think about every region and account. Attackers like regions you never use.
  • Know your legal duties early: breach notification deadlines (for example under GDPR, 72 hours) can start when you become aware of a personal data breach. Involve legal and privacy staff; see data privacy and residency.
  • Talk to your provider when needed. Providers publish abuse and support contacts and can help with large-scale events.
  • Keep communications factual: who is affected, what you know, what you do not know yet and when the next update comes.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A leaked access key is found. What is the best first containment step?

    Deactivating the key stops further use but preserves it and the logs for the investigation. Deleting logs destroys evidence.
  2. 2. Why snapshot a compromised instance before terminating it?

    Disks and memory hold evidence about what the attacker did. Preserve it before changing the environment.
  3. 3. In the exercise, why is deleting only the original key not enough?

    The attacker used the key to create backup-svc. Eradication must remove persistence mechanisms too.
  4. 4. What is the purpose of a blameless post-incident review?

    Blameless reviews encourage honest information and lead to concrete changes in detections, permissions and runbooks.

Summary

  • Incident response has six phases: prepare, detect and analyse, contain, eradicate, recover and learn.
  • In the cloud, containment is an API call: disable credentials, isolate instances, block public access, and snapshot before you change things.
  • Build the timeline and blast radius from audit logs, and always look for persistence.
  • Rebuild from clean images and backups, rotate secrets and watch for the attacker's return.
  • Know your notification duties, communicate factually and feed the lessons back into your defences.

Next: Compliance Frameworks Overview