Putting an item into the DynamoDB table using the AWS SDK for .Net
Let's understand how to put an item into the DynamoDB table using the AWS SDK for .Net.
Getting ready
To perform this operation, you can use the IDE of your choice.
How to do it…
Let's insert an item into DynamoDB table using the AWS SDK for .Net:
Create an instance of the
DynamoDB
client, and use this to put an item into the table:AmazonDynamoDBClient client = new AmazonDynamoDBClient(); string tableName = "productTable";
Now, create a
PutItemRequest
with the desired parameters, and invoke thePutItem
method:var request = new PutItemRequest { TableName = tableName, Item = new Dictionary<string, AttributeValue>() { { "id", new AttributeValue { N = "20" }}, { "type", new AttributeValue { S = "book" }}, { "stock", new AttributeValue { N = "110" }}, { "price", new AttributeValue { N = "55" }}, { "title", new AttributeValue { S = "Mastering DynamoDB" }}, ...