Discover the most cost-effective way to generate thumbnails from photos uploaded to an Amazon S3 bucket. Learn how to leverage AWS services like Lambda and S3 event notifications to automatically create thumbnails and store them in a separate S3 bucket, minimizing costs and ensuring efficient processing.
Table of Contents
Question
A company runs an application that stores and shares photos. Users upload the photos to an Amazon S3 bucket. Every day, users upload approximately 150 photos. The company wants to design a solution that creates a thumbnail of each new photo and stores the thumbnail in a second S3 bucket.
Which solution will meet these requirements MOST cost-effectively?
A. Configure an Amazon EventBridge scheduled rule to invoke a script every minute on a long-running Amazon EMR cluster. Configure the script to generate thumbnails for the photos that do not have thumbnails. Configure the script to upload the thumbnails to the second S3 bucket.
B. Configure an Amazon EventBridge scheduled rule to invoke a script every minute on a memory-optimized Amazon EC2 instance that is always on. Configure the script to generate thumbnails for the photos that do not have thumbnails. Configure the script to upload the thumbnails to the second S3 bucket.
C. Configure an S3 event notification to invoke an AWS Lambda function each time a user uploads a new photo to the application. Configure the Lambda function to generate a thumbnail and to upload the thumbnail to the second S3 bucket.
D. Configure S3 Storage Lens to invoke an AWS Lambda function each time a user uploads a new photo to the application. Configure the Lambda function to generate a thumbnail and to upload the thumbnail to a second S3 bucket.
Answer
The most cost-effective solution for generating thumbnails from photos uploaded to an Amazon S3 bucket is option C:
Configure an S3 event notification to invoke an AWS Lambda function each time a user uploads a new photo to the application. Configure the Lambda function to generate a thumbnail and to upload the thumbnail to the second S3 bucket.
Explanation
Here’s why this solution is the most cost-effective:
- S3 event notifications: By configuring an S3 event notification to trigger a Lambda function whenever a new photo is uploaded, you ensure that the thumbnail generation process is initiated only when needed. This eliminates the need for constantly running resources, such as an Amazon EMR cluster or an EC2 instance, which would incur costs even when no new photos are being uploaded.
- AWS Lambda: Lambda is a serverless compute service that allows you to run code without provisioning or managing servers. With Lambda, you only pay for the compute time your code actually consumes, making it highly cost-effective for short-running tasks like generating thumbnails. Lambda automatically scales based on the number of events triggered, so you don’t need to worry about managing infrastructure.
- On-demand processing: By using S3 event notifications and Lambda, the thumbnail generation process is triggered only when a new photo is uploaded. This ensures that resources are used efficiently and you only pay for the processing required for each photo, rather than running a script every minute on an EMR cluster or EC2 instance, which would result in unnecessary costs.
- Minimal infrastructure management: With the combination of S3 event notifications and Lambda, you don’t need to manage any additional infrastructure, such as EMR clusters or EC2 instances. This reduces operational overhead and costs associated with maintaining and scaling infrastructure.
In summary, leveraging S3 event notifications to trigger an AWS Lambda function for generating thumbnails is the most cost-effective solution. It ensures that processing occurs only when needed, utilizes serverless computing with Lambda to minimize costs, and eliminates the need for managing additional infrastructure.
Amazon AWS Certified Solutions Architect – Associate SAA-C03 certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Amazon AWS Certified Solutions Architect – Associate SAA-C03 exam and earn Amazon AWS Certified Solutions Architect – Associate SAA-C03 certification.