So, I have a DynamoDB table Users
and I want to return all the contents of this table. Or maybe even some.
I tried
aws dynamodb query --table-name Users
and it says I have to specify key-condition
or key-condition-expression
, so I added the following:
aws dynamodb query --table-name Users --key-condition-expression Username = "test"
and it returns an error message " Unknown options: test "
.
To read an item from a DynamoDB table, use the GetItem operation. You must provide the name of the table, along with the primary key of the item you want. The following AWS CLI example shows how to read an item from the ProductCatalog table. With GetItem , you must specify the entire primary key, not just part of it.
To run the dynamodb commands, you need to: AWS CLI installed, see Installing or updating the latest version of the AWS CLI for more information. AWS CLI configured, see Configuration basics for more information. The profile that you use must have permissions that allow the AWS operations performed by the examples.
The Query operation in Amazon DynamoDB finds items based on primary key values. You must provide the name of the partition key attribute and a single value for that attribute. Query returns all items with that partition key value.
DynamoDB API aws dynamodb get-item returns a set of attributes for the item with the given primary key. If no matching item, then it does not return any data and there will be no Item element in the response.
If you want to dump the whole table, just use
aws dynamodb scan --table-name Users
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With