148k views
1 vote
Two AWS Lambda functions must simultaneously process PDF files when they are uploaded to an Amazon S3 bucket. The S3 event notification allows only one action when the PDF files are uploaded. Which solution provides the simplest and most efficient way to trigger both Lambda functions?

A. Send the S3 event to Amazon MQ for distribution to both Lambda functions.
B. Send the S3 event to an Amazon SQS queue that both Lambda functions poll.
C. Send the S3 event to an Amazon SNS topic that both Lambda functions subscribe to.
D. Upload two copies of each PDF file by using different object key prefixes.

User Erfa
by
8.4k points

1 Answer

4 votes

Final answer:

The simplest and most efficient solution for triggering two AWS Lambda functions simultaneously when PDFs are uploaded to an S3 bucket is to send the S3 event notification to an Amazon SNS topic with both Lambda functions as subscribers.

Step-by-step explanation:

To trigger both AWS Lambda functions simultaneously when a PDF is uploaded to an Amazon S3 bucket, it's important to choose a solution that allows for parallel processing. The most efficient way among the given options is to use Amazon Simple Notification Service (SNS). Option C is correct: Send the S3 event to an Amazon SNS topic that both Lambda functions subscribe to. This method is efficient because when the S3 event notification triggers the SNS topic, it can then fan out the message to multiple subscribers, which in this case would be the two Lambda functions. Each function receives the message independently and starts processing the PDF file simultaneously. This solution is simple to implement and does not require the management of additional copies of the PDF or the management of a queuing system.

User Sarwar Hasan
by
8.9k points

Related questions