I would like to add an item to my DynamoDB table via command line, but I\'ve run into a type error.
The data that I\'m trying to add is very simple:
{
We cannot provide a plain JSON schema as an input to the dynamodb put-item
command. We need to provide the attribute(s) data type along with its value.
But if you have a complex JSON schema and you are new to the aws dynamodb cli
commands then it becomes really tedious for you to prepare your input JSON file.
But we have an easy solution as well, please follow these steps:
Items
, it will show you the data if any already.Create Item
, it will open a new window and from there choose the option Text
instead of Tree
. Paste your sample JSON schema there and save this item.Actions
choose the option Export to .csv
. This csv file contains your JSON attribute name (keys), their corresponding values along with their data type.dynamodb put-item
command.you need to add the type information (I assume String here)
aws dynamodb put-item --table-name my_table --item '{ "id": {"S": "1" } }'