Amazon DynamoDB to AWS Lambda

Amazon DynamoDB → AWS Lambda

Invoke a Lambda function from changes to a DynamoDB table using event-based filters

This event pattern demonstrates how DynamoDB Streams with event-based filtering on dynamodb:put and dynamodb:delete operations trigger Lambda functions.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/dynamodb-streams-lambda-event-filters

Deploy

sam buildsam deploy --guided


Testing

After deployment, add an item to the DynamoDB table. Go to the CloudWatch Logs for the deployed Lambda function. You will see the event is logged out containing the item data.

Cleanup

1. Delete the stack: sam delete --stack-name STACK_NAME.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Jones Zachariah Noel

Jones Zachariah Noel

Cloud Architect - Serverless @ Mobil80 Solutions and Services Pvt Ltd, India and AWS Community Builder. A serverless geek and enthusiastic about building serverless applications with SAM.