AWS Certified Developer – Associate (DVA-C02) — Question 504
A developer created an AWS Lambda function named ProcessMessages. The Lambda function is invoked asynchronously when a message is published to an Amazon Simple Notification Service (Amazon SNS) topic named InputTopic. The developer uses a second SNS topic named ErrorTopic to handle alerts of failures for other services.
The developer wants to receive notifications from the ErrorTopic SNS topic when the ProcessMessages Lambda function fails to process a message.
Which solution will meet this requirement?
Answer options
- A. Configure a subscription for the ErrorTopic SNS topic. Configure a filter policy for failures. Specify the ProcessMessages Lambda function as the endpoint.
- B. Configure a failure destination for the ProcessMessages Lambda function. Specify the Amazon Resource Name (ARN) of the ErrorTopic SNS topic as the destination ARN.
- C. Configure a trigger for the ProcessMessages Lambda function. Specify the ErrorTopic SNS topic as the trigger topic. Configure a filter policy on the topic for failures
- D. Configure a delivery policy on the ErrorTopic SNS topic. Configure a filter policy for failures. Specify the Lambda function as the input endpoint.
Correct answer: B
Explanation
For asynchronous invocations, AWS Lambda allows developers to configure destinations to route execution results, including sending failed execution records to an Amazon SNS topic. Specifying the ErrorTopic ARN as the on-failure destination for the ProcessMessages function ensures failures are automatically forwarded there. Other options involving SNS subscription filters or delivery policies are incorrect because they cannot natively intercept and handle Lambda execution failures.