DVA-C02 Question 54
Select 2You are building a serverless application that processes image uploads. When a user uploads an image to an S3 bucket, image metadata should be extracted and stored in DynamoDB. Additionally, the image should be resized into multiple resolutions and stored in another S3 bucket. Which combination of services and features would allow you to implement this architecture with an event-driven approach?
- A
Configure an S3 bucket to trigger an AWS Lambda function for image metadata extraction when a new object is uploaded.
- B
Use Amazon SQS to retrieve image objects from the S3 bucket and pass them to an AWS Lambda function for processing.
- C
Set up DynamoDB Streams to trigger AWS Lambda for metadata extraction.
- D
Use Amazon EventBridge to route S3 object creation events to AWS Lambda for image processing.
- E
Configure an S3 bucket to trigger multiple AWS Lambda functions, one for metadata extraction and another for image resizing.
Show answer and explanation
Correct answers: A, E
Explanation
To implement an event-driven architecture for processing image uploads, S3 event notifications allow you to trigger AWS Lambda functions when a new object is uploaded. This eliminates the need for intermediary services like SQS or EventBridge. By configuring S3 to trigger separate Lambda functions, you can perform tasks like metadata extraction and image resizing independently and in parallel, which aligns with the principles of serverless and event-driven design.
- A. Correct.
Correct. S3 can directly trigger an AWS Lambda function when a new object is uploaded, which is ideal for extracting metadata in an event-driven architecture.
- B. Incorrect.
Incorrect. While SQS can be used for decoupling and passing messages, it is not necessary here since S3 can directly trigger Lambda without needing an intermediary SQS queue.
- C. Incorrect.
Incorrect. DynamoDB Streams are used to capture changes in DynamoDB tables, but they are not relevant for triggering processing upon an image upload to S3.
- D. Incorrect.
Incorrect. Amazon EventBridge can route events, but S3 has native support for event notifications to Lambda, making EventBridge unnecessary in this scenario.
- E. Correct.
Correct. S3 event notifications can trigger multiple Lambda functions, enabling both metadata extraction and image resizing in parallel.