Architecture Overview - Serverless Image Handler

Architecture Overview

Deploying this solution builds the following environment in the AWS Cloud.

        Serverless Image Handler Architecture

Figure 1: Serverless Image Handler architecture on AWS


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 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 Simple Storage Service (Amazon S3) bucket and uses Sharp to return a modified version of the image to the API Gateway. Additionally, the solution generates a CloudFront domain name that provides cached access to the image handler API.