Book Image

DynamoDB Cookbook

By : Tanmay Deshpande
Book Image

DynamoDB Cookbook

By: Tanmay Deshpande

Overview of this book

Table of Contents (18 chapters)
DynamoDB Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Updating a table using the AWS SDK for .Net


Now, let's understand how to update 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 update the provisioned capacity of the already created table using the AWS SDK for .Net:

  1. Create an update table request and provide the new read and write capacity units:

    AmazonDynamoDBClient client = new AmazonDynamoDBClient();
    string tableName = "productTableNet";
    var request=new UpdateTableRequest(){
      TableName=tableName,
      ProvisionedThroughput = new ProvisionedThroughput(){
        ReadCapacityUnits=2,
          WriteCapacityUnits=2
      }
    };
  2. Invoke the updateTable method from the DynamoDB client to update the table with the provided capacity units:

    var response = client.UpdateTable(request);
  3. It takes some time for DynamoDB to make the changes effective. So, it's always a best practice to wait until the table becomes active again. By default, the AWS SDK for...