skip to Main Content

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


  1. 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

    enter image description here

    You can find all valid options here:

    https://docs.aws.amazon.com/cli/latest/reference/dynamodb/scan.html

    Login or Signup to reply.
  2. You can run the Scan API to output how the table looks in DynamoDB JSON format.

    aws dynamodb scan 
    --table-name test 
    --output text
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search