- Use the aws dynamodb put-item CLI command to add an item to the DynamoDB table:
aws dynamodb put-item
--table-name my_table
--item '{"id":{"S":"001"}, "datetime":{"N":"1536898265"}, "field1":{"N":"20"}}'
--region us-east-1
--profile admin
- Add a data item with different sets of attributes:
aws dynamodb put-item
--table-name my_table
--item '{"id":{"S":"001"},"datetime":{"N":"1536898285"}, "field1":{"N":"30"}, "field2":{"S":"ABC"}}'
--region us-east-1
--profile admin
We added an additional attribute, field2.
- Add an item with an existing field, but different data type:
aws dynamodb put-item
--table-name my_table
--item '{"id":{"S":"002"},"datetime":{"N":"1536898295"}, "field1":{"S":"DEF"}}'
--region us-east-1
--profile admin