A Thumbnail Creator Serverless application. This application automatically creates a thumbnail for image, PDF, and video files. Once this application is deployed, you only need to upload files into an S3 bucket and all the thumbnails will be automatically created and saved in the result S3 bucket.
When a file is uploaded to an S3 bucket, the application will detect the file type, create a thumbnail, and save it to another S3 bucket.
- Upload image, video, or pdf file to the S3 upload bucket
- Thumbnail files will be created and stored in the S3 result bucket
- app.py: Create a thumbnail for the image, pdf, and video file that uploaded to an S3 bucket
- sharedutils: a custom Lambda Layer filetype - Python package to infer binary file types
Note: This application uses the below three custom Lambda Layers and you must deploy these Lambda Layers before deploying this application.
ps. Since it uses Lambda temporary storage with a fixed size of 512MB. So you may need to consider using Amazon EFS for Lambda in order to process large-size files. Learn more
You can deploy this application directly from the AWS Serverless Application repository, on-click button CloudFormation deploy, or using SAM CLI.
For more information, check out the Thumbnail-Creator application in the Serverless App Repository.
For manual deployments and custom builds through CloudFormation or SAM, see below sections.
Click Next to continue
|Stack name||any valid stack name||filethumbnail|
|ImageMagickLayer||ImageMagick Lambda Layer ARN||arn:aws:lambda:us-east-1::layer:image-magick:1|
|GhostscriptLayer||Ghostscript Lambda Layer ARN||arn:aws:lambda:us-east-1::layer:image-magick:1|
|FfmpegLayer||Ffmpeg Lambda Layer ARN||arn:aws:lambda:us-east-1::layer:image-magick:1|
|ConversionFileType||a valid file type||jpg|
|ConversionMimeType||a valid mime type||image/jpeg|
|ThumbnailWidth||a valid number||150|
Leave it as is and click Next
Make sure all checkboxes under Capabilities section are CHECKED
Click Create stack
To use the SAM CLI, you need the following tools.
To build and deploy your application for the first time, run the following in your shell:
sam build --use-container
Above command will build the source of the application. The SAM CLI installs dependencies defined in
requirements.txt, creates a deployment package, and saves it in the
To package the application, run the following in your shell:
sam package --output-template-file packaged.yaml --s3-bucket BUCKETNAME --region us-east-1
Above command will package the application and upload it to the S3 bucket you specified.
Run the following in your shell to deploy the application to AWS:
sam deploy --template-file packaged.yaml --stack-name STACKNAME --s3-bucket BUCKETNAME \ --parameter-overrides 'ImageMagickLayer=layerARN GhostscriptLayer=layerARN FfmpegLayer=layerARN ThumbnailWidth=150' \ --capabilities CAPABILITY_IAM --region us-east-1
- Upload files to the
- Thumbnail files will be created and stored in the
To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
aws cloudformation delete-stack --stack-name stackname