Image from @awsgeek
DynamoDB
DynamoDB Basics
- ๐ Homepage โ Developer guide โ FAQ โ Pricing
- DynamoDB is a NoSQL database with focuses on speed, flexibility, and scalability.
- DynamoDB is priced on a combination of throughput and storage.
DynamoDB Alternatives and Lock-in
- โ Unlike the technologies behind many other Amazon products, DynamoDB is a proprietary AWS product with no interface-compatible alternative available as an open source project. If you tightly couple your application to its API and featureset, it will take significant effort to replace.
- The most commonly used alternative to DynamoDB is Cassandra.
DynamoDB Tips
- There is a local version of DynamoDB provided for developer use.
- DynamoDB Streams provides an ordered stream of changes to a table. Use it to replicate, back up, or drive events off of data
- DynamoDB can be used as a simple locking service.
- DynamoDB indexing can include primary keys, which can either be a single-attribute hash key or a composite hash-key range. You can also query non-primary key attributes using secondary indexes.
- Data Types: DynamoDB supports three data types โ number, string, and binary โ in both scalar and multi-valued sets. DynamoDB can also support JSON.
- As of late 2017, DynamoDB supports both global tables and backup / restore functionality.
DynamoDB Gotchas and Limitations
- ๐ธ DynamoDB doesnโt provide an easy way to bulk-load data (it is possible through Data Pipeline) and this has some unfortunate consequences. Since you need to use the regular service APIs to update existing or create new rows, it is common to temporarily turn up a destination tableโs write throughput to speed import. But when the tableโs write capacity is increased, DynamoDB may do an irreversible split of the partitions underlying the table, spreading the total table capacity evenly across the new generation of tables. Later, if the capacity is reduced, the capacity for each partition is also reduced but the total number of partitions is not, leaving less capacity for each partition. This leaves the table in a state where it much easier for hotspots to overwhelm individual partitions.
- ๐ธ It is important to make sure that DynamoDB resource limits are compatible with your dataset and workload. For example, the maximum size value that can be added to a DynamoDB table is 400 KB (larger items can be stored in S3 and a URL stored in DynamoDB).
- ๐ธ Dealing with time series data in DynamoDB can be challenging. A global secondary index together with down sampling timestamps can be a possible solution as explained here.
- ๐ธ DynamoDB does not allow an empty string as a valid attribute value. The most common work-around is to use a substitute value instead of leaving the field empty.
- ๐ธ When setting up fine grained policies for access to DynamoDB tables, be sure to include their secondary indices in the policy document as well.