Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass an image file to AWS lambda

I would like to know if there is a way to pass an image file from the client and send it to AWS lambda function. I ask this because I have to save the image file in a S3 bucket but I want to rename and compress the file in the lambda function before uploading it. If it's not possible give me your suggestion.

like image 547
LVB Avatar asked Dec 11 '25 03:12

LVB


1 Answers

It is possible. Save the image (PutObject) in a S3 bucket. It is called Push Model where a PutObject in S3 triggers a lambda execution. The S3 object name (key) is passed to the lambda function. The lambda when invoked, downloads the image fie, resizes it and uploads the resized image to a different bucket in S3.

AWS has detailed documentation and example for your use case. Check Using AWS Lambda with Amazon S3 and Tutorial: Using AWS Lambda with Amazon S3

like image 84
helloV Avatar answered Dec 13 '25 15:12

helloV