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
DynamoDBclient, and use this to put an item into the table:AmazonDynamoDBClient client = new AmazonDynamoDBClient(); string tableName = "productTable";
- Now, create a
PutItemRequestwith the desired parameters, and invoke thePutItemmethod: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...