All Projects → adnanrahic → Serverless Docker Image Resize

adnanrahic / Serverless Docker Image Resize

Simple serverless image resize on-the-fly - Deploy with one command - Built with AWS Lambda and S3

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Serverless Docker Image Resize

Retinal
🏙 Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered
Stars: ✭ 208 (+82.46%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework, aws-s3, image-processing
Serverless Aws Lambda Node Postgres
Serverless AWS Lambda with Node.js,Postgres Rest API with Sequelize.
Stars: ✭ 18 (-84.21%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Plugin Git Variables
⚡️ Expose git variables to serverless
Stars: ✭ 75 (-34.21%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Node Simple Image Resize
Simple image resize AWS lambda function
Stars: ✭ 74 (-35.09%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Photo Recognition
A collection of 3 lambda functions that are invoked by Amazon S3 or Amazon API Gateway to analyze uploaded images with Amazon Rekognition and save picture labels to ElasticSearch (written in Kotlin)
Stars: ✭ 345 (+202.63%)
Mutual labels:  aws, serverless, aws-lambda, aws-s3
Webiny Js
Enterprise open-source serverless CMS. Includes a headless CMS, page builder, form builder and file manager. Easy to customize and expand. Deploys to AWS.
Stars: ✭ 4,869 (+4171.05%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Image Processor
AWS Lambda image processor
Stars: ✭ 106 (-7.02%)
Mutual labels:  aws, aws-lambda, aws-s3, image-processing
Serverlessbydesign
A visual approach to serverless development. Think. Build. Repeat.
Stars: ✭ 254 (+122.81%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-55.26%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Ng Toolkit
⭐️ Angular tool-box! Start your PWA in two steps! Add Serverless support for existing projects and much more
Stars: ✭ 1,116 (+878.95%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Aws Github Actions
Deploy 🚀 to AWS ☁️ with GitHub Actions!
Stars: ✭ 70 (-38.6%)
Mutual labels:  aws, serverless, aws-lambda, aws-s3
Express
⚡ Take existing Express.js apps and host them easily on cheap, auto-scaling, serverless infrastructure (AWS Lambda and AWS HTTP API).
Stars: ✭ 337 (+195.61%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Plugin Canary Deployments
Canary deployments for your Serverless application
Stars: ✭ 283 (+148.25%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless Node Simple Messaging
Simple email AWS lambda function
Stars: ✭ 75 (-34.21%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Aws Auto Cleanup
Open-source application to programmatically clean your AWS resources based on a whitelist and time to live (TTL) settings
Stars: ✭ 276 (+142.11%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Graphql Serverless
Sample project to guide the use of GraphQL and Serverless Architecture.
Stars: ✭ 28 (-75.44%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Serverless
⚡ Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! –
Stars: ✭ 41,584 (+36377.19%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (+100%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework
Nuxt Serverless
Nuxt.js Serverless SSR Starter on AWS (Lambda + API Gateway + S3) with Serverless Framework
Stars: ✭ 235 (+106.14%)
Mutual labels:  aws, aws-lambda, serverless-framework, aws-s3
Chalice
Python Serverless Microframework for AWS
Stars: ✭ 8,513 (+7367.54%)
Mutual labels:  aws, serverless, aws-lambda, serverless-framework

Image resize on the fly AWS Lambda function with Serverless and Node.js

A simple Serverless service for creating an image resize-on-the-fly function with AWS Lambda. For Sharp to work correctly it must be installed in the same environment the production is running in. Because AWS Lambda is running on Amazon Linux it must be installed on the same system.

For this purpose we're using Docker to spin up a container, install the Serverless Framework and deploy the function from inside the container.

This service will deploy both the AWS Lambda function and AWS S3 bucket from where the images will be grabbed, resized and put back.

Getting Started (Ubuntu-based Linux Systems)

These instructions will get you up and running. See deployment for notes on how to deploy the project on a live system.

Clone to your local machine:

$ git clone https://github.com/adnanrahic/serverless-docker-image-resize.git

Change into the cloned dir:

$ cd serverless-docker-image-resize

Install Docker and docker compose:

  1. Install Docker
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
$ sudo apt-get update
$ apt-cache policy docker-ce
$ sudo apt-get install -y docker-ce

After typing the command:

$ sudo systemctl status docker

You should see the service is running.

Output
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2016-05-01 06:53:52 CDT; 1 weeks 3 days ago
     Docs: https://docs.docker.com
 Main PID: 749 (docker)
  1. Install Docker Compose
$ sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose -v

This will print the installed version:

Output
docker-compose version 1.21.2, build a133471

All dependencies are installed. Now, deployment is a breeze.

Deployment

Configure secrets

1. secrets.json

The deploy.sh script will autogenerate this file. No need to touch it at all.

2. secrets.env

Add your secret keys and configuration variables here.

SLS_KEY=XXX
SLS_SECRET=YYY
STAGE=dev
REGION=us-east-1
BUCKET=images.your-domain.com

Run Docker Compose

$ docker-compose up --build

This will build the image, create a container, run the deploy.sh script inside the container and deploy all the resources.

The command line will log out the service endpoints and all info. What's important to note is the bucket name and URL you need to access your images. Check out Usage.

Usage

After the service has been deployed, you will receive a bucket endpoint. You will add a query parameter to it in order to tell it how to resize the image. The bucket will behave as a public website.

Let's upload an image so we have something to work with.

$ aws s3 cp --acl public-read IMAGE_NAME.jpg s3://BUCKET

Example 1:

http://BUCKET.s3-website.REGION.amazonaws.com/420x360/IMAGE_NAME.jpg

Or you can access the lambda function directly.

Example 2:

https://LAMBDA_ID.execute-api.REGION.amazonaws.com/dev/resize?key=420x360/IMAGE_NAME.jpg

This will resize the image in the fly and send you back the resized image while storing it for further reference.

Credits

The original tutorial for resizing S3 images I followed can be found here!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].