Question

Difficulty: HardDecoupling Architectures and Event-Driven Messaging

A healthcare provider is designing a medical imaging pipeline. When a clinic uploads a raw MRI scan (50 MB50 \text{ MB} to 200 MB200 \text{ MB}) to an Amazon S3 bucket, the scan must be processed by a cluster of CPU-intensive workers. The processing tasks must be handled asynchronously. Due to compliance requirements, the scans must be processed in the exact order they are received by the system to ensure correct chronological correlation, and no scan should be processed more than once. The upload volume can peak unexpectedly, and processing can take up to 1212 minutes per scan.

Which solution meets these requirements with the least operational overhead?

  1. A
    Configure an Amazon S3 event notification to publish ObjectCreated events directly to an Amazon SQS FIFO queue. Configure the workers to consume messages from the FIFO queue.
  2. B
    Configure an Amazon S3 event notification to publish ObjectCreated events directly to an Amazon SQS standard queue. Configure the workers to consume messages from the standard queue.
  3. Enable Amazon EventBridge notifications on the Amazon S3 bucket. Create an EventBridge rule that routes S3 ObjectCreated events to an Amazon SQS FIFO queue, and configure the workers to consume messages from the FIFO queue.Answer
  4. D
    Configure an Amazon S3 event notification to trigger an AWS Lambda function that downloads the scan, performs the CPU-intensive processing directly within the function, and saves the result to another S3 bucket.

Answer

Enable Amazon EventBridge notifications on the Amazon S3 bucket. Create an EventBridge rule that routes S3 ObjectCreated events to an Amazon SQS FIFO queue, and configure the workers to consume messages from the FIFO queue.
The correct solution uses Amazon S3 EventBridge integration. Because Amazon S3 cannot publish events directly to an Amazon SQS FIFO queue, enabling EventBridge notifications on the bucket allows S3 to emit events to the default event bus. An EventBridge rule can then match these events and route them to an SQS FIFO queue. The SQS FIFO queue guarantees that the messages are processed in the order they were uploaded (first-in, first-out) and prevents duplicate processing (exactly-once processing) through deduplication. This architecture is asynchronous and serverless, minimizing operational overhead.

Step-by-Step Solution

1
Enable Amazon EventBridge notifications on the source Amazon S3 bucket.
S3 events are sent to the default EventBridge event bus.
S3 event notifications cannot target SQS FIFO queues directly, so EventBridge must be used as an intermediary.
2
Create an Amazon EventBridge rule that filters for ObjectCreated events on the specific S3 bucket and targets the SQS FIFO queue.
Object upload events are successfully formatted and routed to the FIFO queue.
EventBridge supports SQS FIFO queues as a target and retains metadata necessary for deduplication and ordering.
3
Configure the workers to consume messages from the SQS FIFO queue and delete them after successful processing.
The scans are processed in order, and the message visibility timeout prevents duplicate processing.
The SQS FIFO queue enforces first-in, first-out delivery and exactly-once processing by utilizing message deduplication IDs.

Key Concept

Using Amazon EventBridge to bridge S3 event notifications with Amazon SQS FIFO queues for strict ordering and deduplication.
Rate this question