Can we create a Lambda function like which can get executed when we write a record to Dynamo DB table & that record is written to Kinesis stream ?? Basically can we write to Kinesis stream using Lambda function?? If yes please share sample code for that..Also I want to know how does that work.....Thank You
Yes. You can create a Dynamo Trigger backed by a Lambda function, and have that Lambda Function write to a stream.
To put data into the stream, you must specify the name of the stream, a partition key, and the data blob to be added to the stream. The partition key is used to determine which shard in the stream the data record is added to. All the data in the shard is sent to the same worker that is processing the shard.
Amazon Kinesis Data Firehose captures, transforms, and loads streaming data into downstream services such as Kinesis Data Analytics or Amazon S3. You can write Lambda functions to request additional, customized processing of the data before it is sent downstream.
Yes. You can create a Dynamo Trigger backed by a Lambda function, and have that Lambda Function write to a stream.
Here is a walk through that shows how to create a trigger:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.Lambda.html
In the body of your Lambda function you can then call the Kinesis "putRecord" function. Here's info on "putRecord":
http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html
If you are implementing your Lambda function in Node.js, here's a link to the SDK docs for Kinesis:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Kinesis.html#putRecord-property
Similarly here is a link for the Java SDK (if you are using java):
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/kinesis/AmazonKinesis.html#putRecord(com.amazonaws.services.kinesis.model.PutRecordRequest)
And a link to the Boto docs (if you are using python):
http://boto.cloudhackers.com/en/latest/ref/kinesis.html
The doc links should have all the info your need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With