DynamoDB Cookbook
上QQ阅读APP看书,第一时间看更新

Deleting a table using the AWS SDK for .Net

Now, let's understand how to delete a DynamoDB table using the AWS SDK for .Net.

Getting ready

You can use the IDE of your choice to code these recipes.

How to do it…

In this recipe, we will learn how to delete the table that we created earlier using the AWS SDK for .Net:

  1. Create a delete table request specifying the name of the table to be deleted:
    string tableName = "productTableNet";
    var request = new DeleteTableRequest
                {
                    TableName = tableName
                };
  2. Invoke the DeleteTable method to delete the table:
       var response = client.DeleteTable(request);
  3. Like create and update, delete also takes some time before the changes are effective.

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

How it works…

Once we invoke these APIs, the AWS SDK deletes the table forever. So, I request that you use this API very carefully. There is no way to get the data back once it has been deleted.