# Runbooks

What to do when an alert arrives: 20 alerts, each with a runbook in five parts. **Symptoms** is what the email says. **Pre-checks** decide whether it is expected, using read-only sessions only. **Resolution** is the fix for each case, **post-checks** prove it worked and **rollback** says how to undo the fix. Each alert's facts (what it matches, the email line, where it runs) are read from its template when the site builds, so they can't drift from the code.

## Alert routing

| Route | Alerts | Runs in | Carried by |
| --- | --- | --- | --- |
| [Management account alerts](/wiki/runbooks/management/) | 8 | the management account, us-east-1 | SNS topic `hkb-master-alerts`, its own KMS key |
| [Member account security events](/wiki/runbooks/members/) | 7 | every member account, both Regions, forwarded to the `hkb-security-events` bus in Security | SNS topic `hkb-security-events`, its own KMS key |
| [Pipeline events](/wiki/runbooks/pipeline/) | 2 | Shared Services, us-east-1 | SNS topic `hkb-pipeline-events`, its own KMS key |
| [Cost alerts](/wiki/runbooks/cost/) | 3 | the management account | AWS Budgets and Cost Anomaly Detection, by email |

Each topic has one email subscription, whose address is a parameter and never in the repository. Member events take one extra hop: each member's rules put them on the `hkb-security-events` bus in the Security account through the `hkb-events-forwarder` role, and the bus's one rule, `hkb-alert-security-events`, emails all of them.

## Alert index

| Alert | Fires on |
| --- | --- |
| [`hkb-alert-root-console-login`](/wiki/runbooks/management/hkb-alert-root-console-login/) | Any root user console sign-in, successful or not |
| [`hkb-alert-assume-root`](/wiki/runbooks/management/hkb-alert-assume-root/) | sts:AssumeRoot (centralized root sessions into member accounts) |
| [`hkb-alert-org-policy-change`](/wiki/runbooks/management/hkb-alert-org-policy-change/) | Organizations policy attach, detach, update or delete (SCPs, RCPs and others) |
| [`hkb-alert-route53domains-change`](/wiki/runbooks/management/hkb-alert-route53domains-change/) | Any state-changing Route 53 Domains call |
| [`hkb-alert-identity-center-change`](/wiki/runbooks/management/hkb-alert-identity-center-change/) | Identity Center permission set and assignment changes |
| [`hkb-alert-controltower-landing-zone`](/wiki/runbooks/management/hkb-alert-controltower-landing-zone/) | Control Tower landing zone create, update, reset or delete |
| [`hkb-alert-masteradmin-console`](/wiki/runbooks/management/hkb-alert-masteradmin-console/) | Console sign-in as the HKB-MasterAdmin permission set (full admin on master) |
| [`hkb-alert-masteradmin-writes`](/wiki/runbooks/management/hkb-alert-masteradmin-writes/) | Direct write API calls (CLI or console) by an HKB-MasterAdmin session in us-east-1 and global services |
| [`hkb-forward-root-signin`](/wiki/runbooks/members/hkb-forward-root-signin/) | Any root user console sign-in, successful or not |
| [`hkb-forward-iam-high-risk`](/wiki/runbooks/members/hkb-forward-iam-high-risk/) | IAM users, access keys and login profiles, and removing or editing an hkb boundary (the calls the boundaries deny) |
| [`hkb-forward-cloudtrail`](/wiki/runbooks/members/hkb-forward-cloudtrail/) | CloudTrail stop, delete and update |
| [`hkb-forward-guardduty`](/wiki/runbooks/members/hkb-forward-guardduty/) | GuardDuty detector and member changes |
| [`hkb-forward-guardduty-findings`](/wiki/runbooks/members/hkb-forward-guardduty-findings/) | GuardDuty findings of High or Critical severity (7 or higher), from every account |
| [`hkb-forward-site-cutoff`](/wiki/runbooks/members/hkb-forward-site-cutoff/) | The site cutoff function disabling the site distribution |
| [`hkb-forward-site-cutoff-errors`](/wiki/runbooks/members/hkb-forward-site-cutoff-errors/) | The site cutoff function failing |
| [`hkb-pipeline-approval`](/wiki/runbooks/pipeline/hkb-pipeline-approval/) | Approval requested, granted or rejected in the pipeline |
| [`hkb-pipeline-failed`](/wiki/runbooks/pipeline/hkb-pipeline-failed/) | A pipeline execution failed |
| [`hkb-org-monthly`](/wiki/runbooks/cost/hkb-org-monthly/) | Monthly cost budget of $150: forecasted over 50%, forecasted over 80%, forecasted over 100%, forecasted over $200, actual over 100%, actual over $200 |
| [`hkb-sandbox`](/wiki/runbooks/cost/hkb-sandbox/) | Monthly cost budget of $30: actual over 50%, actual over 100%, forecasted over 100% |
| [`hkb-org-anomaly-email`](/wiki/runbooks/cost/hkb-org-anomaly-email/) | Cost anomalies with a total impact of $5 or more, summed daily |

## Common pre-checks

1. Read before changing anything. Every pre-check runs as HKB-ReadOnly, through the `ro-hkb-master` profile for the management account and `ro-<account>` for a member (`ro-hkb-security`, for one).
2. Find the event in CloudTrail by its name and time. Many alerts match attempts as well as successes, so read `errorCode` first: `AccessDenied` usually means a guardrail stopped the call.
3. Match it to a change: an open change set, a manual step from the [rebuild guide](/wiki/rebuild/), or a pipeline run. Most alerts during a reviewed change are expected.
4. Fix from the repository. Stacks are restored by a stack update or a pull request, never by editing a resource by hand, and the control tests (`verify/hkb-verify.sh`) are the last post-check.

## Not alerted, by design

Two things are found by review rather than by email:

- **Medium and Low GuardDuty findings.** Only High and Critical findings are emailed (DQ-112). The rest stay in the Security account's consoles; the [findings runbook](/wiki/runbooks/members/hkb-forward-guardduty-findings/) covers reviewing them too.
- **Guardrail denials in general.** A denial is alerted only when the denied call is one a rule watches (IAM users and keys, boundaries, CloudTrail, GuardDuty). Other `AccessDenied` events stay in CloudTrail.

## Without an alert

- [Guardrail denial (AccessDenied)](/wiki/runbooks/guardrail-denial/): a call stopped by an organization policy or a boundary, alerted or not.
