Carova

Serverless AWS DynamoDB Stream to Lamba Function

Configure AWS DynamoDB Streams to trigger an AWS Lambda Function. Include a filter pattern to only trigger on Modify events.

Add the following to your YAML Serverless Template:

1functions: 2 ModifyStream: 3 handler: src/modify.handler 4 events: 5 - stream: 6 arn: {DynamoDBTableStreamArn} 7 batchSize: 1 8 filterPatterns: 9 - eventName: [MODIFY] 10 startingPosition: LATEST 11 type: dynamodb 12 iamRoleStatements: 13 - Effect: Allow 14 Action: 15 - dynamodb:* 16 Resource: 17 - '*' 18 iamRoleStatementsInherit: true

The sample uses a "filterPatterns" key to only process 'MODIFY' stream events. The three lifecycle stream events are "INSERT", "MODIFY", "REMOVE".