Connect AWS CloudWatch to Amonit
Amonit team · Updated
Short answer: subscribe your Amonit URL to the Amazon SNS topic that your CloudWatch alarms notify, using the HTTPS protocol. Amonit confirms the subscription itself. An alarm going to ALARM opens an alert, and going back to OK resolves it.
Set it up
- In Amonit, go to Integrations → AWS CloudWatch → Connect, pick the team that should be paged, and save. The integration’s page shows its URL.
- In the Amazon SNS console, go to Subscriptions → Create subscription. For the topic, use the one your alarms notify, or a new one. Set the protocol to HTTPS and the endpoint to the URL from Amonit. Leave raw message delivery off.
- Amonit confirms the subscription itself, and its status in the SNS console turns to Confirmed.
- In each alarm, under Notification, notify the topic for the ALARM state. Then use Add notification to notify it for the OK state too, so that recovery resolves the alert.
- Optional: tag an alarm with
priority=P1…P5. An untagged alarm opens P3.
What happens
CloudWatch sends (NewStateValue) |
Amonit |
|---|---|
| ALARM | Opens an alert titled “<alarm name>: <reason>”, with the alarm’s priority tag, or P3 if it has none. If the alert is already open, this counts as a repeat and doesn’t page again. |
| OK | Resolves the alert. |
| INSUFFICIENT_DATA | Ignored. |
- One alert per alarm. A log alarm with a
BYclause notifies once per contributor, and each contributor gets its own alert. - Other messages on the topic that aren’t alarms open a P3 alert, with the message’s subject and text.
- The alert goes to the integration’s team, and that team’s escalation policy decides who gets the push and the phone call.
Amonit reads the alarm format described in AWS’s docs: SNS HTTP/S message formats and the alarm notification schema.
Security
- Amonit checks the signature of every SNS message (signature versions 1 and 2). It fetches SNS’s certificate only from an
sns.<region>.amazonaws.comhost over HTTPS. An unsigned or altered message is refused with403, which is why raw message delivery can’t work. - The URL contains the integration’s token, and the token is still required. If it leaks, regenerate it on the integration’s page and subscribe the new URL.
- Amonit doesn’t pin the topic. Anyone with the URL could subscribe their own SNS topic to it, which the token already allows.
Limits
This setup follows AWS’s documentation. We haven’t yet run it against a live AWS account. If something doesn’t behave as described here, email [email protected].