Let’s say we wanted to insert a new item into the Reply table from the console. First, navigate to the Reply table click the Create Item button.
You will need to click Add new attribute a couple of times to make some new String attributes, and then fill in the following data, then click Create Item.
"Id" : "Amazon DynamoDB#DynamoDB Thread 2", "ReplyDateTime" : "2021-04-27T17:47:30Z", "Message" : "DynamoDB Thread 2 Reply 3 text", "PostedBy" : "User C"
The DynamoDB UpdateItem API is used to create a new item or to replace existing items completely with a new item. It is invoked using the update-item CLI command. This API requires you to specify the full Primary Key and can selectively modify specific attributes without changing others(you don’t need to pass in the full item).
You can easily modify or delete an item using the console by selecting the checkbox next to the item of interest, clicking the Actions dropdown and performing the desired action.
Update the ProductCatalog item where Id=201 to add new colors “Silver” and “Green” to the list of colors for that bike type. Then use the Item Editor again to remove those “Silver” and “Green” list entries to return it to the original state.
The solution is expandable below but try to figure it out yourself before moving forward.
Click below to expand and see the exercise solutions
Navigate to the ProductCatalog Table and click the
Id 201 hyperlink to bring up the Item Editor for that item. Click the
+ icon next to the Color attribute to expand that List.
Insert a field and pick the
String type. Do this twice. Add the colors “Silver” and “Green” to the list, then click
We can see by expanding the Items Preview that those two list entries were added.
Return to the item editor for
Id 201 and use the
Remove button next to the Silver and Green list entries to remove them from the
Color attribute, then click