nerdexam
Amazon

DVA-C02 · Question #379

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 rel

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.

Submitted by joshua94· Mar 5, 2026Development with AWS Services

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

How the community answered

(17 responses)
  • B
    82% (14)
  • C
    12% (2)
  • D
    6% (1)

Why each option

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.

AUse Lambda event filtering to allow only messages that are related to email address changes to

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.

BUse an SNS filter policy on the Lambda function subscription to allow only messages that areCorrect

An SNS filter policy is attached directly to the Lambda function's subscription on the SNS topic. SNS evaluates message attributes against the policy and only invokes the Lambda function when the message matches the filter criteria (email address changes). This requires only a subscription configuration change with no new Lambda code, no additional services, and no unnecessary Lambda invocations for non-matching messages.

CSubscribe an Amazon Simple Queue Service (Amazon SQS) queue to the SNS topic. Configure

Adding an SQS queue as an intermediary requires creating and configuring additional infrastructure and introduces extra latency and architectural complexity beyond what is necessary.

DConfigure the Lambda code to check the received message. If the message is not related to an

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

Source: https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice