Configure notifications for observations
Notifications send observations to the tools your team uses: Slack, PagerDuty, or Amazon SNS. You add notification rules, and each rule sends matching observations to one destination. You get a notification when a new observation matches a rule, and another notification each time the severity of an active observation rises to or above the rule's minimum severity.
For example, you can page on-call in PagerDuty only for High observations of checkout, and send everything to the team Slack channel.
Before you begin
Observations must be on, and you need the Space Admin permission level. For API permissions, see Security in Observations.
| Destination | Setup | Permissions |
|---|---|---|
| Slack | Connect Slack and invite the Amazon CloudWatch app to the channel. | cloudwatch:InvokeIntegration on the Slack
integration |
| PagerDuty | Connect PagerDuty under Settings, Integrations. The service needs an Events API v2 integration. | cloudwatch:InvokeIntegration on the PagerDuty
integration |
| Amazon SNS | Use a standard topic in the same Region. For more information, see the following Amazon SNS setup section. | sns:GetTopicAttributes on the topic, and a
topic access policy that allows CloudWatch to call
sns:Publish. See Amazon SNS setup. |
Slack
CloudWatch posts a message in the channel with the severity, title, summary, up to three affected services, account, Region, and time. The message has a View this observation button and, where available, an Investigate button.
To send observations to Slack
-
Connect Slack. For more information, see Connect Slack.
-
In Slack, invite the Amazon CloudWatch app to the channel.
-
Add a rule with Destination type Slack and select the channel. For more information, see Add a notification rule.
PagerDuty
CloudWatch sends an Events API v2 event to the service, with the same data in
custom_details. A severity increase updates the same PagerDuty
incident.
To send observations to PagerDuty
-
In PagerDuty, add an Events API v2 integration to the service. For more information, see Services and integrations.
-
In the Omni web UI, connect PagerDuty under Settings, Integrations.
-
Add a rule with Destination type PagerDuty and select the service. If you enter the name, match it exactly; it is case-sensitive.
Amazon SNS
CloudWatch publishes a JSON message with the same data. The subject is
New CloudWatch observation or CloudWatch observation
severity increased. You can subscribe email, AWS Lambda, Amazon SQS,
or HTTPS endpoints to the topic.
Amazon SNS setup
Use a standard topic (not FIFO) in the same Region. The topic can be in
another account. Add this statement to the topic access policy. If you add an
aws:SourceArn condition, use ArnLike with
intelligence-notification-target/*.
{ "Effect": "Allow", "Principal": { "Service": "cloudwatch.amazonaws.com" }, "Action": "sns:Publish", "Resource": "arn:aws:sns:us-east-1:111122223333:checkout-oncall", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" }, "ArnLike": { "aws:SourceArn": "arn:aws:cloudwatch:us-east-1:111122223333:intelligence-notification-target/*" } } }
If the topic is encrypted, use a customer managed key that allows
CloudWatch. CloudWatch can't publish to a topic encrypted with the AWS
managed key alias/aws/sns. Add this statement to the key
policy:
{ "Effect": "Allow", "Principal": { "Service": "cloudwatch.amazonaws.com" }, "Action": ["kms:Decrypt", "kms:GenerateDataKey*"], "Resource": "*", "Condition": { "StringEquals": { "aws:SourceAccount": "111122223333" }, "ArnLike": { "aws:SourceArn": "arn:aws:cloudwatch:us-east-1:111122223333:intelligence-notification-target/*" } } }
Add a notification rule
Add a notification rule when you want CloudWatch to send matching observations to a team tool, such as Slack, PagerDuty, or Amazon SNS.
To add a notification rule
-
Open the Omni web UI.
-
Choose Settings, and then choose Intelligence.
-
In Notifications, choose Add rule.
-
For Severity, select the lowest severity to send. For example, Medium and above sends Medium and High observations.
-
For Service, select a service, or keep All services. A rule for one service doesn't send observations that have no affected service.
-
For Destination type, select Slack, PagerDuty, or Amazon SNS.
-
Select the Slack channel, the PagerDuty service, or the SNS topic (or enter its ARN).
-
Choose Save rules.
CloudWatch checks a destination only when you add the rule. The destination can break later, for example if the app leaves the channel, the integration is deleted, or a policy changes. When that happens, notifications fail without an error.
Change rules with the API
To change notification rules with the API
-
Call
GetIntelligenceConfiguration. Each rule is one entry in thenotificationTargetslist. -
Change the list. To keep a rule, send its
targetId,target,filter, andstatusunchanged. To add a rule, send it without atargetId. To change a rule's destination, remove the rule and add a new one. -
Call
PutIntelligenceConfigurationwith the full list and thenotificationTargetsVersionfrom step 1. The list replaces all saved rules. Settings you don't send, such asautoInvestigations, don't change.
If you leave out filter, the rule sends observations of all
services and severities. If you leave out status, the rule is on.
If someone else changed the rules after your read, the request fails with
ConflictException; read the configuration again and
retry.
For Slack, arn is the integration ARN and
metadata.channel is the channel name. For PagerDuty,
arn is the integration ARN and
metadata.service_name is the exact, case-sensitive service name.
For Amazon SNS, arn is the topic ARN, with no
metadata.
{ "notificationTargetsVersion": 0, "notificationTargets": [ { "target": { "type": "slack", "arn": "<Slack integration ARN>", "metadata": { "channel": "checkout-oncall" } }, "filter": { "minimumSeverity": "MEDIUM" } }, { "target": { "type": "pagerduty", "arn": "<PagerDuty integration ARN>", "metadata": { "service_name": "Checkout" } }, "filter": { "services": ["checkout"], "minimumSeverity": "HIGH" } }, { "target": { "type": "sns", "arn": "arn:aws:sns:us-east-1:111122223333:checkout-oncall" } } ] }
Turn off notifications
Remove the rules in Settings, Intelligence, Notifications, and then choose Save
rules. With the API, send an empty notificationTargets
list.
Route observations with EventBridge
CloudWatch also sends an Amazon EventBridge event for each new observation and
each severity increase, without a notification rule. The event goes to the
default event bus with source aws.cloudwatch and detail type
Telemetry Intelligence Observation Raised. In
detail, eventKind is created or
severityIncreased. To route it, create an EventBridge rule with
this pattern:
{ "source": ["aws.cloudwatch"], "detail-type": ["Telemetry Intelligence Observation Raised"] }