amiiy / aws-s3-video-thumbnail-lambda

lambda function to generate thumbnail based on the uploaded videos on the s3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS create thumbnail for uploaded video on the S3

this is a sample ready to use code that created by aws sam basically once you run sam build and sam deploy the cloudFormationwill create do the following steps:

  • create a lambda functino with prefix name: aws-s3-thumbnail-S4VideoThumbnail-**** (you can specify `FunctionName in template.yml file)
  • create a S3 bucket with specified parameter name: AppBucketName ( pass it using: sam deploy --parameter-overrides AppBucketName=some-thing-unique-123)
  • create required IAM execution roles for the lambda
  • grant read and write access for the lambda function to perform operation on that s3 bucket
  • add an event trigger to lamba for putObject on S3
  • add ffempeg lib layer to the lambda function, in order to do this, you need to first deploy this then add the layer Arn in the template.yml file

NOTE

in the template I put event only on the videos directory and inside the lambda it will save the images in thumbnail folder in the same s3 bucket. if you write and read from same bucket without prefix or folder you may endup in infinit recursive lambda calls! its created millons of object for me in just couple of minutes!

About

lambda function to generate thumbnail based on the uploaded videos on the s3


Languages

Language:JavaScript 100.0%