In this lab you will experiment the Amazon DynamoDB, by creating a table, and inserting and retrieving data from it.
For this lab you just need to have your AWS CLI properly configured, or execute this lab from a Cloud9 or EC2 Instance using a role with permissions to operate over DynamoDB.
As your first taste of Amazon DynamoDB, you will create a table, insert a record, and query it.
If you are running this lab in a single-account/multiple users environment, don’t forget to add a <prefix>
to the name of the resources that you are creating.
Create table
.Table name
, type <prefix>Product
.Primary key*
, type Id
.Table Settings
, use default settings
.Create
.Items
and click on Create item
.
Create item
will be shown. Select the option Text
.
{
"Id": "PRD01",
"Description": "UNICORN GENERATOR",
"LatestStockUpdate": "2019-10-22T22:15:34Z",
"Suppliers": [
"S045",
"S4456",
"ACME126"
]
}
Save
.aws dynamodb list-tables
You should get a response similar to this one
{
"TableNames": [
"Product"
...
]
}
Other tables may appear there if you have other tables on your account, in that particular region.
aws dynamodb get-item --table-name Product --key '{"Id" : { "S":"PRD01"}}'
and the response should be similar to the following:
{
"Item": {
"LatestStockUpdate": {
"S": "2019-10-22T22:15:34Z"
},
"Id": {
"S": "PRD01"
},
"Suppliers": {
"L": [
{
"S": "S045"
},
{
"S": "S4456"
},
{
"S": "ACME126"
}
]
},
"Description": {
"S": "UNICORN GENERATOR"
}
}
}
You have finished this lab.
Deleting the table that you just created will clean your account with respect to this lab.