

# 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
<a name="omni-observations-notifications-before-you-begin"></a>

Observations must be on, and you need the Space Admin permission level. For API permissions, see [Security in Observations](omni-observations-security.md).


| 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](#omni-observations-notifications-sns-setup). | 

## Slack
<a name="omni-observations-notifications-slack"></a>

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.

![A Amazon CloudWatch Omni observation notification posted by the Amazon CloudWatch app in a Slack channel, showing a High-severity observation with its title, summary, affected service, Region, and account, and View this observation and Investigate buttons.](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/images/omni-notifications-slack.png)


**To send observations to Slack**

1. Connect Slack. For more information, see [Connect Slack](omni-connect-slack.md).

1. In Slack, invite the Amazon CloudWatch app to the channel.

1. Add a rule with **Destination type** **Slack** and select the channel. For more information, see [Add a notification rule](#omni-observations-notifications-add-a-rule).

## PagerDuty
<a name="omni-observations-notifications-pagerduty"></a>

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**

1. In PagerDuty, add an Events API v2 integration to the service. For more information, see [Services and integrations](omni-connect-pagerduty.md).

1. In the Omni web UI, connect PagerDuty under **Settings**, **Integrations**.

1. 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
<a name="omni-observations-notifications-sns"></a>

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
<a name="omni-observations-notifications-sns-setup"></a>

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/*`.

```json
{
  "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:

```json
{
  "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
<a name="omni-observations-notifications-add-a-rule"></a>

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**

1. Open the Omni web UI.

1. Choose **Settings**, and then choose **Intelligence**.

1. In **Notifications**, choose **Add rule**.

1. For **Severity**, select the lowest severity to send. For example, **Medium** and above sends Medium and High observations.

1. For **Service**, select a service, or keep **All services**. A rule for one service doesn't send observations that have no affected service.

1. For **Destination type**, select **Slack**, **PagerDuty**, or **Amazon SNS**.

1. Select the Slack channel, the PagerDuty service, or the SNS topic (or enter its ARN).

1. Choose **Save rules**.

**Important**  
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
<a name="omni-observations-notifications-api"></a>

**To change notification rules with the API**

1. Call `GetIntelligenceConfiguration`. Each rule is one entry in the `notificationTargets` list.

1. Change the list. To keep a rule, send its `targetId`, `target`, `filter`, and `status` unchanged. To add a rule, send it without a `targetId`. To change a rule's destination, remove the rule and add a new one.

1. Call `PutIntelligenceConfiguration` with the full list and the `notificationTargetsVersion` from step 1. The list replaces all saved rules. Settings you don't send, such as `autoInvestigations`, 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`.

```json
{
  "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
<a name="omni-observations-notifications-turn-off"></a>

Remove the rules in **Settings**, **Intelligence**, **Notifications**, and then choose **Save rules**. With the API, send an empty `notificationTargets` list.

## Route observations with EventBridge
<a name="omni-observations-notifications-eventbridge"></a>

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:

```json
{ "source": ["aws.cloudwatch"], "detail-type": ["Telemetry Intelligence Observation Raised"] }
```