This guide shows you how to publish CloudWatch alarms defined in AWS CDK to the Scaling AWS integration so that incidents open onDocumentation Index
Fetch the complete documentation index at: https://docs.scaling.cloud/llms.txt
Use this file to discover all available pages before exploring further.
OK → ALARM and auto-resolve on ALARM → OK.
If you set up alarms in the console or with Terraform instead, see Ingest CloudWatch Alarms. For an overview of the integration, see AWS CloudWatch.
Why both transitions matter
The integration opens an incident when an alarm transitions toALARM and resolves the matching incident when the same alarm transitions back to OK. If your CDK only wires the alarm action and forgets the OK action, CloudWatch never publishes the recovery transition to SNS — your incident stays open forever even after the underlying metric recovers.
This is the single most common CDK mistake when connecting alarms to Scaling. The patterns below avoid it by default.
Prerequisites
You should already have the AWS integration created in Scaling and the SNS topic + HTTPS subscription in place. If you don’t, follow the first four steps of Ingest CloudWatch Alarms and then come back here to wire your alarms. You’ll need:- An existing SNS topic subscribed to your Scaling webhook URL, with
SignatureVersion=2(Scaling rejects the SNS default of1). - A CDK app using
aws-cdk-libv2 (TypeScript). The snippets below were written againstaws-cdk-lib@^2.250.
Topic.fromTopicArn.
The same topic can carry both ALARM and OK notifications for many alarms — you do not need one topic per transition. One topic per Scaling component is the right granularity.
Approach A: cdk-monitoring-constructs
If you’re using cdk-monitoring-constructs (the MonitoringFacade / SLO-style API), wire the OK transition by passing both onAlarmTopic and onOkTopic to SnsAlarmActionStrategy. By default the strategy only sets onAlarmTopic.
monitorLambdaFunction, monitorApiGateway, monitorSqsQueue, custom metrics — inherits both topics. You configure the wiring once.
Approach B: raw aws-cdk-lib/aws-cloudwatch
If you build Alarm instances directly, call both addAlarmAction and addOkAction with the same SnsAction. Scattering those two calls everywhere is error-prone, so wrap them in a small helper and route every alarm through it:
Set severity from the alarm description
Scaling parses an optional severity marker from the alarm’sAlarmDescription field and uses it for the opened incident. The recognised prefixes are:
| Prefix | Incident severity |
|---|---|
[P1] | critical |
[P2] | high |
[P3] | medium |
[P4] | low |
high. The marker can appear anywhere in the description, but convention is to put it at the start so the level is obvious in CloudWatch too:
Verification
Aftercdk deploy, confirm the OK transition is actually wired before you trust the auto-resolve path.
Check the synthesized template
Run If
cdk synth and inspect the generated CloudFormation. Every AWS::CloudWatch::Alarm resource should have both AlarmActions and OKActions populated with your SNS topic ARN:OKActions is missing or empty on any alarm, that alarm’s incident will never auto-resolve.Confirm in the AWS console
Open any deployed alarm in the CloudWatch console. Under Actions, the In alarm and OK rows should both list your SNS topic. Insufficient data can be left empty — the integration ignores those notifications by design.
Force a transition end-to-end
Temporarily lower an alarm’s threshold (or trigger the underlying condition) so it transitions
OK → ALARM. Within a few seconds a new incident appears in Scaling on the mapped component. Restore the threshold so the alarm returns to OK — the open incident should auto-resolve.Common pitfalls
| Symptom | Cause |
|---|---|
| Incident opens but never auto-resolves | addOkAction / onOkTopic is missing on the alarm. CloudWatch isn’t publishing the recovery transition. |
Notifications rejected with topic_arn_mismatch | The integration is pinned to a different topic ARN than the one your CDK is publishing through. Pinning happens on the first valid SubscriptionConfirmation. Either point your CDK at the pinned topic, or delete and recreate the integration. |
| Subscription stays in “Pending confirmation” | Two common causes. (1) The topic still publishes SignatureVersion=1 — set signatureVersion: '2' on the Topic (or aws sns set-subscription-attributes on the existing subscription) and Scaling will accept the next confirmation. (2) The webhook URL has trailing whitespace or path encoding issues from a copy-paste — recreate the subscription cleanly from the topic ARN. |
Alarm spends time in INSUFFICIENT_DATA | Expected — the integration ignores INSUFFICIENT_DATA notifications by design, so you don’t need to suppress them. Configure treatMissingData based on your metric, not based on Scaling. |
| Same alarm opens multiple incidents | The original ALARM never recovered to OK (or OK actions aren’t wired). Subsequent re-evaluations don’t open new incidents while the previous one is still open, but a missed OK followed by an ALARM → ALARM re-deliver can look like it. Verify OKActions in CloudFormation first. |
Scaling enforces topic-ARN pinning per integration: the first valid delivery decides which topic ARN is allowed, and every subsequent delivery’s
TopicArn is checked against the pinned value. If you migrate to a new topic, recreate the integration so the pin can be re-set.