DynamoDB has size limits on its components, described in the following list. This may vary from region to region:
- Capacity unit:
- One read capacity unit = one strongly consistent read per second or two eventually consistent reads per second, for items up to 4 KB in size
- One write capacity unit = one write per second for items up to 1 KB in size
- Table size:
There is no practical limit on table size. Tables are unconstrained for the number of items and number of bytes. But for any AWS account, there is an initial limit of 256 tables per region. To increase the limit, you have to raise the request. - Secondary indexes:
You can define a maximum of five local secondary indexes per table. You can project up to 20 attributes into all of the table's local and global secondary indexes. These should be used to define the attributes. While creating the table operation, if you specify the ProjectionType of INCLUDE, then the number of NonKeyAttribute for all of the secondary indexes should not exceed 20. If you project the same attribute name in two different indexes, it will assume that these are two different attributes while counting. - Partition key:
The minimum length of the partition key value is 1 byte and the maximum length is 2,048 bytes. There is no limit to the number of distinct partition key values for tables or secondary indexes. - Sort key:
The minimum length of the sort key value is 1 byte and the maximum length is 1,024 bytes. There is no limit to the number of distinct sort key values per partition key value. - Naming rules:
Names for tables and secondary indexes must be at least three characters long, but no more than 255 characters are allowed. - Accepted characters are as follows:
- A-Z
- Z-z
- 0-9
- _(Underscore)
- -(Hyphen)
- .(Dot)
- Attribute names:
In general, the attribute name must be at least one character long and should not exceed 64 KB in length. If an attribute name is used in a secondary index partition key name, secondary index sort key name, or any user-specified projected attribute, then it should not be greater than 255 characters long.
Attribute names must be encoded using UTF-8. The total size of the name of each name cannot exceed 255 bytes. - Data types:
- String: The maximum length for the string of any item should be less than 400 KB. Strings are written in Unicode with UTF-8 binary encoding. DynamoDB determines the length of the string using UTF-8 bytes.
- Numbers: A number can have up to 38 digits of precision, and can be positive, negative, or zero. DynamoDB uses a JSON string to represent numerical data in both the request and the response.
- Binary: The length of the binary is constrained by the maximum item size of 400 KB. An application must encode the data in Base64 format before sending it to DynamoDB. After receiving the data, DynamoDB decodes it into an unsigned byte array and uses that as the length of the attribute.
- Items:
The maximum size of an item in DynamoDB is 400 KB, which includes both the attribute name's binary length and the attribute's value length. Say we have an item with two attributes, one named shirt-color with the value R and the other shirt-size with the value M. The total size of this item would be 23 bytes. - Attributes:
The cumulative size of the attributes per item must fit within the maximum DynamoDB item size, namely 400 KB.