Amazon SNS

SNS Dashboard

Overview

Connect Amazon Simple Notification Service (SNS) to Datadog in order to:

  • Collect SNS CloudWatch metrics
  • Send Datadog alert and event notifications to SNS topics
  • Receive SNS messages as events in the Datadog Event Explorer

Setup

Installation

If you haven’t already, set up the Amazon Web Services integration first.

Metric collection

  1. In the AWS integration tile, ensure that Simple Notification Service (SNS) is enabled under the Metric Collection tab.

  2. Ensure that your Datadog IAM policy has the permissions listed in the table below.

    AWS PermissionDescription
    cloudwatch:ListMetricsUsed to list active metrics.
    cloudwatch:GetMetricDataUsed to fetch metric data points.

Event collection

Receive SNS messages

You can receive SNS messages in the Datadog Event Explorer through both the HTTPS and Email protocols. Using the HTTPS protocol allows you to automatically confirm the subscription with a webhook URL.

Using the Email protocol requires a manual confirmation step for the email address that Datadog automatically generates for this purpose. Read the Create Datadog Events from Amazon SNS Emails guide for more information.

To receive SNS messages in the Datadog Event Explorer through HTTPS:

  1. In the Topics section of the SNS Management console, select the desired topic and click Create Subscription.

  2. Select HTTPS as the protocol and enter the following webhook URL, substituting <API_KEY> with the value of any valid Datadog API key:

    ## Datadog US site
    https://app.datadoghq.com/intake/webhook/sns?api_key=<API_KEY>
    
    ## Datadog EU site
    https://app.datadoghq.eu/intake/webhook/sns?api_key=<API_KEY>
    
  3. Leave Enable raw message delivery unchecked.

  4. Click Create subscription.

  5. In the Datadog Event Explorer, view events from your SNS topics using the search query source:amazon_sns or topicname:<TOPIC-NAME>.

Send notifications to SNS

To send Datadog notifications to an SNS topic:

  1. In the AWS integration tile, ensure that Simple Notification Service (SNS) is enabled under the Metric Collection tab, and the region of your topic is enabled under the General tab.

  2. Ensure that your Datadog IAM policy has the permissions listed in the table below. For more information, see Using identity-based policies with Amazon SNS in the AWS documentation.

    AWS PermissionDescription
    cloudwatch:ListMetricsUsed to determine active regions.
    sns:List*Used to list available topics.
    sns:PublishUsed to publish notifications (monitors or event feed).
  3. Install the Datadog - Amazon SNS integration.

  4. Enter your SNS topic as a recipient in monitor notifications using the format @<SNS-TOPIC-NAME>.

Log collection

Amazon SNS does not generate native logs. If your applications or subscribers log the messages they send or receive through SNS, those logs can be routed through the Datadog Forwarder and collected like any other log data.

Send logs to Datadog

  1. In the Topics section of the SNS Management console, select the desired topic and click Create Subscription.
  2. Set Protocol to AWS Lambda.
  3. For Endpoint, enter the ARN of your Datadog Forwarder Lambda.
  4. Click Create Subscription. The Datadog Forwarder automatically confirms the subscription.
  5. In the Datadog Log Explorer, view logs from your SNS topics using the search queries source:sns or @Sns.TopicArn:<TOPIC-ARN>.

Data Collected

Metrics

aws.sns.dwell_time
(gauge)
Time waited by a message before it was delivered.
Shown as millisecond
aws.sns.number_of_messages_published
(count)
Number of messages published.
Shown as message
aws.sns.number_of_notifications_delivered
(count)
Number of messages successfully delivered.
Shown as message
aws.sns.number_of_notifications_failed
(count)
Number of messages that SNS failed to deliver.
Shown as message
aws.sns.number_of_notifications_filtered_out
(count)
The number of messages that were rejected by subscription filter policies. A filter policy rejects a message when the message attributes don’t match the policy attributes.
Shown as message
aws.sns.number_of_notifications_filtered_out_invalid_attributes
(count)
The number of messages that were rejected by subscription filter policies because the messages have no attributes.
Shown as message
aws.sns.number_of_notifications_filtered_out_no_message_attributes
(count)
The number of messages that were rejected by subscription filter policies. A filter policy rejects a message when the message attributes don’t match the policy attributes.
Shown as message
aws.sns.publish_size
(gauge)
Size of messages published.
Shown as byte
aws.sns.smssuccess_rate
(gauge)
The percentage of successfully delivered sms.
Shown as percent

Each of the metrics retrieved from AWS is assigned the same tags that appear in the AWS console, including host name, security-groups, and more.

Events

The Amazon SNS integration includes events for topic subscriptions. See the example event below:

Amazon SNS Events

Service Checks

The Amazon SNS integration does not include any service checks.

Troubleshooting

Datadog does not support SNS notifications from Datadog to topics in China.

Need help? Contact Datadog support.