Streaming QLDB Journal data to Lambda

In this article we’ll discuss how to stream QLDB (Quantum Ledger Database) journal data to lambda using AWS kinesis Data streaming service.

Creating a Kinesis Data Stream

Go to Kinesis service and click on Create data stream.

Enter the stream name, capacity mode as On-Demand/Provisioned(select based on the requirement) and proceed with creating the data stream.

Once the stream has been created successfully, we’ll proceed with the second step.

Creating an IAM role that enables QLDB to assume write permissions for the Kinesis data stream.

{"Version": "2012-10-17","Statement": [{"Sid": "QLDBStreamKinesisPermissions","Action": [ "kinesis:PutRecord*", "kinesis:DescribeStream", "kinesis:ListShards" ],"Effect": "Allow","Resource": "arn:aws:kinesis:us-east-1:123456789012:stream/kinesis-stream-name"}]}

Now, we’ll proceed with creation of QLDB journal stream

QLDB Stream Creation

On the Create QLDB stream page, enter the following settings:

For information about the format of the stream data records, visit the below url: https://docs.aws.amazon.com/qldb/latest/developerguide/streams.records.html

Now, we have come to the final section

Creating a consumer application and consuming the Data Stream in a Lambda

The AWSLambdaKinesisExecutionRole policy has the permissions that the function needs to read items from Kinesis and write logs to CloudWatch Logs.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store