Amazon SNS message delivery status
Amazon SNS provides support to log the delivery status of notification messages sent to topics with the following Amazon SNS endpoints:
-
HTTP
-
Amazon Kinesis Data Firehose
-
AWS Lambda
-
Platform application endpoint
-
Amazon Simple Queue Service
After you configure the message delivery status attributes, log entries will be sent to CloudWatch Logs for messages sent to a topic subscribed to an Amazon SNS endpoint. Logging message delivery status helps provide better operational insight, such as the following:
-
Knowing whether a message was delivered to the Amazon SNS endpoint.
-
Identifying the response sent from the Amazon SNS endpoint to Amazon SNS.
-
Determining the message dwell time (the time between the publish timestamp and just before handing off to an Amazon SNS endpoint).
To configure topic attributes for message delivery status, you can use the AWS Management Console, AWS software development kits (SDKs), or query API.
Topics
Configuring delivery status logging using the AWS Management Console
-
Sign in to the Amazon SNS console
. -
On the navigation panel, choose Topics.
-
On the Topics page, choose a topic and then choose Edit.
-
On the Edit
MyTopic
page, expand the Delivery status logging section. -
Choose the protocol for which you want to log delivery status; for example AWS Lambda.
-
Enter the Success sample rate (the percentage of successful messages for which you want to receive CloudWatch Logs.
-
In the IAM roles section, do one of the following:
-
To choose an existing service role from your account, choose Use existing service role and then specify IAM roles for successful and failed deliveries.
-
To create a new service role in your account, choose Create new service role, choose Create new roles to define the IAM roles for successful and failed deliveries in the IAM console.
To give Amazon SNS write access to use CloudWatch Logs on your behalf, choose Allow.
-
-
Choose Save changes.
You can now view and parse the CloudWatch Logs containing the message delivery status. For more information about using CloudWatch, see the CloudWatch Documentation
.
Configuring message delivery status attributes for topics subscribed to Amazon SNS endpoints using the AWS SDKs
The AWS SDKs
Topic attributes
You can use the following topic attribute name values for message delivery status:
HTTP
-
HTTPSuccessFeedbackRoleArn
-
HTTPSuccessFeedbackSampleRate
-
HTTPFailureFeedbackRoleArn
Amazon Kinesis Data Firehose
-
FirehoseSuccessFeedbackRoleArn
-
FirehoseSuccessFeedbackSampleRate
-
FirehoseFailureFeedbackRoleArn
AWS Lambda
-
LambdaSuccessFeedbackRoleArn
-
LambdaSuccessFeedbackSampleRate
-
LambdaFailureFeedbackRoleArn
Platform application endpoint
-
ApplicationSuccessFeedbackRoleArn
-
ApplicationSuccessFeedbackSampleRate
-
ApplicationFailureFeedbackRoleArn
Note In addition to being able to configure topic attributes for message delivery status of notification messages sent to Amazon SNS application endpoints, you can also configure application attributes for the delivery status of push notification messages sent to push notification services. For more information, see Using Amazon SNS Application Attributes for Message Delivery Status.
Amazon SQS
-
SQSSuccessFeedbackRoleArn
-
SQSSuccessFeedbackSampleRate
-
SQSFailureFeedbackRoleArn
The <ENDPOINT>SuccessFeedbackRoleArn
and
<ENDPOINT>FailureFeedbackRoleArn
attributes are used to give
Amazon SNS write access to use CloudWatch Logs on your behalf. The
<ENDPOINT>SuccessFeedbackSampleRate
attribute is for
specifying the sample rate percentage (0-100) of successfully delivered messages.
After you configure the <ENDPOINT>FailureFeedbackRoleArn
attribute, then all failed message deliveries generate CloudWatch Logs.
AWS SDK examples to configure topic attributes
The following examples show how to configure topic attributes using the Amazon SNS clients that are provided by the AWS SDKs.