How to filter SNS messages for Lambda with least effort?
Short answer
B Use an SNS filter policy on the Lambda function subscription to allow only messages that are related to email address changes to invoke the Lambda function.
Question
Key Takeaways
The question tests the distinction between SNS subscription filter policies and Lambda event filtering, with the trap being the incorrect assumption that Lambda event filtering supports SNS triggers.
To process specific SNS messages in a Lambda function with minimal code, use SNS subscription filter policies. The community confirms this is the standard approach for message routing without custom logic.
Common mistake: Choosing Option A is a frequent error because Lambda event filtering does not support Amazon SNS as an event source.
Expert Analysis
Why the Answer Is Correct
SNS subscription filter policies allow you to define attribute-based filtering rules directly on the subscription. This ensures the Lambda function is only invoked for messages matching the criteria (email address changes), requiring no code changes and thus the least development effort.
Why the Other Options Are Wrong
Option A is incorrect because Lambda event filtering is not supported for SNS event sources. Option C adds unnecessary operational overhead by introducing an SQS queue. Option D requires writing custom logic to inspect and republish messages, which significantly increases development effort.
Community Comment Notes
Community members emphasized that Option A is invalid due to the lack of support for SNS in Lambda event filtering. Comments also reinforced that SNS filter policies are the intended, native solution for this specific use case.
Official Reference
- https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html
- https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html
These links open the official vendor documentation in a new tab.
Exam Strategy
When you see 'least development effort' for message routing, prioritize service-level configurations like filter policies over writing code. Always verify which event sources support Lambda event filtering to avoid selecting invalid options.
Community Votes
100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 5 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 5
-
KennethNg923 👍 2 Answered BSNS filter policies are designed specifically for this purpose and require the least development effort. They allow you to filter messages at the SNS level before they reach the Lambda function.
-
rdiaz 👍 2 Answered BSNS filter policies allow you to specify criteria that messages must meet to be delivered to a particular subscriber.
-
preachr 👍 1 Answered Bhttps://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html
-
FYXL 👍 1 Answered BFor A, Lambda event filtering does not support SNS
-
Saudis 👍 1 Answered BANS IS B
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →