Cost-Effective Image Processing with SQS and S3 Lifecycle Policies

SAP-C02 By islever Editorial Last updated

Short answer

D Use Amazon SQS to process the S3 event, run an AWS Lambda function to resize and store the file in S3 Standard-IA, and create a Lifecycle policy to move images to Glacier Deep Archive after 6 months.

Question

A company that provides image storage services wants to deploy a customer-facing solution to AWS. Millions of individual customers will use the solution. The solution will receive batches of large image files, resize the files, and store the files in an Amazon S3 bucket for up to 6 months.
The solution must handle significant variance in demand. The solution must also be reliable at enterprise scale and have the ability to rerun processing jobs in the event of failure.
Which solution will meet these requirements MOST cost-effectively?
  1. Use AWS Step Functions to process the S3 event that occurs when a user stores an image. Run an AWS Lambda function that resizes the image in place and replaces the original file in the S3 bucket. Create an S3 Lifecycle expiration policy to expire all stored images after 6 months.
  2. Use Amazon EventBridge to process the S3 event that occurs when a user uploads an image. Run an AWS Lambda function that resizes the image in place and replaces the original file in the S3 bucket. Create an S3 Lifecycle expiration policy to expire all stored images after 6 months.
  3. Use S3 Event Notifications to invoke an AWS Lambda function when a user stores an image. Use the Lambda function to resize the image in place and to store the original file in the S3 bucket. Create an S3 Lifecycle policy to move all stored images to S3 Standard-Infrequent Access (S3 Standard-IA) after 6 months.
  4. Use Amazon Simple Queue Service (Amazon SQS) to process the S3 event that occurs when a user stores an image. Run an AWS Lambda function that resizes the image and stores the resized file in an S3 bucket that uses S3 Standard-Infrequent Access (S3 Standard-IA). Create an S3 Lifecycle policy to move all stored images to S3 Glacier Deep Archive after 6 months. Correct Answer

Key Takeaways

The main trap is focusing only on immediate storage costs; the correct solution prioritizes the 'rerun' and 'reliability' requirements through SQS DLQs and minimizes long-term storage costs using Glacier Deep Archive.

This question tests designing a cost-effective, reliable image processing architecture on AWS using SQS for decoupling and retries, Lambda for computation, and S3 Lifecycle policies for storage optimization.

Common mistake: Many candidates choose Option B (EventBridge) because it simplifies event routing. However, EventBridge drops events after maximum retries, failing the 'rerun' requirement, whereas SQS allows explicit reprocessing of failed messages.

Expert Analysis

The question requires a solution that is MOST cost-effective while handling significant demand variance, ensuring enterprise reliability, and allowing the ability to rerun processing jobs in the event of failure. It also specifies storing files for up to 6 months.

Option A uses AWS Step Functions triggered by S3 events. While Step Functions provide robust orchestration and retry logic (addressing the "rerun" requirement), they are generally more expensive than simple Lambda invocations for stateless tasks. More critically, Option A describes resizing the image in place and replacing the original file. This creates a race condition or infinite loop if not carefully managed with UUIDs or versioning, as the resize operation generates a new object that could trigger another event. Furthermore, it expires objects after 6 months, which meets the storage constraint but lacks the flexibility of lifecycle transitions.

Option B uses Amazon EventBridge. EventBridge does have built-in retries (up to 24 hours/185 attempts) for failed deliveries, but once retries are exhausted, the event is dropped. It does not inherently provide a mechanism to rerun a job manually or automatically after all retries fail without complex external configuration. Like Option A, it resizes in place, risking loops.

Option C uses S3 Event Notifications directly invoking Lambda. This is the simplest and cheapest invocation model but offers no built-in retry or dead-letter queue (DLQ). If the Lambda fails, the event is lost unless the caller implements retry logic. It also moves data to Standard-IA after 6 months, which is a valid cost-saving strategy.

Option D uses Amazon SQS. SQS provides a durable message queue that decouples the S3 event from the Lambda processor. This architecture is highly scalable (handling variance) and reliable. Crucially, SQS allows for dead-letter queues (DLQs) and manual inspection/reprocessing of messages that fail multiple times, directly satisfying the "ability to rerun processing jobs in the event of failure" requirement. Regarding cost: Lambda handles the processing. Storing images in S3 Standard-IA initially is appropriate for data accessed infrequently after creation. Moving to Glacier Deep Archive after 6 months is extremely cost-effective for long-term retention. Although the prompt says "store... for up to 6 months," moving to Deep Archive is a valid interpretation of minimizing cost for archived data, especially since the primary access window is implied to be shortly after upload. The key differentiator is the reliability and rerun capability provided by SQS DLQs, which Options A, B, and C lack in their described configurations (A/B rely on transient event delivery, C has no retries).

However, there is a nuance: Option D moves data to Glacier Deep Archive. Is this "cost-effective"? Yes, Deep Archive is the cheapest storage tier. Does it meet the "store for up to 6 months" requirement? Yes, it stores them there. The "rerun" requirement is best met by SQS's ability to reprocess failed messages via DLQ or redrive policies. Options A and B are less reliable for guaranteed reruns upon total failure. Option C has no retry mechanism. Therefore, D is the most robust and cost-effective for enterprise scale.

Official Reference

Exam Strategy

When questions ask for 'reliability' and 'rerun' capabilities in serverless architectures, look for queuing services like SQS or SNS with DLQs. Direct event triggers (S3 -> Lambda) or even EventBridge often lack the explicit 'rerun' control after final failure compared to a queue-based pattern where messages can be inspected and redriven.

Frequently Asked Questions

Why is SQS better than EventBridge for this scenario?

SQS provides a persistent message store with Dead-Letter Queues (DLQs), allowing you to inspect and manually or automatically rerun failed messages. EventBridge eventually drops events after retries are exhausted, making 'rerunning' harder without external state management.

Is moving images to Glacier Deep Archive cost-effective?

Yes, Glacier Deep Archive is the lowest-cost storage tier on AWS. Since the images are stored for up to 6 months and likely accessed infrequently after initial processing, this transition significantly reduces storage costs.

More SAP-C02 FAQ →

Community Votes

B
40%
D
38%
A
18%
C
4%

40% of anonymous learners picked answer B. Votes are pick records left by other test-takers — they are not the verified answer.

Discussion 67 contributions

Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.

From public community threads 30 of 67

  1. thala 👍 19 Answered B
    Considering the requirements, Option B (Amazon EventBridge with AWS Lambda and S3 Lifecycle Expiration Policy) seems to be the most cost-effective and appropriate solution. It combines the scalability and flexibility of AWS Lambda for image processing with the straightforward event handling of Amazon EventBridge, and appropriately manages the image lifecycle with an S3 expiration policy. While Option C is also a strong contender, the misalignment of the lifecycle policy with the requirement makes Option B a better fit. Option A might be more suitable for complex workflows but is likely not needed for this scenario, and Option D includes unnecessary long-term archival steps.
  2. yuliaqwerty 👍 12
    B is for sure A no because Step Function is not in list of s3 event destinations https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-event-types-and-destinations.html C and D has option for storing data longer than 6 months which is not required
  3. LazyAutonomy 👍 10 Answered D
    A, B and C - there's no mechanism to retry failed jobs, so these options don't meet the mandatory requirement: "The solution must also be reliable at enterprise scale and have the ability to rerun processing jobs in the event of failure." There's no mandatory requirement to delete the files after 6 months. D - meets the mandatory requirements.
  4. GaryQian 👍 6 Answered D
    I will vote for D. The question mentioned backend service will resize the large images and store them in S3. It doesn't say S3 needs to store original iamges. Both A & B will save original iamges. D looks good for all requirements ( retry, 6months ,etc.. )
  5. 2aa2222 👍 5
    Let’s break down the question into some decisive pieces: 1.Millions of customers will use solution  this to me has to be a robust queuing solution (like SQS, not eventbridge, not step-function) 2.Store the files in an Amazon S3 bucket for up to 6 months This doesn’t talk about deleting the files. It says store in “an” S3 bucket for 6-months, which means it can definitely go to another “MOST cost-effective” bucket, i.e. Glacier Deep Archive 3.Solution must handle significant variance in demand  “significant” variance can be interpreted as infrequent usage. 4.Solution must also be reliable /ability to rerun processing in the event of failure – Only SQS can achieve this. My verdict: Answer = D
Show 25 more comments
  1. HunkyBunky 👍 5 Answered D
    Only option D provides a ability for rerun processing jobs in the event of failure. B - don't provide a way for rerun job, EventBridge able to do retry only if the message are not sent to consumer, but it not able to rerun job in case of failure. All other options not provide rerun ability at all. I'm agree that option D is not ideal with DeepArchive, but only this option provide a way for rerun job in case of failure.
  2. Helpnosense 👍 5 Answered D
    Vote D because the requirement "rerun processing jobs in the event of failure." Glacier Deep archive is also really cost-effective
  3. Spike2020 👍 4 Answered D
    This is a very malformed question. It should be D because SQS can handle failure. But then the archiving policy is not requested. So all options are not optimal in my opinion.
  4. AloraCloud 👍 4
    Yes it is .... https://docs.aws.amazon.com/AmazonS3/latest/userguide/EventBridge.html
  5. kgpoj 👍 4
    How do you rerun for failure with option B? SQS can handle "rerun", hence D
  6. mkgiz 👍 4 Answered D
    "ability to rerun processing jobs in the event of failure"
  7. trap 👍 3
    Correct: A An S3 event is created by eventbridge and can trigger a step function. Image processing cannot be done a lambda function alone. Step function is preferred for image processing. You also need the ability to rerun the jobs. https://docs.aws.amazon.com/step-functions/latest/dg/use-cases-data-processing.html https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-cloudwatch-events-s3.html
  8. Dgix 👍 3 Answered B
    Another poorly worded question. First of all, C and D can be eliminated since they keep files after the 6 month period. Then, both A and B are valid. Both will use a Lambda to do the work, but the state changes in the Step Function will incur a very slight cost. Personally, I'd choose A to get control of retries, etc, but the MOST cost-effective alternative is B.
  9. tfl 👍 3 Answered A
    "have the ability to rerun processing jobs in the event of failure"... How we can handle this requirement? I believe step functions triggered by the event in S3 through Eventbridge would do the trick for the retry mechanism. Also, only A and B matches the "up to 6 months" retention requirement
  10. felon124 👍 3 Answered D
    1. The solution must also be reliable at enterprise scale and have the ability to rerun processing jobs in the event of failure. Use SQS , option A / B / C are not include AWS SQS. 2. The cost-effective solution , option D contains S3 Glacier Deep Archive to reduce S3 storage costs
  11. SIJUTHOMASP 👍 3 Answered D
    Invoking Lambda directly won't give any resiliency - so C is not a choice. Since the Event Bridge solution tries to replace original file - its rule out. Step function can't be destined from S3 - A is out. Hence the right answer is D through SQS meeting the need for re-run.
  12. PAUGURU 👍 3 Answered A
    C and D are out because there is no need to keep images after 6 months. Step function is the solution for retry, as stated on AWS description: "AWS Step Functions automatically handles errors and exceptions with built-in try/catch and retry". So answer is A for me.
  13. nimbus_00 👍 3 Answered D
    You’ve got to have a buffer for reruns! For those concerned about the 6 months TTL in S3 remember glacier isn’t S3.
  14. TewatiaAmit 👍 3 Answered D
    SQS ensured that any failed jobs can be retried.
  15. bjexamprep 👍 2 Answered A
    Bad question design. The question doesn't mention storing the images after 6 months, so the images should be discarded after 6 months. So, C and D are out. EventBridge invokes Lambda, and if the Lambda fails, it won't start a new Lambda to rerun the process, cause the event is gone. So, B is out. A is missing sth as well. Step Function is not on the list of S3 event, so EventBridge should be here. And Step Function is too heavy comparing with SQS for this job. Comparing all the answers, I will choose A, even it is not ideal.
  16. 0b43291 👍 2 Answered D
    Difficult one. Both options B and D meet the specific requirement of storing the files in an Amazon S3 bucket for up to 6 months. However, when considering the additional requirements of being reliable at enterprise scale, having the ability to rerun processing jobs in the event of failure, and being the most cost-effective solution, option D with Amazon SQS, AWS Lambda, and the S3 Lifecycle policy to transition to Glacier Deep Archive is still the better choice. No Rerun of jobs with B. Only D
  17. Curious76 👍 2 Answered D
    The solution will receive batches of large image files, resize the files, and store the files in an Amazon S3 bucket for up to 6 months. It dosent mean delete after 6 months. Option D preserves this logic: Receives the original image and stores it in S3. Lambda resizes it and stores another copy (the resized one). You now have both files. S3 lifecycle rules manage cost: Store in Standard-IA initially, then move to Glacier Deep Archive if needed, or delete after 6 months.
  18. igor12ghsj577 👍 2 Answered B
    By default, EventBridge retries sending the event for 24 hours and up to 185 times with an exponential back off and jitter, or randomized delay. If an event isn't delivered after all retry attempts are exhausted, the event is dropped and EventBridge doesn't continue to process it. To avoid losing events after they fail to be delivered to a target, you can configure a dead-letter queue (DLQ) and send all failed events to it for processing later.
  19. e4bc18e 👍 2
    That is wrong lambda functions alone can be used to resize images, there is no need for step functions, there is even an article on this from 6 YEARS AGO on how to resize images just with lambda https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/
  20. tgv 👍 2 Answered D
    Everybody is focused on choosing the MOST cost-effective option, but there's also this requirement: "The solution must also be reliable at enterprise scale and have the ability to rerun processing jobs in the event of failure." which I believe it can be achieved only by option D
  21. Halliphax 👍 2 Answered B
    "Store the images in S3 for six months" - leaves only option B. Options C & D mean keeping the images in S3 forever and that's not the more cost effective option compared to just deleting the files as the question implies is a requirement.
  22. henrikhmkhitaryan59 👍 2 Answered D
    Options A and B imply replacing the original image, which will cause an execution loop. Option C doesn't allow rerunning failed jobs. Therefore, only option D meets all the requirements.
  23. thotwielder 👍 2 Answered A
    a: step function for 'the ability to rerun processing jobs in the event of failure'. c,d out for keeping the files after 6 months. b: not able to rerun failures..
  24. dutchy1988 👍 2
    Allthough Eventbridge CAN retry jobs, it relies implicitly on a standard SQS resource. -> another resource -> more costs. So A seems the best fit.
  25. teo2157 👍 2 Answered A
    Going for A as it's the only option that achieve reprocessing, B could be a good answer but it doesn´t allow any reporcessing.

Reader comments & corrections

No reader corrections yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Practice All SAP-C02 Questions

Access 85 questions with complete answers and detailed explanations.

View Full SAP-C02 Practice Test →

← Back to SAP-C02 Study Guide