aws-lambda-image icon indicating copy to clipboard operation
aws-lambda-image copied to clipboard

Run against existing S3 images.

Open javdl opened this issue 8 years ago • 5 comments

I guess it would be useful for a lot of people if you could also run this function against pre-existing files on S3. Is there a way to do so? I've seen some people use S3 list for such kind of things. Is this possible using Claudia.js?

javdl avatar Mar 01 '17 16:03 javdl

You would need to install Claudia globally and then you can use test-lambda command with --event flag. The problem is that you should create separate event file for each already existing image you would like to process. You can use the event_source.json from fixtures as example and update file path, bucket ARN and name and I guess that would be it. Let me know if this works for you.

kdybicz avatar Mar 01 '17 17:03 kdybicz

You can copy S3 objects from existing bucket to the bucket with configured SNS. Every copied file will trigger a Lambda function. To copy files use 'aws s3 cp'

sheh1000 avatar Apr 16 '17 17:04 sheh1000

Thanks, that worked for me. However I still think it is nice to do it without moving all files back and forth. Guess that just isn't supported by the way AWS implemented Lambda events?

javdl avatar Apr 19 '17 08:04 javdl

@Joostvanderlaan which method worked for you? The one from @sheh1000 ? aws s3 cp doesn't trigger the lambda function for me. I am using:

aws s3 cp test.jpg s3://[bucketname]/directory/test.jpg to test the function.

Any help will be appreciated :)

UsmanJ avatar Sep 26 '17 17:09 UsmanJ

Got it working. Lambda function wasn't triggering because of bucket policies.

UsmanJ avatar Sep 26 '17 23:09 UsmanJ