Unable to trigger Lamda from S3
Hi,
I'm trying to fire a Lambda function when a new file is created on S3.
So I did the following :
- created my Lambda function => ok
- tested the Lambda using aws cli "invoke" -> ok
then I used the following to add notification to S3 so that it will run my Lambda on new file :
aws --endpoint-url=http://localhost:4572 s3api put-bucket-notification \ --bucket "in" \ --notification-configuration file://cloud.json
cloud.json looks like that: { "CloudFunctionConfiguration": { "CloudFunction": "arn:aws:lambda:us-east-1:000000000000:function:inOut", "Events": [ "s3:ObjectCreated:*" ] }
}
aws --endpoint-url=http://localhost:4572 s3api get-bucket-notification --bucket "in" ==> no error but return nothing ???
Then used this one to copy a file to S3:
aws --endpoint-url=http://localhost:4572 s3 cp hello.txt s3://in/oli.txt
my Lambda was supposed to copy that file to another folder, but nothing append...
I also did a try with S3 sending event to SQS and that was working fine ( except for aws --endpoint-url=http://localhost:4572 s3api get-bucket-notification --bucket "in" which doesn't show anything...)
So could you tell me Lambda can be called from S3 or if this is a known limitation ?
Comments (4)
-
Account Deactivated -
Thanks you very much, I can confirm this is working for me ! The only thing that is still a bit weird is that
aws --endpoint-url=http://localhost:4572 s3api get-bucket-notification --bucket "in"
doesn't show anything... but the lambda is triggered.
-
Account Deactivated Thanks, this is tracked in a new ticket here: https://github.com/localstack/localstack/issues/169
-
Account Deactivated - changed status to resolved
- Log in to comment
Thanks for the detailed bug report. This is fixed in commit 680471a9c3d8c6a49aa504cd8064ccbc0cc0d2b8 .
The Docker image (tags
0.6.0
andlatest
) is currently being built and pushed, it should be available shortly: https://bitbucket.org/atlassian/localstack/addon/pipelines/home#!/results/%7B94a87c6c-fb22-4e12-a4f2-7b2126ca6b02%7DCan you please give it a try and confirm that it works for you. Thanks