Lesson 5 of 7 Operational Excellence and Observability

Automating Runbooks and Incident Response

This lesson explains Systems Manager Automation runbooks, the events and schedules that trigger them, and how automation fits into an incident response process.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe what an Automation runbook can do and how it runs across accounts.
  • Identify triggers for patching, remediation, recovery and scaling runbooks.
  • Outline an incident response process supported by automation.

Systems Manager Automation runbooks

An Automation runbook is a document of steps that call AWS APIs, run scripts on instances, wait, branch on results and request approval. AWS provides hundreds of runbooks, such as AWS-RestartEC2Instance, AWS-PatchInstanceWithRollback and runbooks that disable public access to S3 buckets or security groups, and teams write their own. Runbooks run in one account or across accounts and Regions from a central account, with rate control (maximum concurrency and maximum errors), and every execution is logged for audit.

Triggers and incident tracking

Runbooks are started in several ways: EventBridge rules on alarms, findings and AWS service events; AWS Config remediation for non-compliant resources; maintenance windows and Patch Manager patch policies for scheduled patching; Auto Scaling lifecycle hooks; and operators who run the runbook linked to an OpsCenter OpsItem, which collects the related alarms, resources and history of an operational issue. Systems Manager Incident Manager is closed to new customers, so on-call paging and escalation use partner tools integrated through SNS or EventBridge.

Operational taskTriggerExample runbook action
PatchingPatch policy or maintenance windowPatch with rollback, in batches
RemediationConfig rule or Security Hub CSPM findingEnable encryption or block public access
RecoveryCloudWatch alarm through EventBridgeRestart a service or replace an instance
ScalingSchedule or eventRaise capacity before an announced event
Put in order

From alarm to runbook

Exam skills 5.4.5 · 5.3.4

Put the steps of an automated incident response in order.

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

Incident response practice

  1. Detect

    Alarms, anomaly detection, canaries and findings signal a problem.

  2. Triage

    An OpsItem or paging tool gathers context; the responder chooses the runbook.

  3. Respond

    Automation runs the fix, with approval for risky steps.

  4. Recover and verify

    Metrics confirm recovery; rollback steps run if not.

  5. Learn

    A post-incident review updates runbooks, alarms and automation.

Worked example

Hung application processes

A Java application on 600 instances hangs every few days, and engineers restart the process by hand, sometimes at night.

A CloudWatch alarm on the application's health check publishes to EventBridge, which starts a custom runbook that captures a thread dump to S3, restarts the process and checks the health endpoint, creating an OpsItem if the restart does not help.

Rate control allows at most ten instances at a time and stops after five failures, and an approval step is required if more than 50 instances are affected, which signals a systemic problem rather than a single hung process.

Check yourself

Which service starts an Automation runbook automatically when a CloudWatch alarm changes state?

Show answer

Amazon EventBridge, with a rule that matches the alarm state change event and targets the runbook.

Exam Tips

Remember for the exam

  • Automated, repeatable fixes on alarms: EventBridge rule that starts a Systems Manager Automation runbook.
  • Fix non-compliant resources automatically: Config remediation with a runbook.
  • Track operational issues with context: OpsCenter OpsItems.
  • Incident Manager is closed to new customers; use partner paging tools for escalation.