AKSHAY SHINGOTE
AKSHAY SHINGOTE

Reputation: 407

Writing to Kinesis stream using AWS Lambda Function

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

Upvotes: 7

Views: 16616

Answers (2)

Sachin Kariyattin
Sachin Kariyattin

Reputation: 560

Not answering the question but updating latest solution to the part of the question

when we write a record to Dynamo DB table & that record is written to Kinesis stream

You can directly enable Kinesis streams on dynamo db table now https://aws.amazon.com/about-aws/whats-new/2020/11/now-you-can-use-amazon-kinesis-data-streams-to-capture-item-level-changes-in-your-amazon-dynamodb-table/

Upvotes: 1

Scott Wisniewski
Scott Wisniewski

Reputation: 25061

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.

Upvotes: 25

Related Questions