Menu
Serverless Image Handler
Serverless Image Handler

Architecture Overview

Automatic deployment of this solution configures the following components and functionality.


        Serverless Image Handler Architecture

Figure 1: Serverless Image Handler architecture on AWS

Note

This solution is intended for customers with public applications who want to provide an option for dynamically changing or manipulating their public images. As a result, this template creates a publicly accessible, unauthenticated CloudFront distribution and Amazon API Gateway endpoint in your account, allowing anyone to access it. For more information on Amazon API Gateway authorization, see the Security section.

The AWS CloudFormation template deploys a CloudFront distribution, Amazon API Gateway, and an AWS Lambda function. Amazon CloudFront provides a caching layer to reduce the cost of image processing and reduce the latency of subsequent image delivery. The API Gateway provides endpoint resources and triggers the Lambda function. The Lambda function retrieves the image from the customer's Amazon S3 bucket and uses Thumbor to return a modified version of the image to the API Gateway. 

The solution generates a CloudFront domain name that gives access to objects in a customer-specified bucket, as well as a partial URL. In your custom front-end application, you can append the CloudFront URL with the bucket path and image name to create a direct URL for each image object. Your users can then manipulate the image dynamically by adding Thumbor filters to the URL. Additionally, the solution deploys an optional sample user interface where you can more easily generate filters and tasks, and create example URLs that you can use for your images. For a list of filters that the solution supports, see Appendix A.

For customers who don’t want to add Thumbor filters into their URLs or who already have a naming convention in place, this solution includes a rewrite feature. This feature allows you to match existing URL patterns and apply Thumbor parameters automatically within your API. For more information, see Appendix B.