AWS CloudWatch Integration Guide
Send metric alarms through an SNS webhook.
Configure AWS CloudWatch alarms to send webhook notifications to Harness AI SRE using Amazon SNS with HTTPS subscription.
Before you begin
Harness webhook endpoint: Create an AWS CloudWatch webhook in Harness AI SRE using the AWS CloudWatch webhook template.
AWS permissions: Access to create SNS topics, CloudWatch alarms, and manage subscriptions.
Webhook URL: Copy the webhook URL from your Harness webhook configuration.
CloudWatch alarms documentation: Go to CloudWatch Alarms to understand alarm configuration.
SNS HTTPS subscriptions: Go to SNS HTTPS Subscriptions for subscription setup details.
Architecture overview
CloudWatch alarms to SNS topic to HTTPS subscription to Harness webhook.
CloudWatch does not send webhooks directly. Use Amazon SNS as an intermediary:
CloudWatch alarm state changes
Alarm publishes to SNS topic
SNS sends HTTPS POST to Harness webhook
Harness processes the alert
Create SNS topic
Navigate to SNS
Open the SNS topic creation page:
Open AWS Console and go to Simple Notification Service (SNS)
Click Topics, then click Create topic
Configure topic
Type: Standard
Name:
harness-ai-sre-alertsDisplay name:
Harness AI SRE AlertsEncryption: (Optional) Enable encryption at rest
Access policy: Default (allow publishers)
FIFO topics are not recommended for CloudWatch alarms as they require message group IDs.
Use Standard topic instead.
Save topic
Click Create topic and note the Topic ARN.
Create HTTPS subscription
Add subscription to topic
Start a new subscription from the topic details:
In the SNS topic details, click Create subscription
Configure subscription
Protocol: HTTPS
Endpoint: Your Harness webhook URL
Enable raw message delivery: Uncheck (keep message wrapper)
Redrive policy: (Optional) Configure DLQ for failed deliveries
Protocol: HTTPS
Endpoint: Your Harness webhook URL
Subscription filter policy: JSON filter to process only specific alarms
This filters to only production alarms in ALARM state.
Confirm subscription
Complete the subscription confirmation handshake:
Click Create subscription
SNS sends a confirmation request to your Harness webhook
Harness must respond with subscription confirmation
Note: Configure your Harness webhook to automatically confirm SNS subscriptions by responding to SubscribeURL in the payload.
Create CloudWatch alarm
Navigate to CloudWatch
Open the alarm creation page:
Open AWS Console and go to CloudWatch
Click Alarms, then click Create alarm
Select metric
Click Select metric
Select EC2, then select Per-Instance Metrics
Select CPUUtilization for your instance
Click Select metric
Conditions:
Threshold type: Static
Whenever CPUUtilization is...: Greater than
80Datapoints to alarm:
2 out of 2
Click Select metric
Select RDS, then select Per-Database Metrics
Select DatabaseConnections for your DB instance
Click Select metric
Conditions:
Threshold type: Static
Whenever DatabaseConnections is...: Greater than
100Datapoints to alarm:
3 out of 5
Click Select metric
Select Lambda, then select Per-Function Metrics
Select Errors for your function
Click Select metric
Conditions:
Threshold type: Static
Whenever Errors is...: Greater than
10Datapoints to alarm:
1 out of 1
Configure actions
In the Configure actions step:
Notification:
Alarm state trigger: In alarm
Send notification to: Select your SNS topic
harness-ai-sre-alerts
Additional actions: (Optional) Configure Auto Scaling or EC2 actions
Set alarm details
Name and describe the alarm:
Alarm name:
Production-EC2-HighCPUAlarm description:
EC2 instance CPU usage above 80%Treat missing data as: Choose appropriate option (default:
missing)
Create alarm
Click Create alarm.
Configure field mapping in Harness
In your Harness webhook configuration, map CloudWatch/SNS payload fields to alert properties.
CloudWatch alarm SNS payload structure
Note: The Message field contains a JSON string that must be parsed.
Basic field mapping example
CloudWatch alarm data is nested in the Message field as a JSON string. Use CEL to parse:
Advanced field mapping with CEL
Parse the nested JSON message:
Test the integration
Test with CloudWatch console
Manually set the alarm state to trigger a test notification:
Go to CloudWatch, then select Alarms
Select your alarm
Click Actions, then click Set alarm state
Select In alarm
Click Confirm
This manually triggers the alarm to test the integration.
Test SNS subscription
Verify in Harness
Confirm the alarm arrived and parsed correctly:
Navigate to Alerts in Harness AI SRE
Check that the alarm appears
Verify field mapping parsed the message correctly
Available CloudWatch alarm fields
Fields in the parsed Message JSON:
AlarmName
Alarm name
Production-EC2-HighCPU
AlarmDescription
Alarm description
EC2 instance CPU usage above 80%
AWSAccountId
AWS account ID
123456789012
NewStateValue
New alarm state
ALARM, OK, INSUFFICIENT_DATA
OldStateValue
Previous alarm state
OK, ALARM
NewStateReason
State change reason
Threshold Crossed: ...
StateChangeTime
When state changed
2025-07-01T10:10:00.000Z
Region
AWS region
US East (N. Virginia)
AlarmArn
Alarm ARN
arn:aws:cloudwatch:...
Trigger.MetricName
Metric name
CPUUtilization
Trigger.Namespace
Metric namespace
AWS/EC2
Trigger.Statistic
Statistic type
AVERAGE, SUM, MAXIMUM
Trigger.Dimensions
Metric dimensions
[{name: "InstanceId", value: "i-..."}]
Trigger.Period
Evaluation period (seconds)
300
Trigger.EvaluationPeriods
Number of periods
2
Trigger.Threshold
Alarm threshold
80.0
Trigger.ComparisonOperator
Comparison operator
GreaterThanThreshold
Advanced configuration
Filter by namespace
Only process specific AWS service alarms:
Route by region
Tag and route by AWS region:
Extract EC2 instance details
For EC2 alarms, extract instance ID:
Create composite alert messages
Combine multiple alarm details:
Troubleshooting
Example: complete integration
AWS SNS topic
This example uses the following SNS topic and subscription:
Name:
harness-ai-sre-alertsType: Standard
Subscription:
Protocol: HTTPS
Endpoint:
https://app.harness.io/gateway/ai-sre/api/webhooks/wh_abc123Status: Confirmed
CloudWatch alarm
This example uses the following alarm configuration:
Name:
Production-RDS-HighConnectionsMetric:
DatabaseConnectionsin theAWS/RDSnamespaceCondition: Greater than 100 for 3 out of 5 datapoints
Actions: Notify
harness-ai-sre-alertswhen in ALARM state
Harness webhook field mapping example
Next steps
Route alerts: Route and deduplicate CloudWatch alarms.
Use CEL in webhooks: Add JSON parsing and filtering.
AI agent: Enable automated alarm investigation.
AWS CloudWatch template: Use the pre-configured template.
Related documentation
AWS official documentation
CloudWatch alarms: Complete guide to CloudWatch alarm configuration and SNS integration.
SNS HTTPS subscriptions: HTTPS subscription setup and subscription confirmation process.
CloudWatch and EventBridge: CloudWatch alarm message format and payload structure.
SNS message formats: SNS notification wrapper and Message field structure.
Last updated
Was this helpful?