Q22 — AWS SAA-C03 Ch.13

Question 22 of 100 | ← Chapter 13

Q922. A company has an application that customers use to upload images to an Amazon S3 bucket. Each night, the company launches an Amazon EC2 Spot Fleet that processes all the images that the company received that day. The processing for each image takes 2 minutes and requires 512 MB of memory.A solutions architect needs to change the application to process the images when the images are uploaded.Which change will meet these requirements MOST cost-effectively?

Correct Answer: A. Use S3 Event Notifications to write a message with image details to an Amazon Simple Queue Service (Amazon SQS) queue. Configure an AWS Lambda function to read the messages from the queue and to process the images.

Explanation

To change the application to process the images when they are uploaded in a cost-effective manner, the most suitable solution is:A. Use S3 Event Notifications to write a message with image details to an Amazon Simple Queue Service (Amazon SQS) queue. Configure an AWS Lambda function to read the messages from the queue and process the images.Option A suggests using S3 Event Notifications to trigger the application flow. When an image is uploaded to the S3 bucket, an event notification is generated, and a message with image details can be written to an Amazon SQS queue.By configuring an AWS Lambda function to read the messages from the SQS queue, the company can achieve serverless image processing. Lambda functions are cost-effective because they only incur charges when they are executing, and they can automatically scale based on the incoming workload.This solution allows for parallel processing of images by spinning up multiple Lambda function instances, which can process the images asynchronously. The Lambda function can be configured to allocate the required memory (512 MB) and execute the image processing logic.Option B suggests using an EC2 Reserved Instance to read the messages from the SQS queue and process the images. However, using an EC2 Reserved Instance introduces unnecessary overhead in managing and scaling EC2 instances, which may not be cost-effective compared to the serverless approach provided by AWS Lambda.Option C suggests configuring a container instance in Amazon Elastic Container Service (Amazon ECS) to subscribe to an Amazon SNS topic for processing the images. While this option provides flexibility in container management, it introduces additional complexity and operational overhead compared to the serverless approach with AWS Lambda.Option D suggests configuring an AWS Elastic Beanstalk application to subscribe to an Amazon SNS topic for processing the images. Elastic Beanstalk is a platform-as-a-service (PaaS) offering, which may not be the most cost-effective approach for this specific use case compared to the serverless option with AWS Lambda.In summary, option A, using S3 Event Notifications to write messages to an SQS queue and configuring an AWS Lambda function to process the images, provides a cost-effective and efficient solution for processing the uploaded images in a serverless manner.