Git Product home page Git Product logo

aws-lambda-s3-image-resize's Introduction

aws-lambda-s3-image-resize

Simple code for AWS Lambda to process images resize using NodeJS and AWS S3 trigger.

AWS Lambda + S3

Requirements

  • Have an AWS account.
  • Have NodeJS 8 installed locally to generate the node_modules.

AWS configuration

  1. Create 2 buckets where one must have the sufix "resized", cause it will receive the resized images. I.e.
  • my-image-bucket
  • my-image-bucket-resized
  1. Create a Lambda function and give the access role containing AmazonS3FullAccess.

It will allow Lambda to read and write to your buckets.

  1. Add an S3 trigger to your Lambda.
  • Point it to your bucket my-image-bucket.
  • The Event type must be ObjectCreated.

How to use

Locally you need to generate the package that will be uploaded to aws. So in this project root folder:

  1. Install the node_modules:
npm install
  1. Generate a lambda.tar.gz file with containing the following files inside:
zip -r lambda node_modules index.js
  1. Updalod the .zip file through your AWS Lambda panel and publish a new version.

  2. Upload some image to your not resized bucket (i.e: images).

  3. The image resized will appear inside the images-resized bucket in a folder resized-images.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.