Module sns

@pulumi/awsx > sns

module metrics

function metric

metric(metricName: SnsMetricName, change: SnsMetricChange): Metric

Creates an AWS/SNS metric with the requested [metricName]. See https://docs.aws.amazon.com/sns/latest/dg/sns-monitoring-using-cloudwatch.html for list of all metric-names.

Note, individual metrics can easily be obtained without supplying the name using the other [metricXXX] functions.

Amazon SNS and CloudWatch are integrated so you can collect, view, and analyze metrics for every active Amazon SNS notification. Once you have configured CloudWatch for Amazon SNS, you can gain better insight into the performance of your Amazon SNS topics, push notifications, and SMS deliveries. 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.

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.

Amazon Simple Notification Service sends the following dimensions to CloudWatch:

  1. “Application”: Filters on application objects, which represent an app and device registered with one of the supported push notification services, such as APNS and FCM.
  2. “Application,Platform”: Filters on application and platform objects, where the platform objects are for the supported push notification services, such as APNS and FCM.
  3. “Country”: Filters on the destination country or region of an SMS message. The country or region is represented by its ISO 3166-1 alpha-2 code.
  4. “Platform”: Filters on platform objects for the push notification services, such as APNS and FCM.
  5. “TopicName”: Filters on Amazon SNS topic names.
  6. “SMSType”: Filters on the message type of SMS message. Can be “promotional” or “transactional”.

function numberOfMessagesPublished

numberOfMessagesPublished(change?: SnsMetricChange): Metric

The number of messages published to your Amazon SNS topics.

Units: Count

Valid Statistics: Sum

function numberOfNotificationsDelivered

numberOfNotificationsDelivered(change?: SnsMetricChange): Metric

The number of messages successfully delivered from your Amazon SNS topics to subscribing endpoints.

For a delivery attempt to succeed, the endpoint’s subscription must accept the message. A subscription accepts a message if a.) it lacks a filter policy or b.) its filter policy includes attributes that match those assigned to the message. If the subscription rejects the message, the delivery attempt isn’t counted for this metric.

Units: Count

Valid Statistics: Sum

function numberOfNotificationsFailed

numberOfNotificationsFailed(change?: SnsMetricChange): Metric

The number of messages that Amazon SNS failed to deliver.

For Amazon SQS, email, SMS, or mobile push endpoints, the metric increments by 1 when Amazon SNS stops attempting message deliveries. For HTTP or HTTPS endpoints, the metric includes every failed delivery attempt, including retries that follow the initial attempt. For all other endpoints, the count increases by 1 when the message fails to deliver (regardless of the number of attempts).

This metric does not include messages that were rejected by subscription filter policies.

Units: Count

Valid Statistics: Sum, Average

function numberOfNotificationsFilteredOut_InvalidAttributes

numberOfNotificationsFilteredOut_InvalidAttributes(change?: SnsMetricChange): Metric

The number of messages that were rejected by subscription filter policies because the messages’ attributes are invalid – for example, because the attribute JSON is incorrectly formatted.

Units: Count

Valid Statistics: Sum, Average

function numberOfNotificationsFilteredOut_NoMessageAttributes

numberOfNotificationsFilteredOut_NoMessageAttributes(change?: SnsMetricChange): Metric

The number of messages that were rejected by subscription filter policies because the messages have no attributes.

Units: Count

Valid Statistics: Sum, Average

function publishSize

publishSize(change?: SnsMetricChange): Metric

The number of database connections in use.

Units: Bytes

Valid Statistics: Minimum, Maximum, Average and Count

function smsMonthToDateSpentUSD

smsMonthToDateSpentUSD(change?: SnsMetricChange): Metric

The charges you have accrued since the start of the current calendar month for sending SMS messages.

You can set an alarm for this metric to know when your month-to-date charges are close to the monthly SMS spend limit for your account. When Amazon SNS determines that sending an SMS message would incur a cost that exceeds this limit, it stops publishing SMS messages within minutes.

Valid Statistics: Maximum

function smsSuccessRate

smsSuccessRate(change?: SnsMetricChange): Metric

The rate of successful SMS message deliveries.

Units: Count

Valid Statistics: Sum, Average, Data Samples

interface SnsMetricChange

type SnsMetricName

type SnsMetricName = "NumberOfMessagesPublished" | "NumberOfNotificationsDelivered" | "NumberOfNotificationsFailed" | "NumberOfNotificationsFilteredOut" | "NumberOfNotificationsFilteredOut-NoMessageAttributes" | "NumberOfNotificationsFilteredOut-InvalidAttributes" | "PublishSize" | "SMSMonthToDateSpentUSD" | "SMSSuccessRate";