Overview
CloudWatch publishes alarm transitions to an SNS topic. A Lambda subscribed to that topic converts the notification into aciona.me’s canonical format and posts it to the alert source.Prerequisites
- AWS permission to create SNS topics, Lambda functions and modify alarms.
- A service created in aciona.me and linked to a team with an active schedule.
1. Create the alert source in aciona.me
Under Alert sources, create a source of type CloudWatch. Copy the URL and the token.2. Create the SNS topic
3. Deploy the transform Lambda
Runtime Node.js 20+, handlerindex.handler, no external dependencies.
Environment variables:
IAM role:
AWSLambdaBasicExecutionRole.
Lambda code
Lambda code
index.mjs
4. Subscribe the Lambda to the topic
aws:SourceAccount and, where possible, aws:SourceArn, so only CloudWatch in your account can publish.
5. Configure the alarm with AlarmActions and OKActions
6. Test
How fields are translated
CloudWatch has no native severity. The Lambda resolves an alias in layers:
- A marker in
AlarmDescription:[severity:critical] - A keyword in the alarm name (
critical,high,warningorinfo) - Default:
warning
Troubleshooting
The incident opens but never closes
The incident opens but never closes
The alarm has no
OKActions pointing at the SNS topic. Add it with put-metric-alarm --ok-actions.Nothing arrives in aciona.me
Nothing arrives in aciona.me
Check, in this order: the Lambda’s subscription to the topic is confirmed; the Lambda logs in CloudWatch Logs;
ACIONA_INGRESS_URL and ACIONA_TOKEN are correct; the Lambda has internet egress (inside a VPC it needs a NAT).Wrong service on the incident
Wrong service on the incident
Adjust the alarm dimensions, or create a service in aciona.me matching the name the Lambda derives. See the
extractServiceHint function in the code.Severity always warning
Severity always warning
Add
[severity:critical] to the AlarmDescription or include the keyword in the alarm name.