AWS Lambda. Creates/removes thumbnails via Python 3.8. 8x faster than nodejs.
thumb_create
function creates thumbnail in thumbnails bucket when original image is uploaded.
thumb_delete
function removes thumbnail from thumbnails bucket when original image is removed.
- Add bucket for thumbnails with suffix
-thumbs
. E.g. formybucket
new bucket should bemybucket-thumbs
. - Add object delete permission ("s3:DeleteObject") to your lambda s3 role
lambda_s3_exec_role
. - Create .zip archives in
dist/
./pack.sh thumb_create
./pack.sh thumb_delete
./pack.sh python_layer # (requires virtualenv & docker)
./pack.sh ffmpeg_layer # (requires wget)
- Add python and ffmpeg layers to thumb_create function.
Handlers will be thumb_create.handler
and thumb_delete.handler
for lambda functions.
- Average time for image 3.8mb (nodejs): 5.7 sec
- Average time for image 3.8mb (aws-lambda-thumb): 0.7 sec