Posted On: Feb 28, 2023
AWS Lambda now supports Amazon DocumentDB change streams as an event source. The change streams feature in Amazon DocumentDB (with MongoDB compatibility) provides a time-ordered sequence of change events that occur within your cluster’s collections. Customers can now consume these events in their serverless applications built on Lambda.
Amazon DocumentDB is a fully managed, scalable, and highly available MongoDB-compatible document database which makes it easy to store, query, and index JSON data. With Amazon DocumentDB change streams as an event source for Lambda, you can build event-driven applications that react to changes in your databases in near-real time. You can use Lambda functions to process new documents, track updates to existing documents, or log deleted documents. You can use any programming language that is supported by Lambda to write your functions.
To get started, enable change streams on your Amazon DocumentDB cluster, and then select your cluster as the event source for your Lambda function through the AWS Management Console, AWS CLI, AWS SAM, or AWS SDK for Lambda. Amazon DocumentDB change streams as a Lambda event source is available in all commercial AWS Regions where both AWS Lambda and Amazon DocumentDB are available. Provisioning an event source mapping incurs no additional charge, however, charges apply for enabling Amazon DocumentDB change streams, see Amazon DocumentDB pricing for more information. You pay for the Lambda invocations triggered by an Amazon DocumentDB change stream. To learn more about building an Amazon DocumentDB consumer application with Lambda, read the Lambda Developer Guide.