Performing CRUD Operations on DynamoDB using Lambda
Hello connections!! I am happy to share this one of the interesting task that we can do with AWS cloud. I will briefly give you a idea on this task . In this article , I want to make others understand that how data will be stored in backend(DynamoDB) using lambda
Let's create a DynamoDB Table , which is a NOSQL database.
click on create table .
Create a table with name "employee" along with partition key as "eid" and sort key as "ename".
leave remaining settings as default and create table.
wait till the status of table becomes active . Now Let's create a lambda function .Create a lambda function with a pre defined template Hello-world-function with python 3.7.
Lets create a IAM role with Lambda as use case with DynamoDBFullAccess as permission policy. Lets create a role now.
create role
Give a role name for that role , keep remaining details as default and click on create role.
wait until the role is created !!
Lets go back to lambda function.
choose the role we created, leave remaining settings as default and click on create function.
this the function for inserting record.
Recommended by LinkedIn
give the details which u want to insert in demoevent
run the function to see the code compilation.
our record is inserted in the DynamoDB Table.
similarly , we insert 2nd record in DynamoDB using lambda function. we will just change the values in the demoevent and will test the code.
Code for Deleting the record in the table.
provide the partition key and sort key of the record which we want to delete.
run the code . It is successfully executed.
the record is deleted.
displaying the items in the table
Lets insert a item manually in the table , to demonstrate updation.
provide the partition key and sort key in the demoevent of the record , in which you want to perform the updation operation.
item Updated Successfully in the Table !!!.