Creating a table using the AWS SDK for .Net
Now, let's understand how to create a DynamoDB table using the AWS SDK for .Net.
Getting ready
You can use an IDE, such as Visual Studio to code these recipes. You can refer to the AWS documentation on how to set up your workstation at http://aws.amazon.com/sdk-for-net/.
How to do it…
Let's start with creating a table called productTableNet
:
Instantiate the
CreateTable
request specifyingAttributeDefinition
andKeySchema
. We will create the table having both theHASH
andRANGE
Keys. We will set the provisioned read and write capacity units to be one:AmazonDynamoDBClient client = new AmazonDynamoDBClient(); string tableName = "productTableNet"; var request=new CreateTableRequest{ AttributeDefinitions=newList<AttributeDefinition>(){ newAttributeDefinition{ AttributeName="id", AttributeType="N" }, newAttributeDefinition{ AttributeName="type", AttributeType="S" } }, KeySchema=newList<KeySchemaElement>{ newKeySchemaElement...