I’m trying to find the right command to use in the CLI to print the contents of a table within DynamoDB.
I’ve tried using the following command but it gives me a "parameter validation failed" error.
`
aws dynamodb get-item
--table-name Traffic
--key file://traffic.json
--return-consumed-capacity TOTAL
`
The AWS website is giving me a 403 error, at the moment, so I can’t search for the solution through the official site.
2
Answers
To get all items in a table, use a scan operation, not a get item operation. This basic scan operation works fine with the CLI:
aws dynamodb scan –table-name Work
You can find all valid options here:
https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html
You can run the
Scan
API to output how the table looks in DynamoDB JSON format.If you have a list of keys to fetch in your traffic.json file then you should use
batch-get-item
.If it’s a single item you need then please share the contents of traffic.json file.