Search code examples
amazon-web-servicesaws-lambdaamazon-sns

How to make SNS Topic to reject specific events?


I have a lambda which handles SNS Events.

I would like to block specific events in SNS. For example, if event contains specific ID, I want SNS topic to reject it. Basically, I do not want that message to be in topic/queue.

I checked the AWS documentation which only allows filtering. However, instead of allowing specific attributes(for my case it is ID) to pass, I would like to block specific events to be in SNS topic/queue.

Do you have any idea to do it ?


Solution

  • There isn't such a functionality in SNS service itself. The filtering is for different use-case and not for selective selection of notifications. I suggest a lambda function fronting whichever service is triggering the notification. Lambda function should have all the logic of clearing the non-required IDs.

    Current:

    Some service -> SNS Topic -> Lambda

    Suggested implementation:

    Some Service -> New Lambda (Logic here) -> SNS Topic -> Lambda