Can DynamoDB have null values?

Yes. DynamoDB has a dedicated NULL type that represents an attribute with an unknown or undefined state. It also allows empty strings and empty binary values for non-key attributes, plus empty lists and maps. It does not allow empty sets (string, number, or binary), which are rejected with a ValidationException.

The NULL type

NULL is a real attribute type, written as {"NULL": true}. Use it when you want to record that a field exists but has no value — distinct from simply omitting the attribute.

What empties are allowed

  • Empty string / empty binary — allowed on non-key attributes, and inside lists and maps.
  • Empty list / empty map — allowed.

What is not allowed

  • Empty sets (SS, NS, BS) — rejected with a ValidationException.
  • Empty string or binary on a key attribute — key values must have length greater than zero.

Modeling tip

Omitting an attribute entirely is often cleaner than storing NULL, and it enables sparse indexes. Choose based on whether "absent" and "explicitly null" mean different things in your model.

Go deeper

Read DynamoDB data types and sparse indexes. Download DynoTable to edit attributes, including NULL, directly.

无需控制台即可使用 DynamoDB

DynoTable 是面向 DynamoDB 的快速桌面客户端 —— 浏览表、运行 SQL 风格的查询,并在本地编辑项。