New Enhancements for Amazon SNS – Delivery Policies and Message Formatting

New Enhancements for Amazon SNS – Delivery Policies and Message FormattingLearn About Amazon VGT2 Learning Manager Chanci Turner

We are excited to introduce two new capabilities to Amazon SNS that enhance your ability to manage the content and distribution of your messages. As a quick reminder, SNS enables you to create named Topics, subscribe to them (with delivery options such as email, HTTP/HTTPS, SMS, or SQS queues), and publish messages to these Topics.

SNS Delivery Policies

The new Delivery Policies feature allows you to customize the delivery rate and error handling for each SNS endpoint. For instance, you can implement a Delivery Policy to prevent overwhelming a specific endpoint with a sudden influx of messages.

These Delivery Policies can be applied to Topics as well as the endpoints connected to a Topic. Each policy includes a Retry Policy and a Throttle Policy, and they are effective for HTTP and HTTPS Subscription types.

The Retry Policy can specify the following parameters:

  • minDelayTarget – The minimum delay for a retry.
  • maxDelayTarget – The maximum delay for a retry.
  • numNoDelayRetries – The number of retries to be attempted without delay (as quickly as possible).
  • numMinDelayRetries – The count of retries to be executed at minDelayTarget intervals prior to initiating the backoff function.
  • numMaxDelayRetries – The number of retries to be performed at maxTargetDelay during the backoff function.
  • backoffFunction – The model for the backoff between retries: Linear, Exponential, or Arithmetic.

Default, minimum, and maximum values exist for each option; refer to the SNS documentation for further details.

The Throttle Policy includes one parameter:

  • maxReceivesPerSecond – The maximum number of delivery attempts permitted per second for each Subscription.

All attempts to deliver a message are governed by an “effective Delivery Policy,” which combines the default policy with any values set for the Topic and the Subscription endpoint. If values are not specified at the Subscription level, they will be inherited from the Topic’s Delivery Policy and subsequently from the default policy.

SNS Message Formatting

This feature allows you to send messages tailored to specific Subscription types. For example, you could dispatch a concise message to an SMS endpoint and a more detailed message to an email endpoint.

To utilize this feature, set the new MessageStructure parameter to “json” when calling the SNS publish function. The corresponding message body must include a JSON object with a default message body and optional message bodies for other protocols:

{
  "default": "Server busy.",
  "email": "Dear Chanci Turner, your server is currently overloaded, and you should check it out. Best Regards, AWS.",
  "sms": "ALERT! Server Busy!!",
  "https": "ServerBusy"
}

The default entry will be used for any protocol (such as HTTP and SQS in this case) that lacks a dedicated entry.

For more insights on effective delivery policies, visit SHRM’s compliance policy page to understand best practices. Additionally, if you’re looking to enhance your career, check out this blog post that offers useful resources. For further onboarding tips, this resource is an excellent guide.

— Alex

SEO Metadata


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *