
Answer-first summary for fast verification
Answer: Create an Amazon Simple Queue Service (Amazon SQS) queue. Configure the S3 bucket to send a notification to the SQS queue when an image is uploaded to the S3 bucket., Configure the Lambda function to use the Amazon Simple Queue Service (Amazon SQS) queue as the invocation source. When the SQS message is successfully processed, delete the message in the queue.
## Explanation **Correct Answers: A and B** ### Why A and B are correct: **Option A:** Creating an SQS queue and configuring S3 bucket notifications to send events to the queue provides a **durable, decoupled messaging system**. When an image is uploaded to S3, S3 can send an event notification to the SQS queue, which will store the message until it's processed. This ensures no upload events are lost even if the processing system is temporarily unavailable. **Option B:** Configuring the Lambda function to use SQS as an invocation source creates an **event-driven, stateless architecture**. Lambda can be triggered by SQS messages, and when a message is successfully processed, Lambda automatically deletes it from the queue (or you can configure it to do so). This ensures exactly-once processing semantics and automatic scaling based on queue depth. ### Why the other options are incorrect: **Option C:** This approach is problematic because: - Writing to a text file in memory is **not durable** - if the Lambda function crashes or times out, the tracking information is lost - Lambda functions are **stateless** and cannot reliably maintain state between invocations - Multiple concurrent Lambda invocations could cause race conditions when accessing the same in-memory file **Option D:** This introduces unnecessary complexity and stateful components: - Launching an EC2 instance creates a **stateful, managed component** that requires maintenance, monitoring, and scaling - Logging file names in a text file on EC2 creates **stateful tracking** that could be lost if the instance fails - This approach violates the requirement for **durable, stateless components** **Option E:** This doesn't automate the processing: - Sending alerts to an SNS topic with the owner's email address requires **manual intervention** - This doesn't trigger the Lambda function automatically to process the images - It doesn't meet the requirement for **automatic processing** ### Key Architecture Principles: 1. **Durability**: SQS provides message durability with at-least-once delivery 2. **Statelessness**: Lambda functions are inherently stateless and ephemeral 3. **Decoupling**: S3 events → SQS → Lambda creates loose coupling between components 4. **Automatic scaling**: Lambda automatically scales based on SQS queue depth 5. **Event-driven**: The entire workflow is triggered by S3 upload events This architecture ensures reliable, scalable, and maintainable image processing without manual intervention.
Ultimate access to all questions.
No comments yet.
Author: LeetQuiz Editorial Team
An application development team is designing a microservice that will convert large images to smaller, compressed images. When a user uploads an image through the web interface, the microservice should store the image in an Amazon S3 bucket, process and compress the image with an AWS Lambda function, and store the image in its compressed form in a different S3 bucket.
A solutions architect needs to design a solution that uses durable, stateless components to process the images automatically.
Which combination of actions will meet these requirements? (Choose two.)
A
Create an Amazon Simple Queue Service (Amazon SQS) queue. Configure the S3 bucket to send a notification to the SQS queue when an image is uploaded to the S3 bucket.
B
Configure the Lambda function to use the Amazon Simple Queue Service (Amazon SQS) queue as the invocation source. When the SQS message is successfully processed, delete the message in the queue.
C
Configure the Lambda function to monitor the S3 bucket for new uploads. When an uploaded image is detected, write the file name to a text file in memory and use the text file to keep track of the images that were processed.
D
Launch an Amazon EC2 instance to monitor an Amazon Simple Queue Service (Amazon SQS) queue. When items are added to the queue, log the file name in a text file on the EC2 instance and invoke the Lambda function.
E
Configure an Amazon EventBridge (Amazon CloudWatch Events) event to monitor the S3 bucket. When an image is uploaded, send an alert to an Amazon Simple Notification Service (Amazon SNS) topic with the application owner's email address for further processing.