Bucket event-driven image resizing built with cloud functions.
In this example, we set up a image resizing solution with AWS S3 and a Serverless framework function written in Node.js. We use the sharp
package for image resizing.
sharp
includes native dependencies, so in this example we are building and deploying the Serverless function from a Docker container that’s based on Amazon Linux.
In order to deploy the function, you will need the following:
- Two S3 bucket in your AWS account.
- Serverless framework installed locally via
yarn global add serverless
. Node.js
andyarn
installed locally.- Docker and docker-compose installed locally.
-
Clone the repository
git clone https://github.com/rokumatsumoto/aws-node-dynamic-image-resizer.git
-
Install the dependencies
yarn install
-
Add your AWS credentials into the
secrets/secrets.env
file. (See this for documentation) -
Add your env variables into the
.env
file -
Deploy the Serverless project
docker-compose up --build