Q83 — AWS SAA-C03 Ch.15
Question 83 of 100 | ← Chapter 15
Q1183. A company wants to create a payment processing application. The application must run when a payment record arrives in an existing Amazon S3 bucket.The application must process each payment record exactly once. The company wants to use an AWS Lambda function to process the payments.Which solution will meet these requirements?
- A. Configure the existing S3 bucket to send object creation events to Amazon EventBridge. Configure EventBridge to route events to an Amazon Simple Queue Service (Amazon SQS) FIFO queue.Configure the Lambda function to run when a new event arrives in the SQS queue. ✓
- B. Configure the existing S3 bucket to send object creation events to an Amazon Simple Notification Service (Amazon SNS) topic. Configure the Lambda function to run when a new event arrives in the SNS topic.
- C. Configure the existing S3 bucket to send object creation events to an Amazon Simple Queue Service (Amazon SQS) queue. Configure the Lambda function to run when a new event arrives in the SQS queue.
- D. Configure the existing S3 bucket to send object creation events directly to the Lambda function.Configure the Lambda function to handle object creation events and to process the payments.
Correct Answer: A. Configure the existing S3 bucket to send object creation events to Amazon EventBridge. Configure EventBridge to route events to an Amazon Simple Queue Service (Amazon SQS) FIFO queue.Configure the Lambda function to run when a new event arrives in the SQS queue.
Explanation
To meet the requirements of processing each payment record exactly once when it arrives in an existing Amazon S3 bucket using an AWS Lambda function, the best solution is A. Configure the existing S3 bucket to send object creation events to Amazon EventBridge. Configure EventBridge to route events to an Amazon Simple Queue Service (Amazon SQS) FIFO queue. Configure the Lambda function to run when a new event arrives in the SQS queue.Analysis of Options:Option A: Configure the existing S3 bucket to send object creation events to Amazon EventBridge. Configure EventBridge to route events to an Amazon Simple Queue Service (Amazon SQS) FIFO queue. Configure the Lambda function to run when a new event arrives in the SQS queue. Advantage: Amazon SQS FIFO (First-In-First-Out) queues ensure that messages are processed exactly once and in the order they are received. By using EventBridge to route S3 object creation events to an SQS FIFO queue, you can guarantee that each payment record is processed exactly once by the Lambda function. This solution provides the necessary reliability and ordering guarantees for payment processing. Option B: Configure the existing S3 bucket to send object creation events to an Amazon Simple Notification Service (Amazon SNS) topic. Configure the Lambda function to run when a new event arrives in the SNS topic.Limitation: Amazon SNS is a publish-subscribe service that does not guarantee message ordering or exactly-once processing. While it can trigger a Lambda function, there is a risk of duplicate processing or out-of-order processing, which is not suitable for payment processing applications where each payment must be processed exactly once.Option C: Configure the existing S3 bucket to send object creation events to an Amazon Simple Queue Service (Amazon SQS) queue. Configure the Lambda function to run when a new event arrives in the SQS queue.Limitation: While Amazon SQS standard queues can trigger Lambda functions, they do not guarantee message ordering or exactly-once processing. This could lead to duplicate processing or out-of-order processing of payment records, which is not acceptable for payment processing. Option D: Configure the existing S3 bucket to send object creation events directly to the Lambda function. Configure the Lambda function to handle object creation events and to process the payments. Limitation: While this solution can trigger the Lambda function directly when an S3 object is created, it does not provide any guarantees around exactly-once processing. There is a risk of the Lambda function being invoked multiple times for the same event (e.g., due to retries), leading to duplicate payment processing. Additionally, there is no inherent message ordering guarantee.Conclusion:A. Configure the existing S3 bucket to send object creation events to Amazon EventBridge. Configure EventBridge to route events to an Amazon Simple Queue Service (Amazon SQS) FIFO queue. Configure the Lambda function to run when a new event arrives in the SQS queue. is the best solution to meet the requirements. It ensures that each payment record is processed exactly once and in the order it is received, providing the necessary reliability for payment processing applications.