DOP-C02 Question 305
Single answerYou are designing a serverless event-driven architecture for a video processing application on AWS. When a new video is uploaded to an S3 bucket, metadata about the video should be processed and stored in DynamoDB, and the video itself should be transcoded into multiple formats. Both tasks (metadata processing and transcoding) need to happen concurrently and independently. Which solution would best achieve this architecture?
- A
Configure an S3 event notification to directly invoke two AWS Lambda functions: one for metadata processing and the other for transcoding.
- B
Use an S3 event notification to publish an event to an Amazon SNS topic, and subscribe two AWS Lambda functions to the topic.
- C
Use an S3 event notification to send messages to an Amazon SQS queue, and have two AWS Lambda functions poll the queue.
- D
Use an S3 event notification to trigger a Step Functions workflow to orchestrate the metadata processing and transcoding tasks.
Show answer and explanation
Correct answer: B
Explanation
The application requires a fan-out architecture to process two tasks (metadata processing and transcoding) concurrently and independently when a new video is uploaded to S3. Amazon SNS is the best service for implementing a fan-out pattern, as it allows multiple subscribers (Lambda functions) to independently process the same event in parallel. Other options either lack the ability to fan out events or introduce unnecessary complexity.
- A. Incorrect.
This option is not ideal because S3 does not allow simultaneous invocation of multiple Lambda functions for a single event. You would need a fan-out mechanism like SNS to achieve concurrent and independent processing.
- B. Correct.
This is the correct solution. SNS enables a fan-out pattern where multiple subscribers (in this case, Lambda functions) can independently process the same event concurrently. This matches the requirement for both metadata processing and transcoding to happen independently.
- C. Incorrect.
Using SQS would require additional complexity. SQS is designed for message queuing and would not natively support the fan-out pattern required for this use case. Each Lambda function would need independent polling logic.
- D. Incorrect.
Step Functions is more suitable for orchestrating sequential or interdependent tasks. In this scenario, the tasks are independent and need to run concurrently, which is better handled by SNS.