Lesson 4 of 6 Incident Response and Forensics

Automating Incident Response with EventBridge and Runbooks

This lesson explains how automation contains threats in seconds: findings become events, rules match them, and runbooks or functions take the first containment steps consistently every time.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the finding, rule and action pattern of automated response.
  • Identify the supporting tools for managing and recovering from incidents.
  • Decide which actions are safe to automate.
  • Trigger an isolation runbook from GuardDuty findings.

Finding, rule, action

Automated response follows a pattern: a finding from GuardDuty, Security Hub or another service reaches EventBridge, a rule matches it, and the rule starts a target. The target depends on the response. Lambda suits quick, single actions, such as disabling an access key or adding an IP address to a block list. Step Functions runs multi-step workflows, including waiting for human approval before a disruptive step. SSM Automation runbooks perform operations on instances, such as isolating one, snapshotting its volumes and collecting evidence.

Config remediation fixes non-compliant resources automatically, such as re-enabling bucket encryption. Security Hub custom actions let an analyst start a runbook on demand from a finding. The following table summarises the targets.

Action targetTypical use
LambdaDisable a key, block an IP address
Step FunctionsMulti-step workflows with human approval
SSM AutomationIsolate an instance, snapshot volumes, collect evidence
Config remediationFix non-compliant resources automatically
Security Hub custom actionsStart runbooks on demand from a finding

The following diagram follows a high-severity GuardDuty finding for an EC2 instance to an automated isolation runbook and its steps.

Isolation within a minute of a high-severity EC2 finding. An EventBridge rule matches GuardDuty findings of severity 7 or more on instances and passes the instance ID to a Systems Manager Automation runbook, which protects, detaches, isolates, snapshots and tags the instance without waiting for a person.
SG stands for security group.
Sort into groups

Which response target?

Exam skills 2.1.4

Choose the automation target for each response.

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

Supporting tools

Beyond EventBridge rules and Lambda functions, several tools help teams manage, investigate and recover from incidents consistently. They track incidents and related work, automate repetitive forensic steps, keep investigation analyses repeatable and move traffic away from impaired infrastructure during recovery. The following list describes them.

  • OpsCenter tracks incidents as OpsItems with related resources and runbooks.
  • Automated Forensics Orchestrator for Amazon EC2 (an AWS Solution) isolates instances and captures disk and memory automatically.
  • SageMaker AI notebooks hold repeatable investigation analyses.
  • Application Recovery Controller shifts traffic away from impaired Availability Zones or Regions.
Match the pairs

Tools that support response

Exam skills 2.1.1 · 2.1.4

Match each supporting tool with what it does during incidents.

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

What to automate

Automate frequent, well-understood and reversible actions, such as re-enabling S3 Block Public Access, revoking an exposed key or isolating an instance with a quarantine security group. Keep a person in the loop, through a Step Functions or Automation approval step, for disruptive production actions such as terminating instances or deleting resources.

Sort into groups

Automate fully or keep a person in the loop?

Exam skills 2.1.4

Decide whether each response action should run automatically or wait for approval.

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

An isolation runbook triggered by findings

High-severity EC2 findings should trigger isolation within a minute, without waiting for a person. An EventBridge rule matches the findings:

{
  "source": ["aws.guardduty"],
  "detail-type": ["GuardDuty Finding"],
  "detail": {
    "severity": [{ "numeric": [">=", 7] }],
    "resource": { "resourceType": ["Instance"] }
  }
}

The rule passes the instance ID to a Systems Manager Automation runbook:

aws events put-targets --rule gd-high-ec2 --targets '[{
  "Id": "isolate",
  "Arn": "arn:aws:ssm:eu-west-1:111111111111:automation-definition/IR-IsolateInstance:$DEFAULT",
  "RoleArn": "arn:aws:iam::111111111111:role/EventBridgeStartAutomation",
  "InputTransformer": {
    "InputPathsMap": { "instance": "$.detail.resource.instanceDetails.instanceId" },
    "InputTemplate": "{\"InstanceId\": [<instance>], \"AutomationAssumeRole\": [\"arn:aws:iam::111111111111:role/IRAutomation\"]}"
  }
}]'

The runbook enables termination protection, detaches the instance from its Auto Scaling group, swaps in the isolation security group, adds a NACL deny, snapshots volumes and tags everything with the finding ID.

Check yourself

Where can incidents be tracked together with their runbooks?

Show answer

In Systems Manager OpsCenter.

Exam Tips

Remember for the exam

  • To isolate an instance automatically on a GuardDuty finding, use EventBridge with Step Functions or SSM Automation.
  • To capture forensic evidence automatically, use Automated Forensics Orchestrator for Amazon EC2.
  • To track incidents with runbooks, use Systems Manager OpsCenter.
  • Security Hub custom actions start runbooks from a selected finding.
  • Keep human approval for disruptive production actions.