Which solution will meet these requirements MOST cost-effectively?
Use S3 Batch Operations to invoke an AWS Lambda function to create new variants of the photos with the required dimensions and resolutions. Create a dynamic CloudFront origin that automatically maps the request of each device to the corresponding photo variant.
Use S3 Batch Operations to invoke an AWS Lambda function to create new variants of the photos with the required dimensions and resolutions. Create a Lambda@Edge function to route requests to the corresponding photo variant by using request headers.
Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. Change the CloudFront TTL cache policy to the maximum value possible.
Create a Lambda@Edge function that optimizes the photos upon request and returns the photos as a response. In the same function, store a copy of the processed photos on Amazon S3 for subsequent requests.
Explanations:
This option requires creating a dynamic CloudFront origin to map requests to photo variants. This could lead to complexity and higher costs due to multiple origins and potential latency when retrieving variants.
While this option involves using S3 Batch Operations and Lambda functions to create photo variants, it relies on Lambda@Edge to route requests. Lambda@Edge may add latency during the request routing and would incur additional costs for execution.
This option optimizes photos on-demand but does not store the optimized versions. While it could provide some benefits, repeatedly processing the same photo for each request could lead to higher latency and increased costs due to continuous processing.
This option optimizes photos on-demand while also storing the optimized versions in S3. It balances cost-effectiveness by reducing the need for repeated processing of the same image, thereby improving load times for subsequent requests and maintaining good quality.