How to filter SNS messages for Lambda with least effort?

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?

  1. Use Lambda event filtering to allow only messages that are related to email address changes to invoke the Lambda function.
  2. 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. Source Reference Answer
  3. Subscribe an Amazon Simple Queue Service (Amazon SQS) queue to the SNS topic. Configure the SQS queue with a filter policy to allow only messages that are related to email address changes.
  4. Configure the Lambda code to check the received message. If the message is not related to an email address change, configure the Lambda function to publish the message back to the SNS topic for the other subscribers to process.

Community Votes

B
100%

100% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

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.

Choosing Option A is a frequent error because Lambda event filtering does not support Amazon SNS as an event source.

Community Discussion (5 comments)

Saudis 👍 1 Selected: B
ANS IS B
preachr 👍 1 Selected: B
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
FYXL 👍 1 Selected: B
For A, Lambda event filtering does not support SNS
KennethNg923 👍 2 Selected: B
SNS 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 Selected: B
SNS filter policies allow you to specify criteria that messages must meet to be delivered to a particular subscriber.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

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

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.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide