Database Reference
In-Depth Information
If the command throws an error for other platforms, we just need to replace
\"
with
"
, as
shown in the following code:
aws dynamodb put-item --table-name Tbl_Book --item
{"BookTitle":{"S":"SCJP"},"Author":{"S":"Kathy"},
"Language":{"S":"English"},"Editions":{"NS":["1","2"]}}
--return-consumed-capacity TOTAL
Now it will work fine. Otherwise type
aws dynamodb put-item help
to retrieve
the format in which the request has to be made.
The following command inserts two items into the table. While inserting a set, the set val-
ues must be enclosed in [] (square brackets) and each value must be delimited by
,
(comma). Let me write both the commands in a textbox to make it easier to understand:
aws dynamodb put-item --table-name Tbl_Book --item
{\"BookTitle\":{\"S\":\"SCJP\"},\"Author\":{\"S\":\"Simon\"},
\"Language\":{\"S\":\"English\"},\"Editions\":{\"NS\":[\"3\",\"6\"]}}
--return-consumed-capacity TOTAL
The following
put-item
command will insert an item with the new
Type
attribute:
aws dynamodb put-item --table-name Tbl_Book --item
{\"BookTitle\":{\"S\":\"Inferno\"},\"Author\":{\"S\":\"DanBrown\"},\"Language\":{\"S":\"English\"},\"Editions\":{\"NS\":[\"1\"]},\"Type\":{\"S\":\"Fiction\"}}
--return-consumed-capacity TOTAL
After writing successful syntax of the command, you can see the JSON format of the table
data and the item will be added to it.