AWS News Blog

Amazon SNS TTL (Time to Live) Control

Amazon Simple Notification Service (Amazon SNS) is a fast and flexible push messaging service.

Many of the messages that you can send with SNS are relevant or valuable for a limited period of time. Sports scores, weather notifications, and “flash sale” announcements can all get stale in a short period of time. In situations where devices are offline or disconnected, flooding the user with outdated messages when communication is reestablished makes for a poor user experience.

In order to allow you to build great applications that behave well in an environment with real-time information and intermittent connections, Amazon SNS now allows you to set a TTL (Time to Live) value of up to two weeks for each message. Messages that remain undelivered for the given period of time (expressed as a number of seconds since the message was published) will expire and will not be delivered. Read about How to Use Time to Live Values.

Most of the underlying push services support TTL in some fashion, but each one uses a unique set of APIs and data formats. With today’s release, SNS now lets you use a common format and the cross-platform Publish API to define TTL values for iOS, Android, Fire OS, Windows WNS, and Baidu endpoints (Windows MPNS does not support TTL)

You can set the TTL through the SNS API or the AWS Management Console:

This new feature, in conjunction with our recent launch of mobile push support for Windows (phone and desktop) and Baidu Cloud Push (Android), will help you to build helpful, user-friendly applications that reach a broad user base without having to deal with a multitude of messaging providers.