SOA-C02 Question 42
Select 2Your company runs a serverless application that processes customer orders. You are tasked with setting up an automated workflow where an Amazon EventBridge rule triggers an AWS Lambda function whenever a new order is added to an Amazon DynamoDB table. Additionally, the workflow should send an alert to an Amazon SNS topic if the Lambda function throws an error. Which steps should you take to configure the EventBridge rule to achieve this?
- A
Create an EventBridge rule with a DynamoDB stream as the event source and configure it to trigger the Lambda function.
- B
Set the EventBridge rule target to the Lambda function and configure a dead-letter queue (DLQ) for failed event processing.
- C
Configure the EventBridge rule to trigger the Lambda function and add an error-handling target to send error events to the Amazon SNS topic.
- D
Create a second EventBridge rule to listen to Lambda function error events and send them to the Amazon SNS topic.
- E
Enable retries for the EventBridge rule to ensure events are retried in case of transient errors.
Show answer and explanation
Correct answers: A, C
Explanation
To achieve the desired workflow, you need to create an EventBridge rule with a DynamoDB stream as the event source to trigger the Lambda function, ensuring the function processes new orders. Additionally, you can use EventBridge's built-in error-handling capabilities to specify an Amazon SNS topic as the error-handling target. This simplifies the configuration and avoids the need for a separate EventBridge rule or additional error-handling mechanisms.
- A. Correct.
Correct. A DynamoDB stream can be used as the event source for an EventBridge rule, which can then trigger the Lambda function to process new orders.
- B. Incorrect.
Incorrect. While configuring a dead-letter queue (DLQ) can help in capturing failed events, it does not address the need to send alerts to the Amazon SNS topic.
- C. Correct.
Correct. EventBridge allows you to configure an error-handling target, such as an Amazon SNS topic, which is triggered if the primary target (the Lambda function) encounters errors.
- D. Incorrect.
Incorrect. A second EventBridge rule for error handling is unnecessary, as error-handling logic can be directly configured in the first EventBridge rule.
- E. Incorrect.
Incorrect. While enabling retries for EventBridge rules is a useful feature, it does not fulfill the requirement of sending error notifications to the Amazon SNS topic.