AWS Certified Developer – Associate / Question #734 of 557

Question #734

A video streaming platform is expanding compatibility to support thousands of devices with varying screen resolutions. Thumbnail images for videos are stored in Amazon S3 in their original resolution. The platform uses Amazon CloudFront to serve these thumbnails. The app includes the device's resolution as a GET parameter in each request.

A developer needs to implement a solution that optimizes thumbnails for each device's resolution to improve load times and visual quality while minimizing costs.

Which solution MOST cost-effectively meets these requirements?

A

Use S3 Batch Operations with AWS Lambda to pre-generate thumbnail variants for all known resolutions. Configure a dynamic CloudFront origin to map requests to the appropriate pre-generated variant.

B

Use S3 Batch Operations with AWS Lambda to pre-generate thumbnail variants for all resolutions. Create a Lambda@Edge function to route requests to the correct pre-generated variant using request parameters.

C

Implement a Lambda@Edge function to generate optimized thumbnails on-demand for each request. Set CloudFront's TTL cache policy to its maximum value to reduce repeated processing.

D

Implement a Lambda@Edge function to generate optimized thumbnails on-demand and return them in the response. Store processed thumbnails in S3 within the same function to serve future requests directly.

Explanation

Option D is correct because it combines on-demand processing with persistent storage. When a device requests a thumbnail, Lambda@Edge generates the optimized version, stores it in S3, and returns it. Subsequent requests for the same resolution are served directly from S3 via CloudFront, reducing Lambda invocations and improving load times. This approach avoids the high storage costs of pre-generating all variants (A/B) and ensures only requested resolutions are stored. Option C's reliance solely on TTL caching risks outdated content and misses the cost-saving benefit of persisting processed thumbnails. D balances initial processing costs with long-term savings by caching results in S3, making it the most cost-effective solution.

Key Points:
- On-demand processing avoids pre-generating unused thumbnails.
- Storing processed thumbnails in S3 reduces future Lambda@Edge costs.
- CloudFront caching minimizes latency and origin requests.
- Pre-generating all variants (A/B) is storage-heavy and inflexible.
- Option C's TTL-only approach lacks persistence, risking repeated processing.

Answer

The correct answer is: D