skip to Main Content

I have a stack defined in cdk that consists of an SNS topic in one AWS account and a SQS queue subscribed to the topic in another.

I am worried that there could be a case where the subscription fails or is temporary unavailable (deployments/failed deployments), in which messages would be lost. If the subscription fails the message would be published to the topic but deleted silently since nothing would be subscribed.

This seems like a gap considering SNS + SQS in another AWS account would be a common design pattern.

Questions:

  1. How can we monitor a subscription on a topic? I suppose you could write a scheduled lambda that polls the subscriptions to a queue and emits the metric to cloudwatch and alarm on that but this seems impractical. Is this something we should be worried about? (deletion protection is enabled on the resources). I was thinking of alarming on (NumberOfMessagesPublished – NumberOfNotificationsDelivered) but if this alarm was triggered, there would be no way of recovering the message unless the message was recorded elsewhere, which would require we log every message since no explicit failures took place.
  2. Is subscription unavailability during deployments something we should worry about?

2

Answers


  1. You can configure message delivery retries. And you can also configure SNS dead-letter queues (DLQs).

    Login or Signup to reply.
  2. You can enable "Delivery Status Logging" in SNS, All your success and failure delivery logs will be pushed to CloudWatch logs. There in CloudWatch you can create a custom metrics over these logs and an alarm on that matrics to notify you on a configurable threshold

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search