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:

  1. Create an instance of the DynamoDB client, and use this to put an item into the table:
    AmazonDynamoDBClient client = new AmazonDynamoDBClient();
    string tableName = "productTable";
  2. Now, create a PutItemRequest with the desired parameters, and invoke the PutItem method:
    var request = new PutItemRequest { TableName = tableName, Item = new Dictionary<string, AttributeValue>() { { "id", new AttributeValue { N = "20" }}, { "type", new AttributeValue ...

Get DynamoDB Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.