DynamoDB(NoSQL) Streaming | Amazon Web Services

Introduction

Once you create a DynamoDB table and want to trigger some action on Insert, Update and Delete of the table, it might be triggering a set of functions or triggering some other table in those scenarios we use DynamoDB Streams. I am listing out some Use Cases which will help you to understand the specific use of dynamo stream.

    Use Case I: When data is inserted/ updated/ deleted in table A, the same data should get inserted/ updated/ deleted into table B. Table B can be in a different AWS account or the same AWS account of table A.

    Use Case II: When data is deleted in table A, an e-mail or SMS should get triggered to a bunch of users with certain details.

To get information about how these Use Cases can be achieved, you can click here to see the related article. This article will basically cover how to set up DynamoDB Streaming and link it with a function.

Steps to Activate DynamDB Streaming

Login to your AWS Console.

    Step 1: Search DynamoDB in the service section and open it.

DynamoDB Service
    

    Step 2: Create a table for which you will activate Stream.

Create Table

    Step 3: Enter Table Details.

Table Details

    Step 4: Click on the create button to create the table.

Click to create
    

    Step 5: Overview page will come up, click on the Manage Stream option.

Manage Stream
    

    Step 6: Click on New and Old Images and Enable it.

New and Old Images


    Step 7: After you enable the option, the Overview page will look like the below with stream enabled. 

Enabled Stream
    

    Step 9: Now go to the Triggers tab and click on Existing Lambda Function and map the function you have written to process the other functionality.


Trigger


Note: Always remember to assign the lambda with a policy or a role with a policy as AWSLambdaDynamoDBExecutionRole.

IAM Policy



Useful Articles -

1. How to Create Roles and attach Policies?

2. How to create Lambda and attach Roles to it?

3. End to End Dynamo Streaming Project with Use Case I and II.


For any queries please comment below, I will try solving your queries. 
Thank You!!!

 















Comments