Step 2: Write Data to a Table Using the Console or AWS CLI - Amazon DynamoDB

Step 2: Write Data to a Table Using the Console or AWS CLI

In this step, you insert two items into the Music table that you created in Step 1: Create a Table.

For more information about write operations, see Writing an Item.

Follow these steps to write data to the Music table using the DynamoDB console.

  1. Open the DynamoDB console at

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

  3. In the table list, choose the Music table.

                                Console screenshot showing the Tables view with a
                                Music table.
  4. Select View Items.

                                Console screenshot showing the View items button in the
                                table view.
  5. In the Items view, choose Create item.

                                Console screenshot showing the Music table and the Create
                                    item button.
  6. Choose Add new attribute, and then choose Number. Name the field Awards.

                                Console screenshot showing the Add new attribute list.
  7. Repeat this process to create an AlbumTitle of type String.

  8. Enter the following values for your item:

    1. For Artist, enter No One You Know as the value.

    2. For SongTitle, enter Call Me Today.

    3. For AlbumTitle, enter Somewhat Famous.

    4. For Awards, enter 1.

  9. Choose Create item.

                                Console screenshot showing the completed fields for the
  10. Repeat this process and create another item with the following values:

    1. For Artist, enter Acme Band.

    2. For SongTitle enter Happy Day.

    3. For AlbumTitle, enter Songs About Life.

    4. For Awards, enter 10.

The following AWS CLI example creates two new items in the Music table using put-item.

aws dynamodb put-item \ --table-name Music \ --item \ '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"}, "Awards": {"N": "1"}}' aws dynamodb put-item \ --table-name Music \ --item \ '{"Artist": {"S": "Acme Band"}, "SongTitle": {"S": "Happy Day"}, "AlbumTitle": {"S": "Songs About Life"}, "Awards": {"N": "10"} }'

For more information about supported data types in DynamoDB, see Data Types.

For more information about how to represent DynamoDB data types in JSON, see Attribute Values.

After writing data to your table, proceed to Step 3: Read Data from a Table.