An application publishes transaction events to an Amazon SNS topic. A fraud detection service is subscribed to this topic and must only process transactions where the amount is greater than $10,000. Other subscribers must continue to receive all transaction events. Which configuration should the developer implement to meet this requirement?
- Define a subscription filter policy on the Amazon SNS subscription for the fraud detection service to match the transaction amount attribute.Answer
- BDecrease the Amazon SQS visibility timeout of the queue subscribed to the topic to zero so that the fraud detection service can quickly skip unwanted messages.
- CInitialize the AWS SDK client with hardcoded credentials in the fraud detection application to dynamically create new temporary SQS queues for filtering.
- DConfigure the AWS Lambda function consuming the messages to use a short timeout limit so that executions handling transactions under $10,000 terminate early.
Answer
Define a subscription filter policy on the Amazon SNS subscription for the fraud detection service to match the transaction amount attribute.
Defining a subscription filter policy on the Amazon SNS subscription is the standard, native method to filter messages. When a message is published to the topic with matching attributes, SNS automatically filters it so that only the interested subscription receives it, while other subscriptions are unaffected.
Step-by-Step Solution
Key Concept
Amazon SNS Subscription Filter Policies allow subscribers to filter messages based on message attributes so that they only receive messages of interest.