Skip to content
Advertisement

how to put an Item in aws DynamoDb using aws Lambda with python

Using python in AWS Lambda, how do I put/get an item from a DynamoDB table?

In Node.js this would be something like:

JavaScript

All I need is the python equivalent.

Advertisement

Answer

Using Boto3 (Latest AWS SDK for python)

You import it with

JavaScript

Then call the client via

JavaScript

Get item example

JavaScript

Put item example

JavaScript

‘S’ indicates a String value, ‘N’ is a numeric value

For other data types refer http://boto3.readthedocs.org/en/latest/reference/services/dynamodb.html#DynamoDB.Client.put_item

Advertisement