Demo: Reading Data

Practice reading data from the DynamoDB tables.

Creating a table

Uptill now, we have learnt that we can create a table. For this demo, let’s create a table of medicines. We will keep the “chemical formula” as the partition key and the “dosage” as the sort key. The following is a simple code for creating such a table:

Press + to interact
aws dynamodb create-table \
--table-name Medicines \
--attribute-definitions AttributeName=ChemicalFormula,AttributeType=S \
AttributeName=Dosage,AttributeType=N \
--key-schema AttributeName=ChemicalFormula,KeyType=HASH \
AttributeName=Dosage,KeyType=RANGE \
--provisioned-throughput \
ReadCapacityUnits=4,WriteCapacityUnits=4

Inserting items

Let’s use the bulk-write-item command to insert a few items into ...