Amazon Simple Notification Service
Developer Guide (API Version 2010-03-31)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Monitoring Amazon SNS with CloudWatch

Amazon SNS and CloudWatch are integrated so you can collect, view, and analyze metrics for every active Amazon SNS topic. Once you have configured CloudWatch for Amazon SNS, you can gain better insight into the performance of your Amazon SNS topics and Amazon SNS push notifications. For example, you can set an alarm to send you an email notification if a specified threshold is met for an Amazon SNS metric, such as NumberOfNotificationsFailed. For a list of all the metrics that Amazon SNS sends to CloudWatch, see Amazon SNS Metrics. For more information about Amazon SNS push notifications, see Amazon SNS Mobile Push Notifications

The metrics you configure with CloudWatch for your Amazon SNS topics are automatically collected and pushed to CloudWatch every five minutes. These metrics are gathered on all topics that meet the CloudWatch guidelines for being active. A topic is considered active by CloudWatch for up to six hours from the last activity (i.e., any API call) on the topic.

Note

There is no charge for the Amazon SNS metrics reported in CloudWatch; they are provided as part of the Amazon SNS service.

Access CloudWatch Metrics for Amazon SNS

You can monitor metrics for Amazon SNS using the CloudWatch console, CloudWatch's own command line interface (CLI), or programmatically using the CloudWatch API. The following procedures show you how to access the metrics using these different options.

To view metrics using the CloudWatch console

  1. Sign in to the AWS Management Console and open the Amazon CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. Click View Metrics.

  3. From the Viewing drop-down menu select either SNS: Topic Metrics, SNS: Push Notifications by Application, SNS: Push Notifications by Application and Platform, or SNS: Push Notifications by Platform to show the available metrics.

  4. Click a specific item to see more detail, such as a graph of the data collected. For example, the following graph of the selected metric, NumberOfMessagesPublished, shows the average number of published Amazon SNS messages for a five-minute period throughout the time range of 6 hours.

To access metrics from the CloudWatch CLI

To access metrics from the CloudWatch API

Set CloudWatch Alarms for Amazon SNS Metrics

CloudWatch also allows you to set alarms when a threshold is met for a metric. For example, you could set an alarm for the metric, NumberOfNotificationsFailed, so that when your specified threshold number is met within the sampling period, then an email notification would be sent to inform you of the event.

To set alarms using the CloudWatch console

  1. Sign in to the AWS Management Console and open the Amazon CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. Click Alarms, and then click the Create Alarm button. This launches the Create Alarm wizard.

  3. Scroll through the Amazon SNS metrics to locate the metric you want to place an alarm on. Select the metric to create an alarm on and click Continue.

  4. Fill in the Name, Description, Threshold, and Time values for the metric, and then click Continue.

  5. Choose Alarm as the alarm state. If you want CloudWatch to send you an email when the alarm state is reached, either select a preexisting Amazon SNS topic or click Create New Email Topic. If you click Create New Email Topic, you can set the name and email addresses for a new topic. This list will be saved and appear in the drop-down box for future alarms. Click Continue.

    Note

    If you use Create New Email Topic to create a new Amazon SNS topic, the email addresses must be verified before they will receive notifications. Emails are sent only when the alarm enters an alarm state. If this alarm state change happens before the email addresses are verified, they will not receive a notification.

  6. At this point, the Create Alarm wizard gives you a chance to review the alarm you’re about to create. If you need to make any changes, you can use the Edit links on the right. Once you are satisfied, click Create Alarm.

For more information about using CloudWatch and alarms, see the CloudWatch Documentation.

Amazon SNS Metrics

Amazon SNS sends the following metrics to CloudWatch.

MetricDescription

NumberOfMessagesPublished

The number of messages published.

Units: Count

Valid Statistics: Sum

PublishSize

The size of messages published.

Units: Bytes

Valid Statistics: Minimum, Maximum, Average and Count

NumberOfNotificationsDelivered

The number of messages successfully delivered.

Units: Count

Valid Statistics: Sum

NumberOfNotificationsFailed

The number of messages that SNS failed to deliver.

Units: Count

Valid Statistics: Sum, Average

Dimensions for Amazon Simple Notification Service Metrics

Amazon Simple Notification Service sends the following dimensions to CloudWatch.

Dimension

Description

Application

Filters on application objects, which represent an app and device registered with one of the supported push notification services, such as APNS and GCM.

Application,Platform

Filters on application and platform objects, where the platform objects are for the supported push notification services, such as APNS and GCM.

Platform

Filters on platform objects for the push notification services, such as APNS and GCM.

TopicName

Filters on Amazon SNS topic names.