Transform and optimize images in real-time through simple API requests or pre-defined transformation policies.
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 automatically 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
Streamlined image optimization
Cost-effective storage management
Automatically serve the most efficient image size and format based on device type and browser capabilities, helping ensure optimal file size and quality, and eliminating the need to manage and store multiple versions of the same image.
Advanced security controls
Protect visual assets with URL signing, request validation, and content moderation features while maintaining granular access controls over your image delivery.
Scalable architecture
Automatically handle varying loads with serverless architecture, enabling consistent performance during traffic spikes without managing infrastructure.
How it works
This solution provides secure, scalable, dynamic image transformation capabilities using a serverless containerized AWS architecture. It leverages a Amazon CloudFront Functions for request and response normalization, with requests routed through Application Load Balancer to Amazon ECS Fargate containers that perform the image processing. The containerized workload pulls the source images from Amazon S3 or external origins and integrates with Amazon Rekognition for AI-powered transformations like smart-cropping. The architecture includes a comprehensive management interface built on AWS Amplify and secured by Amazon Cognito, with API Gateway, Lambda, and DynamoDB for configuration management. Amazon CloudFront provides edge caching for optimized delivery.
Open implementation guide
Step 1
An Amazon CloudFront distribution provides global caching and content delivery.
An Application Load Balancer (ALB) distributes incoming requests across multiple ECS tasks for high availability and scalability.
Amazon Elastic Container Service (ECS) tasks running on AWS Fargate process image transformation requests using containerized applications.
ECS tasks maintain in-memory caches of transformation policies and origin mappings for fast request resolution and reduced latency.
Images are retrieved from multiple origin types: Amazon S3 buckets or external HTTP-accessible domains based on configured origin mappings.
An administrative interface built with AWS Amplify provides policy and origin management capabilities through a secure web interface.
Amazon DynamoDB stores transformation policies, origin configurations, and mapping rules with high availability and performance.
Amazon Cognito provides authentication and authorization for the administrative interface.
(Optional) Amazon Rekognition integration for smart cropping and content moderation features.
This solution enables secure, scalable, dynamic image transformations using a serverless AWS architecture. It starts with CloudFront Functions for request and response normalization, uses API Gateway and Lambda for image processing, integrates with Rekognition for AI-powered features, and stores images in S3. Request signing validation is handled through Secrets Manager, while CloudFront provides edge caching for optimized delivery.
Open implementation guide
Step 1
An Amazon CloudFront distribution provides a caching layer to reduce the cost of image processing and the latency of subsequent image delivery.
Amazon API Gateway provides endpoint resources and initiates the AWS Lambda function.
A Lambda function retrieves the image from a customer’s existing
Amazon S3
bucket and uses
sharp
to return a modified version of the image to the API Gateway.
A solution-created S3 bucket provides log storage, separate from your customer-created S3 bucket for storing images.
(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.
(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.
The viewer request is proxied through an Amazon CloudFront function to normalize headers and query parameters for improved cache hit rates.
Deploy with confidence
We'll walk you through it
Get started fast. Read the implementation guide for deployment steps, architecture details, cost information, and customization options.
Let's make it happen
Ready to deploy? Follow a step-by-step guide in the AWS Console to begin setting up the infrastructure you need. You'll be prompted to access your AWS account if you haven't yet logged in.
Deployment options
Implementation guide
Follow the implementation guide for step-by-step actions to deploy this AWS Solution.
Source code
The source code for this AWS Solution is available in GitHub.
AWS Launch Wizard
Use AWS Launch Wizard for step-by-step guided deployment.
CloudFormation template (ECS)
View or modify the CloudFormation template to customize your deployment.
CloudFormation template (Lambda)
View or modify the CloudFormation template to customize your deployment.
Related content
Fast and Cost-Effective Image Manipulation
This blog explores AWS EC2 instance storage, focusing on temporary block-level storage for instances, ideal for temporary data or caches.
Perpetual
Find out how Perpetual delivered a simple, cost-effective approach to image optimization for its client by using an AWS Solution.
Solving with AWS Solutions
This video discusses AWS services and Sharp for efficient, scalable, cost-effective image processing with Amazon CloudFront and S3 for global delivery and storage.
Customer stories
"Getting a working test version only took a couple of days. Within 2 weeks we launched in production and had migrated 75% of our image transformations at roughly ¼ of the cost we were previously paying the third-party service. On top of that, we still don't need to worry about maintaining the pipeline infrastructure or scaling servers due to the Amazon CloudFront, Amazon S3, and AWS Lambda architecture. Now our product team can get back to thinking about what more we can do with photos rather than how we can reduce the costs associated with transforming them."
Martin Eckart Systems Architect, Fotaflo
"At Map Your Show we manage thousands of images across web-based exhibitor profiles and mobile apps. By using Dynamic Image Transformation for CloudFront, we've simplified our image collection process and improved exhibitor platform onboarding time by 37%. The solution has been instrumental in helping us deliver high-performance, dynamically transformed images at scale— all without the need to manage multiple variants or maintain additional infrastructure."
Drew Martin, VP of Technology, Map Your Show
“Dynamic Image Transformation for Amazon CloudFront has proven it can scale globally while keeping availability high and image delivery efficient. For us, it’s been a complete solution for handling image optimization and delivery.”
Vishal Gandhi, CTO, Perpetual