DOP-C02 Question 294
Single answerYou are managing a serverless application that processes customer orders. The application uses an Amazon SQS queue to handle incoming order requests, which are then processed by an AWS Lambda function. Recently, a business requirement was introduced to notify the operations team via email whenever an order fails to process. What is the MOST effective way to implement this notification mechanism?
- A
Configure the Lambda function to publish a message to an Amazon SNS topic when an error occurs, and subscribe the operations team's email to the SNS topic.
- B
Enable Dead Letter Queues (DLQ) for the SQS queue and configure the DLQ to send failure notifications directly to the operations team's email.
- C
Use Amazon CloudWatch Logs to monitor Lambda execution logs, and set up a CloudWatch alarm to send an email notification to the operations team upon detecting errors.
- D
Create an EventBridge rule to monitor the SQS queue for failed messages and configure the rule to invoke an email notification service.
Show answer and explanation
Correct answer: A
Explanation
The most effective way to notify the operations team of failed order processing is to leverage the existing Lambda function. By configuring the Lambda function to publish a message to an SNS topic when an error occurs, you can ensure immediate and reliable email notifications. This solution is simple to implement and aligns well with AWS best practices for event-driven architectures.
- A. Correct.
This is the correct answer. By configuring the Lambda function to publish a message to an SNS topic upon failure, you can effectively notify the operations team. Amazon SNS supports email notifications, making it a suitable choice for this use case.
- B. Incorrect.
Dead Letter Queues (DLQ) capture failed messages for further investigation but cannot directly send email notifications. Additional processing would be required to achieve the notification functionality.
- C. Incorrect.
Using CloudWatch Logs and alarms could work, but this approach is less efficient compared to using SNS. It requires more manual configuration and monitoring of logs, which may not be as immediate or reliable for notifying the operations team.
- D. Incorrect.
EventBridge rules are not designed to monitor SQS queue message failures directly. While EventBridge can trigger actions based on events, this scenario is better addressed by handling the error within the Lambda function and using SNS for notifications.