Step 2: Write data to a table using the console or AWS CLI
In this step, you insert several 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.
Open the DynamoDB console at https://console.aws.amazon.com/dynamodb/
. -
In the navigation pane on the left side of the console, choose Tables.
-
In the table list, choose the Music table.
-
Select Explore Table Items.
-
In the Items view, choose Create item.
-
Choose Add new attribute, and then choose Number. Name the field
Awards
. -
Repeat this process to create an
AlbumTitle
of type String. -
Enter the following values for your item:
-
For Artist, enter
No One You Know
as the value. -
For SongTitle, enter
Call Me Today
. -
For AlbumTitle, enter
Somewhat Famous
. -
For Awards, enter
1
.
-
-
Choose Create item.
-
Repeat this process and create another item with the following values:
-
For Artist, enter
Acme Band
. -
For SongTitle enter
Happy Day
. -
For AlbumTitle, enter
Songs About Life
. -
For Awards, enter
10
.
-
-
Do this one more time to create another item with the same Artist as the previous step, but different values for the other attributes:
-
For Artist, enter
Acme Band
. -
For SongTitle enter
PartiQL Rocks
. -
For AlbumTitle, enter
Another Album Title
. -
For Awards, enter
8
.
-
The following AWS CLI example creates several new items in the
Music
table. You can do this either through the DynamoDB API or
PartiQL, a
SQL-compatible query language for DynamoDB.
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.