AWS CloudWatch alarms can drive Alert24 service status updates through SNS. When a CloudWatch alarm enters ALARM state, your Alert24 service flips to down automatically — and recovers to operational when the alarm clears.
Step 1: Create a webhook receiver in Alert24
- Go to Settings → Webhook Receivers → Add receiver
- Name it (e.g., "CloudWatch — API Gateway")
- Link it to the Alert24 Service you want to update
- Set Status field path to
state - Set Status mapping:
operational → OK degraded → INSUFFICIENT_DATA down → ALARM - Enable Auto-create incidents if desired
- Save and copy the webhook URL
Step 2: Lambda transform function
CloudWatch → SNS sends a format Alert24 doesn't natively parse. A small Lambda normalizes it:
import json, urllib.request, os
WEBHOOK_URL = os.environ['ALERT24_WEBHOOK_URL']
def lambda_handler(event, context):
for record in event.get('Records', []):
msg = json.loads(record['Sns']['Message'])
payload = {
'state': msg.get('NewStateValue'), # OK / ALARM / INSUFFICIENT_DATA
'alarm': msg.get('AlarmName'),
'reason': msg.get('NewStateReason'),
'source': 'cloudwatch',
}
data = json.dumps(payload).encode()
req = urllib.request.Request(
WEBHOOK_URL,
data=data,
headers={'Content-Type': 'application/json'},
method='POST'
)
urllib.request.urlopen(req)
return {'statusCode': 200}
Set ALERT24_WEBHOOK_URL as a Lambda environment variable.
Step 3: Wire it up
# Create the Lambda (assumes you've zipped the function)
aws lambda create-function \
--function-name alert24-status-webhook \
--runtime python3.12 \
--handler lambda_function.lambda_handler \
--zip-file fileb://function.zip \
--role arn:aws:iam::ACCOUNT:role/lambda-basic-execution \
--environment Variables={ALERT24_WEBHOOK_URL=https://app.alert24.net/api/webhooks/incoming/YOUR_TOKEN}
# Subscribe the Lambda to your SNS topic
aws sns subscribe \
--topic-arn arn:aws:sns:us-east-1:ACCOUNT:cloudwatch-alerts \
--protocol lambda \
--notification-endpoint arn:aws:lambda:us-east-1:ACCOUNT:function:alert24-status-webhook
# Grant SNS permission to invoke Lambda
aws lambda add-permission \
--function-name alert24-status-webhook \
--statement-id sns-invoke \
--action lambda:InvokeFunction \
--principal sns.amazonaws.com \
--source-arn arn:aws:sns:us-east-1:ACCOUNT:cloudwatch-alerts
Tips
- One SNS topic, multiple services: Route alarms from multiple CloudWatch alarms through one SNS topic, but use separate Lambda environment variables (or separate Lambda functions) per Alert24 service.
- Auto-recovery: CloudWatch sends an
OKnotification when an alarm returns to OK state. The Lambda forwards this asstate: OK, which maps tooperationalin Alert24 — your status page auto-recovers. - vs. incident ingest: This guide updates service status (operational/degraded/down). The CloudWatch incident ingest guide creates trackable incidents. Use both for complete coverage.