Get All Items from DynamoDB with the AWS CLI

The AWS CLI hides the pagination. aws dynamodb scan makes as many 1 MB service calls as the table needs and prints one combined result, so the command that reads ten items and the command that reads ten million are the same command.

That is the convenience and the trap. The call count, the memory, and the bill all scale with the table while the line stays one line.

Code

aws dynamodb scan --table-name 'Music'

The combined output holds every item in the table:

{
    "Items": [
        {"Artist": {"S": "Arturo Sandoval"}, "SongTitle": {"S": "Cubano Chant"}, ...}
    ],
    "Count": 1287,
    "ScannedCount": 1287
}

Explanation

  • --no-paginate is the single-call switch — it stops the CLI following the cursor, so you get the first page and nothing else. Fine for a look, wrong for a full read (how the cursor works).
  • --page-size changes the call count, not the output — AWS puts it plainly: "Changing the page size doesn't affect the output; it affects only the number of API calls that need to be made to generate the output." Reach for it when a large page times out, never to save money. The read cost is identical either way.
  • --max-items is where the output stops and NextToken starts — it prints that many items plus a resume token for --starting-token. Set it and --page-size to the same number: AWS warns that different values "can get unexpected results with missing or duplicated items".
  • --query runs on your machine — it is JMESPath over the printed result, applied after every item has been read and billed. --projection-expression (plus --expression-attribute-names for reserved words) is the one DynamoDB sees, and it shrinks the response rather than the bill. A --filter-expression also drops items after they are charged (Scan with a filter).
  • Everything buffers, then meets a pager — the CLI accumulates every page before printing, and CLI v2 sends the result through less on macOS and Linux or more on Windows by default. On a large table that is a memory spike and a stalled terminal at once. Add --no-cli-pager, or set AWS_PAGER to an empty string, and slice with --max-items.
  • Parallel scan works from the shell too — run N copies with --segment i --total-segments N, each auto-paginating its own slice. Same total cost, much lower wall clock (when it is worth it).

Do it visually

A one-line command can be an expensive command. The DynamoDB pricing calculator puts a number on a full read of your table before you run it.

DynoTable pages through the table in a grid rather than a terminal buffer, and will export the Scan behind that grid back out as an aws dynamodb command. Download DynoTable.

References

Last verified 2026-07-28 against the official AWS documentation linked above.

Build this request visually

Compose this operation in the free DynamoDB Query Builder — key condition, filter, index, Limit, sort order, and a pagination loop — and copy it back as a runnable SDK v3, CLI, or boto3 program.

Open the DynamoDB Query Builder

Work with DynamoDB without the Console

A fast DynamoDB desktop client that runs the real SQL DynamoDB can’t — JOINs, GROUP BY, aggregates — with visual editing and an AI agent on your own Bedrock keys.

Free 30-day trial, no credit card — then the Free plan with no time limit.