Get All Items from DynamoDB with the AWS CLI
There is no "select all" in DynamoDB — reading a whole table means a paginated Scan. The good news: the AWS CLI auto-paginates, making as many 1 MB service calls as needed behind the scenes and printing one combined result.
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
- Auto-pagination — unlike the SDKs, the CLI follows
LastEvaluatedKeyfor you by default: one command, every item. (--no-paginatelimits it to a single service call — the first ~1 MB only.) - Chunked output for big tables — the full table lands in memory before printing, so for large tables read it in slices:
--max-items 1000prints 1000 items plus aNextToken; resume with--starting-token <token>. Keep--page-sizeequal to--max-itemsto avoid missing/duplicated rows across chunks. - Fewer bytes, same bill —
--projection-expression 'Artist, SongTitle'(with--expression-attribute-namesfor reserved words) returns only those attributes, but a scan still bills every byte of every item read. - Faster on big tables: parallel scan — run N copies with
--segment i --total-segments N, each auto-paginating its own slice. Same total cost, much lower wall-clock time. - Filtering while you're at it?
--filter-expressiondrops items after they're read (and billed) — see Scan with a filter. Piping tojq? Add--output jsonand remember the values are DynamoDB JSON.
Do it visually
Eyeballing a table doesn't need a terminal full of DynamoDB JSON: download DynoTable to browse any table in a paginated grid — it pages through scans for you. And before you scan-and-pay, the DynamoDB pricing calculator shows what a full read of your table actually costs.
Related examples
- Get all items in Node.js — the same full read with an explicit loop.
- Get all items in Python — the same full read with boto3's paginator.
- DynamoDB Scan with the AWS CLI — scanning with a
--filter-expression. - Parallel scans — Segment/TotalSegments, worker counts, and when to bother.
- Why is my DynamoDB Scan slow and expensive? — the cost model and how to avoid it.
- DynamoDB ProvisionedThroughputExceededException — reading the whole table is the classic way to hit it.
- "The provided starting key is invalid" — a mangled resume key in the pagination loop.
References
- Scan — Amazon DynamoDB API Reference
- scan — AWS CLI Command Reference
- Using AWS CLI pagination options — AWS CLI User Guide
- DynamoDB read and write operations (capacity unit consumption) — Amazon DynamoDB Developer Guide
Last verified 2026-07-13 against the official AWS documentation linked above.