Deploy with one command-line to AWS Lambda and S3 ⚡️
$ git clone https://github.com/unichat-io/serverless-image-processing.git
$ cd serverless-image-processing
Add your secret keys and configuration variables on ./secrets/.env
.
AWS_KEY=XXX
AWS_SECRET=YYY
STAGE=dev
REGION=us-east-1
BUCKET=your-bucket-here
$ docker-compose up --build
The command line will log out the service endpoints and all info.
After the service has been deployed, you will receive a bucket endpoint.
Let's upload an image so we have something to work with.
$ aws s3 cp --acl public-read IMAGE_NAME.jpg s3://BUCKET
http://BUCKET.s3-website.REGION.amazonaws.com/?f=IMAGE_NAME.jpg
Or you can access the lambda function directly.
https://LAMBDA_ID.execute-api.REGION.amazonaws.com/STAGE/processing?f=IMAGE_NAME.jpg
Complete guide of the different options:
Query string | Type | Required | Description |
---|---|---|---|
f |
String | Yes | The image name uploaded to your S3 bucket (eg. placeholder.jpg) |
w |
Number | No | Width |
h |
Number | No | Height |
q |
Number | No | Quality (between 1-100) |
t |
String | No | Convert to (default is webp) Available values are [webp, jpeg and png] |
Tested on my network (20MB)
Thanks to Nadia Ilustraciones for donating the logo!
MIT license. Copyright © 2018.