Vaibhav shows you how to
monitor SNS delivery
using CloudWatch

vaibhav_monitor_sns_text_cloudwatch

How can I monitor delivery for text messages sent through Amazon Simple Notification Service (Amazon SNS) using Amazon CloudWatch?

Follow these instructions to configure CloudWatch Logs for text messages sent through Amazon SNS. This enables you to see successful and failed delivery messages.

Configure text messaging preferences

  1. Open the AWS SNS console. In the navigation pane, choose Text Messaging (SMS), and then choose Manage text messaging preferences.
  2. Choose Create IAM role, View Details, and then choose View Policy Document to verify the access policy. Choose Allow.
  3. Follow the instructions in Setting SMS Messaging Preferences, and then choose Update preferences.
  4. In the navigation pane, choose Text messaging (SMS), and then choose Send a text message (SMS).
  5. For Message type, choose Transactional. In the Number field, type the phone number. In Message, enter a message that is meaningful to you, and then choose Send text message. You should receive the text message to the phone.

Verify the phone carrier provider response logs

  1. Open the CloudWatch console. In the navigation pane, choose Logs. In the Filter field, search for sns, and then in Log Groups, choose DirectPublishToPhoneNumber.
  2. Choose the Log Stream ID, and then expand the Message. In "providerResponse," you should see "Message has been accepted by phone carrier."
    Note: Recipients can opt out from receiving text messages by replying to the message with OPTOUT or STOP. For more information and a list of all opt-out commands, see Opting Out of Receiving SMS Messages.

Verify the opted-out phone numbers

  1. Open the SNS console. In the navigation pane, choose Text messaging (SMS), and then choose View opted-out phone numbers.
    Note: For a list of all SMS delivery failure reasons, see Viewing Amazon CloudWatch Metrics and Logs for SMS Deliveries.
  2. In the Phone number list, notice the numbers that have opted-out from receiving text messages from your AWS account.

Verify that a device with an opted-out phone number does not receive a text message

  1. In the navigation pane, choose Text messaging (SMS), and then choose Send a text message (SMS).
  2. For Message type, choose Transactional. In the Number field, type the phone number. In Message, type a message that is meaningful to you, and then choose Send text message. You should not receive the text message to the device.

Check the SNS failure logs

  1. Open the CloudWatch console. In the navigation pane, choose Logs. In the Filter field, search for sns, and then in Log Groups, choose DirectPublishToPhoneNumber/Failure.
    Note: You might see two log groups for your AWS text message delivery. Generally, one is DirectPublishToPhoneNumber, used for successful deliveries, and the other one is DirectPublishToPhoneNumber/Failure, used for failed deliveries.
  2. Choose the Log Stream ID, and then expand the Message. In "providerResponse," you should see "Phone number is opted out," and the status of "FAILURE."
    Note: If providerResponse indicates "No quota left for account," you might have reached the maximum amount allowed by default. To raise the limit, see Setting SMS Messaging Preferences.

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2018-03-22