Getting delivery status of AWS SMS
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In today's connected world, promptly monitoring the delivery status of SMS messages is crucial for applications built on Amazon Web Services (AWS). AWS Simple Notification Service (SNS) provides a flexible method for sending SMS messages globally. One significant feature of AWS SNS is its capability to report the delivery status of each message sent, which becomes vital for tracking and troubleshooting any communication issues.
Understanding AWS SMS Delivery Status
AWS SNS allows you to track message delivery status by sending events to Amazon CloudWatch, Amazon Kinesis Data Fireshose, or AWS Lambda. These events include information such as whether a message was successfully delivered or if it encountered any errors.
SNS Delivery Status Configuration
To receive delivery status notifications, you must configure your SNS topic to enable the feature:
- Create an SNS Topic:
- You first need to create an SNS topic that you will use to publish your SMS message.
- Enable Delivery Status Logging:
- Go to the SNS console.
- Select your SNS topic.
- In the "Delivery Status" section, choose your delivery log endpoint (CloudWatch, Kinesis Data Firehose, or Lambda) and enable logging for the SMS platform.
- Configure Permissions:
- Make sure the SNS topic has the appropriate permissions to publish status logs to the endpoint you selected. For CloudWatch, ensure the SNS topic has the `cloudwatch:PutMetricData` policy attached.
Example SNS Message Delivery Status
Below is an example of a delivery status JSON notification for an SNS message:
- `status`: The end result of the delivery attempt (e.g., "SUCCESS", "FAILED").
- `destination`: The phone number to which the message was sent.
- `providerResponse`: A description from the carrier or AWS SNS.
- `dwellTimeMs`: Time in milliseconds SNS took until it sent the message to the delivery provider.
- `dwellTimeMsUntilDeviceAck`: Time in milliseconds from the message being sent to the provider and the provider acknowledging the delivery.
- Set up CloudWatch Alarms:
- Generate Insights:
- Automatic Retries and Notifications:
- Incorrect Permissions:
- Telephone Provider Errors:
- Configuration Errors:
Related reading
- Getting EndpointDisabled from Amazon SNS
- Getting json body in aws Lambda via API gateway
- getting message forbidden reply from AWS API gateway
- Getting S3 objects' last modified datetimes with boto
- Getting started with secure AWS CloudFront streaming with Python
- getting The bucket does not allow ACLs Error
- GKE - How to serve HTTPS via the L7 load balancer?
- GKE autopilot has scaled up my container resources contary to resource requests

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.