AWS CloudFormation
User Guide (API Version 2010-05-15)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

DynamoDB Primary Key

Describes an Amazon DynamoDB primary key for an AWS::DynamoDB::Table resource.

There are two types of primary key types: hash type primary keys, and hash and range type primary keys:

  • A hash type primary key creates a table that has an unordered hash index based on the AttributeName of the HashKeyElement.

  • A hash and range type primary key creates a table that has both an unordered hash index based on the AttributeName of the HashKeyElement, and an ordered hash index based on the AttributeName of the RangeKeyElement.

For a complete discussion of Amazon DynamoDB primary keys, see Primary Key in the Amazon DynamoDB Developer Guide.

Syntax

{
   "HashKeyElement": {
      "AttributeName" : String,
      "AttributeType" : String
   },
   "RangeKeyElement" : {
      "AttributeName" : String,
      "AttributeType" : String
   }
}

Parameters

Each element type has an AttributeName and AttributeType, defined as follows:

AttributeName

The name of the attribute that will serve as the primary key for this table. Primary key element names can be 1 – 255 characters long and have no character restrictions.

Required: Yes

Type: String

AttributeType

The type of this attribute. This must be either "S" for string data, or "N" for numeric data.

Required: Yes

Type: String

Note

For detailed information about the limits of primary key values in Amazon DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.

Examples

For an example of a declared primary key, see AWS::DynamoDB::Table.