Deleting an item from the DynamoDB table using the AWS SDK for .Net

Let's understand how to delete an item from 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 try to understand how to delete a stored item from the DynamoDB table using .Net:

  1. Create an instance of the DynamoDBClient class:
    AmazonDynamoDBClient client = new AmazonDynamoDBClient();
    string tableName = "productTable";
  2. Create a delete table request and specify the key of the item that you wish to delete from the table. Here, we will specify both the hash and range keys, as we have created a table with the composite primary keys:
    var request = new DeleteItemRequest { TableName = tableName, Key = new ...

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.