classmethod / gradle-aws-plugin

Gradle plugin to manage Amazon Web Services
276 stars 131 forks source link

How to add a trigger to a Lambda? #185

Open blundell opened 4 years ago

blundell commented 4 years ago

Looking how to add a DynamoDB trigger to the lambda (or any trigger).

As in how to programatically do this:

Screenshot 2019-12-07 at 9 22 27 pm

Someone else asking: #163

Related request: https://github.com/classmethod/gradle-aws-plugin/issues/72

This is how you would do it with the AWS CLI:

aws lambda create-event-source-mapping \
--function-name my-function \
--batch-size 500 \
--starting-position LATEST \
--event-source-arn arn:aws:dynamodb:us-east-2:123456789012:table/my-table/stream/2019-06-10T19:26:16.525

Related:

https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html

https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html