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:
{
"id": "1"
}
The command I'm running is equally simple:
aws dynamodb put-item --table-name my_table --item '{ "id": "1" }'
The error I'm getting is:
Invalid type for parameter Item.id, value: 1, type: <type 'unicode'>, valid types: <type 'dict'>
I come from a JavaScript background, so I'm not familiar with dict
types. From what I understand from some of the sources I've read, this is a Python thing? How do I change my data into something that DynamoDB can handle?
you need to add the type information (I assume String here)
aws dynamodb put-item --table-name my_table --item '{ "id": {"S": "1" } }'