Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image resize using AWS lambda in same bucket

Currently i have two buckets in S3 - let's call them buck and buck_thumb. Right now, when i uploads an image in to the buck bucket, which triggers a lambda function that resizes the image into a thumbnail and uploads the thumbnail into the buck_thumb bucket.

But now i want to make it like - when i send a image url in buck bucket then it download the image and re size it .

Is there a way ? I can do this using only one bucket?

like image 579
Himanshu Avatar asked Sep 15 '26 08:09

Himanshu


1 Answers

What I do is I set the lambda function to SNS Message Event, so when I upload to an S3 bucket I send from my server a SNS message to the configured url, and the message is the entire path on S3 to the file, so Lambda can download it, resize it and then upload with thumb_ or whatever.

Hope it helps! This is 4 months ago, but... I hope it helps future visitors XD

like image 53
Luismi Avatar answered Sep 18 '26 01:09

Luismi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!