Which solution will meet these requirements with the LEAST operational overhead?
Install an external image management library on an EC2 instance. Use the image management library to process the images.
Create a CloudFront origin request policy. Use the policy to automatically resize images and to serve the appropriate format based on the User-Agent HTTP header in the request.
Use a Lambda@Edge function with an external image management library. Associate the Lambda@Edge function with the CloudFront behaviors that serve the images.
Create a CloudFront response headers policy. Use the policy to automatically resize images and to serve the appropriate format based on the User-Agent HTTP header in the request.
Explanations:
Installing an external image management library on an EC2 instance involves significant operational overhead, including instance management, scaling, and maintenance of the library and server. This solution is not optimal for dynamically processing and serving images at scale.
A CloudFront origin request policy does not support dynamic image resizing or format serving based on User-Agent. Origin request policies are primarily used for forwarding headers, query strings, and cookies to the origin, not for processing images.
Using a Lambda@Edge function allows for dynamic image processing at the edge locations of CloudFront, minimizing latency and reducing the load on the origin. It can resize images and serve appropriate formats based on the User-Agent HTTP header, thus providing a scalable and efficient solution with low operational overhead.
A CloudFront response headers policy cannot perform dynamic image resizing or serve different formats based on User-Agent. Response headers policies are used to control HTTP response headers and do not include functionality for image processing.