Overview

Dynamic Image Transformation for Amazon CloudFront (formerly Serverless Image Handler) enables real-time image processing through the global content delivery network (CDN) of Amazon CloudFront. This AWS Solution helps you optimize visual content delivery while significantly reducing operational costs and complexity. By dynamically transforming a single source image on-demand, it eliminates the need to store multiple versions of the same image, resulting in substantial storage savings. This solution also enhances the user experience through faster load times with improved caching, while providing robust security controls to protect against inappropriate content, including URL signing, request validation, and content moderation features.
Benefits

Transform and optimize images in real-time through simple API requests, serving the most efficient format based on browser capabilities and helping ensure optimal file size and quality.
Store only original images and generate variants on-demand, eliminating the need for multiple versions of the same image and significantly reducing storage costs.
Protect visual assets with URL signing, request validation, and content moderation features while maintaining granular access controls over your image delivery.
Automatically handle varying loads with serverless architecture, enabling consistent performance during traffic spikes without managing infrastructure.
Technical details

You can automatically deploy this architecture using the implementation guide and the accompanying AWS CloudFormation template.
Step 1
An Amazon CloudFront distribution provides a caching layer to reduce the cost of image processing and the latency of subsequent image delivery. The CloudFront domain name provides cached access to the image handler API.
Step 2
An Amazon Simple Storage Service (Amazon S3) Object AWS Lambda Access Point (Large Object Deployment) or an Amazon API Gateway (API Gateway Deployment) acts as an endpoint resource, triggering the Lambda function.
Step 3
The Lambda function retrieves the image from a customer’s existing S3 bucket and uses sharp to generate the modified image.
Step 4
A solution-created S3 bucket provides log storage, separate from your customer-created S3 bucket for storing images. If you enter Yes (default entry) for the Deploy Demo UI template parameter, the solution deploys another S3 bucket for storing the optional demo UI.
Step 5
(Optional) If you enter Yes for the Enable Signature template parameter, the Lambda function retrieves the secret value from your existing AWS Secrets Manager secret to validate the signature. For more information, review Launch the stack.
Step 6
(Optional) If you use the smart crop or content moderation features, the Lambda function calls Amazon Rekognition to analyze your image and returns the results.
Step 7
A CloudFront function normalizes requests before triggering the origin in order to prevent false cache misses. In the Large Object deployment, an additional function is used on responses to have the Large Object Deployment more closely resemble the existing SIH interface.
- Publish Date
Use this solution in the Amazon Web Services China Regions.
Related content


When product design and software development company Perpetual began working with a new sports startup client, Perpetual quickly realized that it needed a solution for an image management tool that was both flexible and cost effective. Perpetual found the optimal fit for its challenge: Serverless Image Handler.
Serverless Image Handler (SIH) is an AWS Solution Implementation you use to store a single version of every image featured in your content, while dynamically delivering different versions at runtime based on your end user’s device.