How to View, Browse and Edit DynamoDB Data
Every "look at" or "change" you do to a DynamoDB table maps to one of a small set of
API operations: GetItem, Query, Scan, PutItem, UpdateItem, DeleteItem.
There's no relational table viewer underneath. "Browsing a table" is a Scan, and
"editing a row" is an UpdateItem against a primary key.
Knowing which operation each click maps to is the difference between a cheap read and a full-table scan you didn't mean to run.
How to browse a DynamoDB table
Opening a table to "see what's in it" is a Scan: it reads every item in the
table or index (AWS:
"A Scan operation in Amazon DynamoDB reads every item in a table or a secondary
index."). Fine for small tables; on a large one it's the classic cost footgun
covered in query vs scan.
A single Scan returns at most 1 MB of data, then hands you a LastEvaluatedKey to
fetch the next page, so "browse the whole table" is really a pagination loop
(AWS:
"A single Scan request can retrieve a maximum of 1 MB of data" and "the
LastEvaluatedKey from a Scan response should be used as the ExclusiveStartKey
for the next Scan request"). See
pagination for how the cursor works and why offset-style page
numbers don't exist here.
How to filter / scan DynamoDB data
A filter expression does not save you a scan. DynamoDB applies the filter after the read completes, so you pay for every item scanned, not just the rows you keep.
A filter expression is applied after a
Scanfinishes but before the results are returned. Therefore, aScanconsumes the same amount of read capacity, regardless of whether a filter expression is present. — AWS Scan docs
The response makes this visible: ScannedCount is "the number of items evaluated,
before any ScanFilter is applied" while Count is what survived the filter
(AWS).
A high ScannedCount with a tiny Count is the signature of an inefficient scan.
How to query a DynamoDB table
A Query is the cheap, targeted read, but it requires a partition key. Per
AWS:
"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. Optionally,
you can provide a sort key attribute and use a comparison operator to refine the
search results."
So a Query reads only the items under one partition key, optionally narrowed by a
sort-key condition, never the whole table. No partition key, no Query: you're
back to a Scan. The full breakdown is in query vs scan.
On on-demand, a paged Scan bills 0.5 read request unit per 4 KB of items
evaluated, eventually consistent, rounded up per request on the summed size.
Scrolling through a whole 10 GB table of 1 KB items is about 1.3 million
read request units (about $0.16 at the us-east-1 list price), and twice that
with strongly consistent reads.
A targeted Query on one partition key reads only that item collection. Estimate
browse vs query in the pricing calculator.
To assemble the KeyConditionExpression / FilterExpression without hand-writing
the placeholder syntax, use the
DynamoDB Expression Builder; it emits the
exact names/values maps the API expects.
How to edit an item in DynamoDB
Editing one item is an UpdateItem against its full primary key. You don't
rewrite the whole item: you supply an update expression naming only the
attributes you're changing:
UpdateItem
Key: { "PK": "USER#42", "SK": "PROFILE" }
UpdateExpression: SET email = :e, updatedAt = :t
ConditionExpression: attribute_exists(PK)Two facts that trip people up, both from the AWS items docs:
- You must specify the entire primary key, not just part of it. On a
composite-key table that's partition key and sort key. To
"edit a row" by another attribute, find its key first: a
Queryon a GSI keyed on that attribute, or a scan. UpdateItemis an upsert. "If an item with the specified key does not exist,UpdateItemcreates a new item. Otherwise, it modifies an existing item's attributes." A typo in the key silently creates a new item. TheConditionExpression: attribute_exists(PK)above guards it: a wrong key then fails withConditionalCheckFailedExceptionand nothing is written.
How to delete an item
A DeleteItem, again keyed by the full primary key:
"DeleteItem deletes the item with the specified key"
(AWS).
Same rule as edit: you need the whole key, so deleting "all rows where status =
'open'" isn't one call; you scan or query to find the keys, then delete each one.
BatchWriteItem bundles up to 25 put/delete requests
(AWS:
"The BatchWriteItem operation can contain up to 25 individual PutItem and
DeleteItem requests"), but each still targets one key; there's no DELETE … WHERE.
Deleting multiple items shows the loop.
How to view nested / JSON data
DynamoDB items travel over the API in a type-tagged format (DynamoDB-JSON), where every
value carries a one- or two-letter type descriptor (S, N, M, L, SS…; the
full descriptor list is in the
AWS data types docs).
Plain JSON has no set type, so an array round-trips as a list (L), never a string
set (SS). To write a set, use DynamoDB-JSON ({"tags": {"SS": ["a", "b"]}}), or
pass a native set to the SDK's marshaller: new Set(["a", "b"]) in JavaScript, a
Python set in boto3. The full type map is in
DynamoDB data types; to convert a DynamoDB-JSON blob to
plain JSON and back, use the DynamoDB JSON converter.
Beyond browse-and-edit: querying that DynamoDB can't
Scan/Query/UpdateItem cover viewing and editing, but they can't analyze.
DynamoDB has no JOIN, GROUP BY, or SUM/AVG; its only built-in aggregate is a
paginated Select: COUNT on Query or Scan, which costs the same reads.
PartiQL doesn't add them either: its SELECT
grammar is just SELECT … FROM table [WHERE …] [ORDER BY …], with no join or grouping
clause (AWS PartiQL SELECT reference),
so each statement maps to a single Get/Query/Scan/Put/Update/Delete.
DynoTable's SQL Workbench fills that gap by materializing your tables through DynamoDB's real query runtime and running SQL on top (SQL within DynamoDB's access-pattern rules), but for day-to-day browse-and-edit, the operations above are the whole toolbox.
Doing it in DynoTable
DynoTable is a GUI over these operations. Its filter builder derives
Query or Scan from the keys you filter on and marks a scan filter as such, and
the grid shows how many items were scanned against how many matched. The PartiQL
and SQL editors add an estimated item and read cost before you run a statement.
Clicking a row opens the item editor. Edits are staged and reviewable, then commit as
TransactWriteItems Update actions with optimistic-locking conditions, so an edit
to an item someone changed in the meantime conflicts instead of overwriting it.
FAQ
How do I view DynamoDB data without the AWS Console?
Use a desktop GUI that issues the same Scan/Query calls. The AWS Console
browses tables via paged scans; a dedicated client like DynoTable does the same and
shows the operation (Query or Scan) plus scanned-vs-matched counts.
How do I edit a DynamoDB item?
Issue an UpdateItem against the item's full primary key with a SET update
expression naming only the attributes you're changing, plus
attribute_exists(PK) as a condition if the item must already exist. In a GUI, the
item editor builds that update for you.
Why does filtering still cost a full scan? Because DynamoDB applies the filter after the scan reads the items. Filtered-out items are still read and metered. To cut cost, query by a partition key (or a GSI) instead of scanning.
Can I update many items at once?
There's no UPDATE … WHERE. Each UpdateItem/DeleteItem targets a single primary
key. To change several items in one atomic request, TransactWriteItems applies up to
100 write actions (including Update) that all succeed or all roll back. Otherwise you
scan/query to collect the keys, then write each (up to 25 per BatchWriteItem).
Can I browse a DynamoDB Local table the same way? Yes: point the same GUI at the local endpoint. See DynamoDB Local.
Want to browse, filter and edit DynamoDB items with staged, reviewable changes, and run the SQL PartiQL can't? Download DynoTable.