Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

brightinteractive/serverless-sharp

Open more actions menu
 
 

Repository files navigation

Bright-specific documentation

This is a forked repository. The original uses an unsupported version of Node. Our newer version of Node means a newer version of Serverless, which means some slightly different instructions for deployment:

  1. npm ci
  2. cp settings.example.yml settings.yml
  3. Configure settings.yml file
  4. Configure the service name in serverless.yml (this is no longer configurable in the settings.yml file)
  5. Ensure you have AWS CLI configured on your machine with a role that has permission to create all the infrastructure required to deploy the lambda (likely an admin role).
  6. Run sls deploy --aws-profile=ROLE_WITH_SUFFICIENT_PERMISSIONS --stage=STAGE_FROM_SETTINGS_TO_DEPLOY --param='settings=settings.yml'

Serverless Sharp Image Processor

A solution to dynamically optimize and transform images on the fly, utilizing Sharp and AWS Lambda.

Documentation

Brought to you by Venveo

Who is this for?

This software is for people who want to optimize and run basic transformations (crop, scale, convert, etc) on images from an existing S3 bucket without running computationally expensive processes or servers or paying for expensive third-party services.

Serverless Sharp is a drop-in replacement for most essential features of Imgix and costs magnitudes less for most users.

How does it work?

After deploying this solution, you'll find yourself with a number of AWS resources (all priced based on usage rather than monthly cost). The most important of which are:

  • AWS Lambda: Pulls images from your S3 bucket, runs the transforms, and outputs the image from memory
  • API Gateway: Acts as a public gateway for requests to your Lambda function
  • Cloudfront Distribution: Caches the responses from your API Gateway so the Lambda function doesn't re-execute

Once deployed, a Cloudfront CDN distribution is generated that is directed to the generated API Gateway. This distribution ensures the Lambda function does not get run multiple times for the same image request.

Running Locally

This package uses Serverless to allow for local development by simulating API Gateway and Lambda.

  1. npm ci
  2. cp settings.example.yml settings.yml
  3. Configure settings.yml file
  4. Ensure you have AWS CLI configured on your machine with proper access to the S3 bucket you're using in your settings.
  5. Run serverless offline

About

Serverless image optimizer for S3, Lambda, and Cloudfront

Resources

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.