How to put an item in DynamoDB table using AWS Lambda with python

Published: 20 May 2021
on channel: smashplus
2,169
23

This small video explains how to put an item in the DynamoDB table using AWS Lambda with python.

Python Code is provided below

```
import boto3
import json


def lambda_handler(event, context):

dynamodb = boto3.resource('dynamodb', region_name='us-east-2')


table = dynamodb.Table('Student')
id1=event["Id"]
name=event["Name"]

response=table.put_item(Item={"id":id1,"name":name})

return response
```
and sample JSON input
{
"Id": "100",
"Name": "John"
}

Create Table in DynamoDB
Create AWS lambda function with python 3.8
Put Item in DynamoDB Table
Update the IAM Role accordingly
Test.

Happy Learning
#AWSLambda #Python #DynamoDB


On this page of the site you can watch the video online How to put an item in DynamoDB table using AWS Lambda with python with a duration of hours minute second in good quality, which was uploaded by the user smashplus 20 May 2021, share the link with friends and acquaintances, this video has already been watched 2,169 times on youtube and it was liked by 23 viewers. Enjoy your viewing!