amazon web services - How can I place an image back in the same S3 bucket after running AWS Lambda function? -


i have 2 buckets in s3 - let's call them photos , photos-thumbnails. right now, when user uploads image our ios app, directly upload photo photos bucket, triggers lambda function resizes photo thumbnail , uploads thumbnail photos-thumbnails bucket.

i want include image compression images in photos bucket before thumbnail created in original bucket (photos). however, if set compression lambda function triggered whenever object created in photos bucket, wind in never-ending loop of user uploading original photo, triggering compression , placing in same bucket, triggering compression again, etc.

is there way can intercept before becomes recursive call image compression? or way create third bucket?

a third bucket best. if want use same bucket, choose criteria controlling whether image in photos should modified or not (perhaps image file size or something), ensure images have been processed once fall below threshold. lambda still run twice, second time examine image , find has been processed , not process again. knowledge there no way suppress second run of lambda.

another option might filter based on how object created. following event types can used in s3. use 1 users upload (maybe post?) , other lambda (maybe put?)

  • s3:objectcreated:put
  • s3:objectcreated:post
  • s3:objectcreated:copy
  • s3:objectcreated:completemultipartupload

Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -