The idea is to build a Lambda which will compress images using imagemagick
the steps involved are as follows
the steps involved are as follows
- Create a source and destination S3 buckets
- when we upload a JPG file to source s3 bucket
- An event is triggered from the source S3 to the Lambda
- the Lambda is responsible to read the source image and use imagemagick
and compress and write back to destination S3 bucket
1) Creating a S3 Bucket
2) There are 3 ways in which a Lambda can be invoked
- using a trigger ( push mechnaism)
- pull mechanism like (SQS)
- direct invocation of Lambda
3) Code for Lambda
Code for the Lambda which gets triggered when a JPG file is uploaded to S3
4) aws lambda update-function-code --function-name images --s3-bucket purna-srcimages --s3-key file.zip --publish
5) Trigger the Lambda by uploading an image in source bucket , should compress and upload to the destination bucket
No comments:
Post a Comment