AWS SDK for .NET Documentation
CreateTableRequest Class
AmazonAmazon.DynamoDB.ModelCreateTableRequest Did this page help you?   Yes   No    Tell us about it...
Container for the parameters to the CreateTable operation.

Adds a new table to your account.

The table name must be unique among those associated with the AWS Account issuing the request, and the AWS Region that receives the request (e.g. us-east-1 ).

The CreateTable operation triggers an asynchronous workflow to begin creating the table. Amazon DynamoDB immediately returns the state of the table ( CREATING ) until the table is in the ACTIVE state. Once the table is in the ACTIVE state, you can perform data plane operations.

Declaration Syntax
C#
public class CreateTableRequest : AmazonWebServiceRequest
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
CreateTableRequest()()()()
Initializes a new instance of the CreateTableRequest class

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
GetHashCode()()()()
Serves as a hash function for a particular type.
(Inherited from Object.)
GetType()()()()
Gets the type of the current instance.
(Inherited from Object.)
KeySchema
The KeySchema identifies the primary key as a one attribute primary key (hash) or a composite two attribute (hash-and-range) primary key. Single attribute primary keys have one index value: a HashKeyElement. A composite hash-and-range primary key contains two attribute values: a HashKeyElement and a RangeKeyElement.

ProvisionedThroughput
Provisioned throughput reserves the required read and write resources for your table in terms of ReadCapacityUnits and WriteCapacityUnits. Values for provisioned throughput depend upon your expected read/write rates, item size, and consistency. Provide the expected number of read and write operations, assuming an item size of 1k and strictly consistent reads. For 2k item size, double the value. For 3k, triple the value, etc. Eventually-consistent reads consume half the resources of strictly consistent reads.

TableName
The name of the table you want to create. Allowed characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and . (period).

Constraints:

Length
3 - 255
Pattern
[a-zA-Z0-9_.-]+


ToString()()()()
Returns a string that represents the current object.
(Inherited from Object.)
WithKeySchema(KeySchema) Obsolete.
Sets the KeySchema property

WithProvisionedThroughput(ProvisionedThroughput) Obsolete.
Sets the ProvisionedThroughput property

WithTableName(String) Obsolete.
Sets the TableName property

Examples

This example shows how to create a new table with a single hash-key component.

CopyCreateTable sample
// Create a client
AmazonDynamoDBClient client = new AmazonDynamoDBClient();

// Define table schema:
//  Table has string hash- and range-keys.
KeySchema schema = new KeySchema
{
    HashKeyElement = new KeySchemaElement
    {
        AttributeName = "Author", AttributeType = "S"
    },
    RangeKeyElement = new KeySchemaElement
    {
        AttributeName = "Title", AttributeType = "S"
    }
};

// Define table throughput:
//  Table has capacity of 20 reads and 50 writes
ProvisionedThroughput throughput = new ProvisionedThroughput
{
    ReadCapacityUnits = 20,
    WriteCapacityUnits = 50
};

// Configure the CreateTable request
CreateTableRequest request = new CreateTableRequest
{
    TableName = "SampleTable",
    KeySchema = schema,
    ProvisionedThroughput = throughput
};

// View new table properties
TableDescription tableDescription = client.CreateTable(request).CreateTableResult.TableDescription;
Console.WriteLine("Table name: {0}", tableDescription.TableName);
Console.WriteLine("Creation time: {0}", tableDescription.CreationDateTime);
Console.WriteLine("Item count: {0}", tableDescription.ItemCount);
Console.WriteLine("Table size (bytes): {0}", tableDescription.TableSizeBytes);
Console.WriteLine("Table status: {0}", tableDescription.TableStatus);
KeySchema tableSchema = tableDescription.KeySchema;
Console.WriteLine("Hash-key: Name = {0}, Type = {1}",
    tableSchema.HashKeyElement.AttributeName, tableSchema.HashKeyElement.AttributeType);
Console.WriteLine("Range-key: Name = {0}, Type = {1}",
    tableSchema.RangeKeyElement.AttributeName, tableSchema.RangeKeyElement.AttributeType);
Console.WriteLine("Throughput: Reads = {0}, Writes = {1}",
    tableDescription.ProvisionedThroughput.ReadCapacityUnits,
    tableDescription.ProvisionedThroughput.WriteCapacityUnits);
Inheritance Hierarchy
Object
AmazonWebServiceRequest
 CreateTableRequest
See Also

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)