Step 1: Create a table - Amazon DynamoDB
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Step 1: Create a table

In this step, you create a Music table in Amazon DynamoDB. The table has the following details:

  • Partition key — Artist

  • Sort key — SongTitle

For more information about table operations, see Working with tables and data in DynamoDB.


Before you begin, make sure that you followed the steps in Prerequisites - getting started tutorial.

To create a new Music table using the DynamoDB console:

  1. Sign in to the Amazon Web Services Management Console and open the DynamoDB console at

  2. In the navigation pane on the left side of the console, choose Dashboard.

  3. On the right side of the console, choose Create Table.

                                Console screenshot showing the Create table button.
  4. Enter the table details as follows:

    1. For the table name, enter Music.

    2. For the partition key, enter Artist.

    3. Enter SongTitle as the sort key.

    4. Leave Default settings selected.

  5. Choose Create to create the table.

                                Console screenshot showing the Create table page with fields

The following Amazon CLI example creates a new Music table using create-table.

aws dynamodb create-table \ --table-name Music \ --attribute-definitions \ AttributeName=Artist,AttributeType=S \ AttributeName=SongTitle,AttributeType=S \ --key-schema \ AttributeName=Artist,KeyType=HASH \ AttributeName=SongTitle,KeyType=RANGE \ --provisioned-throughput \ ReadCapacityUnits=5,WriteCapacityUnits=5 \ --table-class STANDARD

Using create-table returns the following sample result.

{ "TableDescription": { "TableArn": "arn:aws:dynamodb:us-west-2:522194210714:table/Music", "AttributeDefinitions": [ { "AttributeName": "Artist", "AttributeType": "S" }, { "AttributeName": "SongTitle", "AttributeType": "S" } ], "ProvisionedThroughput": { "NumberOfDecreasesToday": 0, "WriteCapacityUnits": 5, "ReadCapacityUnits": 5 }, "TableClassSummary": { "LastUpdateDateTime": 1558028402.69, "TableClass": "STANDARD" }, "TableSizeBytes": 0, "TableName": "Music", "TableStatus": "CREATING", "TableId": "d04c7240-0e46-435d-b231-d54091fe1017", "KeySchema": [ { "KeyType": "HASH", "AttributeName": "Artist" }, { "KeyType": "RANGE", "AttributeName": "SongTitle" } ], "ItemCount": 0, "CreationDateTime": 1558028402.69 } }

Note that the value of the TableStatus field is set to CREATING.

To verify that DynamoDB has finished creating the Music table, use the describe-table command.

aws dynamodb describe-table --table-name Music | grep TableStatus

This command returns the following result. When DynamoDB finishes creating the table, the value of the TableStatus field is set to ACTIVE.

"TableStatus": "ACTIVE",

Once the table is in ACTIVE status, it's considered best practice to enable Point-in-time recovery for DynamoDB on the table by running the following command:

aws dynamodb update-continuous-backups \ --table-name Music \ --point-in-time-recovery-specification \ PointInTimeRecoveryEnabled=true

There are cost implications to enabling continuous backups with point-in-time recovery. For more information about pricing, see Amazon DynamoDB pricing.

After creating the new table, proceed to Step 2: Write data to a table using the console or Amazon CLI.