Module classic/sns
APIs
APIs
namespace 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:
- “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.
- “Application,Platform”: Filters on application and platform objects, where the platform objects are for the supported push notification services, such as APNS and FCM.
- “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.
- “Platform”: Filters on platform objects for the push notification services, such as APNS and FCM.
- “TopicName”: Filters on Amazon SNS topic names.
- “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
interface SnsMetricChange extends MetricChange
property application
application?: undefined | string;
Filters on application objects, which represent an app and device registered with one of the supported push notification services, such as APNS and FCM.
property color
color?: pulumi.Input<string>;
The six-digit HTML hex color code to be used for this metric.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property country
country?: undefined | string;
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.
property dimensions
dimensions?: pulumi.Input<Record<string, pulumi.Input<string>>>;
The new dimension for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be cleared.
property extendedStatistic
extendedStatistic?: pulumi.Input<number>;
The new percentile statistic for the metric associated with the alarm. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property label
label?: pulumi.Input<string>;
The label to display for this metric in the graph legend. If this is not specified, the metric is given an autogenerated label that distinguishes it from the other metrics in the widget.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property period
period?: pulumi.Input<number>;
The new period in seconds over which the specified stat
is applied. If this object is
missing this property, then no change will be made. However, if the property is there by set
to [undefined] then the value will be set to the default (300s).
property platform
platform?: undefined | string;
Filters on platform objects for the push notification services, such as APNS and FCM.
property smsType
smsType?: "promotional" | "transactional";
Filters on the message type of SMS message.
property statistic
statistic?: pulumi.Input<MetricStatistic>;
The new statistic to apply to the alarm’s associated metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property topic
topic?: aws.sns.Topic;
Optional topic to filter down to.
property unit
unit?: pulumi.Input<MetricUnit>;
The new unit for this metric. If this object is missing this property, then no change will be made. However, if the property is there by set to [undefined] then the value will be set to the default.
property visible
visible?: pulumi.Input<boolean>;
Set this to true to have the metric appear in the graph, or false to have it be hidden. The default is true.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
property yAxis
yAxis?: pulumi.Input<"left" | "right">;
Where on the graph to display the y-axis for this metric. The default is left.
Only used if this metric is displayed in a [Dashboard] with a [MetricWidget].
type SnsMetricName
type SnsMetricName = "NumberOfMessagesPublished" | "NumberOfNotificationsDelivered" | "NumberOfNotificationsFailed" | "NumberOfNotificationsFilteredOut" | "NumberOfNotificationsFilteredOut-NoMessageAttributes" | "NumberOfNotificationsFilteredOut-InvalidAttributes" | "PublishSize" | "SMSMonthToDateSpentUSD" | "SMSSuccessRate";
Thank you for your feedback!
If you have a question about how to use Pulumi, reach out in Community Slack.
Open an issue on GitHub to report a problem or suggest an improvement.