Step 2: Load data into tables
In this step, you load sample data into the tables that you created. You could enter the data manually into the Amazon DynamoDB console. However, to save time, you use the Amazon Command Line Interface (Amazon CLI) instead.
If you have not yet set up the Amazon CLI, see Using the Amazon CLI for instructions.
You will download a .zip
archive that contains JSON files with sample
data for each table. For each file, you use the Amazon CLI to load the data into DynamoDB. Each
successful data load produces the following output.
{ "UnprocessedItems": {} }
Download the sample data file archive
-
Download the sample data archive (
sampledata.zip
) using this link: -
Extract the
.json
data files from the archive. -
Copy the
.json
data files to your current directory.
Load the sample data into DynamoDB tables
-
To load the
ProductCatalog
table with data, enter the following command.aws dynamodb batch-write-item --request-items file://ProductCatalog.json
-
To load the
Forum
table with data, enter the following command.aws dynamodb batch-write-item --request-items file://Forum.json
-
To load the
Thread
table with data, enter the following command.aws dynamodb batch-write-item --request-items file://Thread.json
-
To load the
Reply
table with data, enter the following command.aws dynamodb batch-write-item --request-items file://Reply.json
Verify data load
You can use the Amazon Web Services Management Console to verify the data that you loaded into the tables.
To verify the data using the Amazon Web Services Management Console
Open the DynamoDB console at https://console.amazonaws.cn/dynamodb/
. -
In the navigation pane, choose Tables.
In the list of tables, choose ProductCatalog.
-
Choose the Items tab to view the data that you loaded into the table.
To view an item in the table, choose its
Id
. (If you want, you can also edit the item.)To return to the list of tables, choose Cancel.
Repeat this procedure for each of the other tables you created:
Forum
Thread
Reply