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

Creating a DynamoDB table with a Global Secondary Index using the AWS SDK for .Net


Now, let's see how to create a DynamoDB table with a Global Secondary Index using the AWS SDK for .Net.

Getting ready

To perform this recipe, you can use the IDE of your choice.

How to do it…

In the earlier chapters, we have seen how to create a DynamoDB table. Now, we are going to see how to create a DynamoDB table using a Global Secondary Index:

  1. Create AttributesDefinitions and the key schema. Make sure that you specify the attributes you are going to use as hash and range keys in the Global Secondary Index:

    AttributeDefinitions = new List<AttributeDefinition>(){
        new AttributeDefinition{
            AttributeName="id", AttributeType="N"
        },
        new AttributeDefinition{
            AttributeName="type", AttributeType="S"
        },
        new AttributeDefinition{
            AttributeName="name", AttributeType="S"
        },
        new AttributeDefinition{
            AttributeName="mnfr", AttributeType="S"
        }
        };
        //...