DVA-C02 · Question #379
DVA-C02 Question #379: Real Exam Question with Answer & Explanation
The correct answer is B: Use an SNS filter policy on the Lambda function subscription to allow only messages that are. An SNS subscription filter policy filters messages at the SNS service level before invoking the Lambda subscriber, requiring no additional infrastructure or Lambda code changes.
Question
A developer is creating an AWS Lambda function that is invoked by messages to an Amazon Simple Notification Service (Amazon SNS) topic. The messages represent customer data updates from a customer relationship management (CRM) system The developer wants the Lambda function to process only the messages that pertain to email address changes. Additional subscribers to the SNS topic will process any other messages. Which solution will meet these requirements in the LEAST development effort?
Options
- AUse Lambda event filtering to allow only messages that are related to email address changes to
- BUse an SNS filter policy on the Lambda function subscription to allow only messages that are
- CSubscribe an Amazon Simple Queue Service (Amazon SQS) queue to the SNS topic. Configure
- DConfigure the Lambda code to check the received message. If the message is not related to an
Explanation
An SNS subscription filter policy filters messages at the SNS service level before invoking the Lambda subscriber, requiring no additional infrastructure or Lambda code changes.
Common mistakes.
- A. Lambda event filtering is a feature available for SQS and Kinesis event source mappings, not for SNS triggers; SNS does not support Lambda-side event filtering in the same way.
- C. Adding an SQS queue as an intermediary requires creating and configuring additional infrastructure and introduces extra latency and architectural complexity beyond what is necessary.
- D. Implementing message filtering logic inside the Lambda function code still causes Lambda to be invoked for every SNS message, consuming unnecessary compute resources and incurring additional costs for messages that are ultimately discarded.
Concept tested. SNS subscription filter policy for message filtering
Reference. https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html
Community Discussion
No community discussion yet for this question.