Time to 10x your DynamoDB productivity with Dynobase [learn more]
DynamoDB currently supports following list of data types:
Can be positive, negative or zero. Keep in mind that trailing and leading zeros are removed. Numbers can be also used to represent the date using Epoch format. It's using less storage and might be easier to parse from your application.
Keep in mind that the Number type can store 126-bit integers or floats with up to 38 digits of decimal precision.
The largest and the smallest Number, respectively, that you can store in DynamoDB are:
99,999,999,999,999,999,999,999,999,999,999,999,999 (10^38-1) -99,999,999,999,999,999,999,999,999,999,999,999,999 (-10^38+1)
If you need to store a smaller/bigger number, or a float with bigger precision, consider using String type.
DynamoDB supports UTF-8 binary encoded strings which length is limited by the maximum item size which is 400 KB. If String is used as primary key, then the length of it is limited to 2048 bytes for single key and 1024 bytes for composite key.
The size of a string is (length of attribute name) + (number of UTF-8-encoded bytes).
Just like with Strings, binary length is limited by the maximum item size which is 400 KB. Binaries must be encoded using base64 before being sent to DynamoDB. Binary types can also be used for keys and they have same length restriction rules as Strings.
The size of a binary attribute is (length of attribute name) + (number of raw bytes).
Represents unknown, null, or undefined value.
An equivalent of JS Array which can store multiple items of different types.
Map (also known as Object) is JSON like structure of unordered key-value pairs. Similarily to list, Map can contain mixed types elements.
Keep in mind that DynamoDB automatically orders keys in the Map. If the order of keys is important in your application, consider stringifying your JSON first and saving it as a string.
Moreover, if your object has a lot of repeating keys and values, you might consider stringifying it and compressing with
gzip. This can make your blobs up to x10 smaller. The drawback though is that you won't be able to natively query on object nested keys.
StringSet [SS], BinarySet [BS] and NumberSet [NS]
DynamoDB supports multiple types of Sets where unlike Lists, all the elements within a set must be of the same type and all the elements must be also unique. Another difference between Set and List is that Set does not perserve the sequence of elements. BinarySet can only contain Binary elements, NumberSet can only contain Numbers and StringSet can only contain Strings.
© 2022 Dynobase