How to choose AWS Database
Tags: database, aws, cloud, cloudnative
Published: 2023-04-21 23:03:35

AWS offers many different options for different [Database](https://aws.amazon.com/free/database/).

All database could fall into 2 categories, Relation Database and Non-relational database.

In this article, we are talking about an overview of different cloud native database on AWS, to compare some limit and differences between each Databse Options, how to choose each database in different use cases.

# Relational Database — AWS Aurora

![aws relational db](https://miro.medium.com/v2/resize:fit:411/1*4cx8dY8sNotDMDCZoeSrcQ.png)


AWS Aurora is a fully managed relational database engine, It has 2 compatibility models, PostgreQL and MySQL/MariaDB,

-   storage limit is 128TB
-   table size limit 64TB(MySQL) and 32TB (Postgres)

# Non-relational Database

There are more options for non-relational db in AWS.

![AWS Non Relational DB diagram](https://miro.medium.com/v2/resize:fit:700/1*tLThGywdtaO60XCP8T61qw.png)



# Document Based

## DynamoDB:

One of the most popular database from AWS. It is a highly scalable and highly available NoSQL database that is designed for low-latency, high-throughput applications. DynamoDB is a document-based database that uses tables, items, and attributes to store and retrieve data. It supports both document and key-value data models, allowing you to choose the data model that best fits your application needs.

-   item size: 400kb, (per row) [ref: DynamoDB Limit](https://www.alexdebrie.com/posts/dynamodb-limits/#dynamodb-item-size-limit)
-   storage limit: [Unlimited in theory](https://www.effectual.com/amazon-dynamodb/), there are transactions limit applied

> _While 400KB is large enough for most normal database operations, it is significantly lower than the other options. MongoDB allows for documents to be 16MB, while Cassandra allows blobs of up to 2GB. And if you really want to get beefy, Postgres allows rows of up to 1.6TB (1600 columns X 1GB max per field)!_

## AWS Document DB(MongoDB Compatible)

AWS DocumentDB is a document-based database service that is compatible with MongoDB. It is designed to help you run your MongoDB workloads on AWS with high performance, scalability, and availability. DocumentDB supports the MongoDB API, allowing you to use your existing MongoDB applications, drivers, and tools with minimal changes.

-   max db size 64TB
-   max collection size 32TB (similar to a table in Relational Database)
-   max document size 16MB

## Simple DB

SimpleDB is a highly available and flexible non-relational data store that is designed to help you store and query structured data. It is a fully managed service that provides automatic scaling and high availability, making it easy to build scalable and highly available applications. SimpleDB is ideal for storing small amounts of data that require simple querying and indexing, such as product catalogs, user profiles, and event logs.

-   Maximum domain size: 10 GB (similar to a table in Relational DB)

## How to Choose between DynamoDB, Document DB and Simple DB?

If you are already using MongoDB and want to migrate your workload to AWS, AWS DocumentDB is a great option. If you need a highly available, flexible data store for small amounts of structured data, SimpleDB is a good choice. If you need a highly scalable, highly available NoSQL database for low-latency, high-throughput applications, DynamoDB is the right option. All three services are fully managed and can be easily integrated with other AWS services.

# Graph Based

Neptune is AWS’s graph-based database that is designed to store and navigate highly connected data. It supports popular graph query languages such as Apache TinkerPop Gremlin and SPARQL, making it easy to develop graph-based applications. The one big compatible Graph db on the market is Neo4j, AWS offer [a migration guide from Neo4j to AWS Neptune](https://docs.aws.amazon.com/neptune/latest/userguide/migrating-from-neo4j.html).

# Data Warehouse or Column Oriented

Redshift, on the other hand, is AWS’s data warehousing solution. It is designed to help businesses analyze and process large amounts of data quickly and cost-effectively. Redshift is a columnar database that uses massively parallel processing (MPP) to distribute queries across multiple nodes, allowing for high-performance data processing. Redshift also offers a range of security features, including encryption, network isolation, and fine-grained access controls. It has some limitations as well, one is it does not support updates or deletes on tables with a sort key, so you may need to redesign your table schema to work with Redshift.

**Why Choose Redshift?**

In short, if you need a column oriented database, or a warehouse, choose Redshift.

# Key Value Database

ElastiCache is AWS’s in-memory data store that supports two open-source in-memory engines, Redis and Memcached. It is designed to help improve the performance and scalability of your applications by caching frequently accessed data in memory. ElastiCache allows you to create, scale, and manage in-memory data stores with ease, and it supports use cases such as caching, session management, and real-time analytics. With ElastiCache, you can increase the throughput and reduce the latency of your applications while reducing the load on your backend databases. — [More about ElasiCache](https://dev.to/aws-builders/the-in-memory-cache-db-amazon-elasticache-3d4a) Limitation of ElastiCache:

-   ElastiCache is not a durable data store, so if you lose your cache, you will need to rebuild it from your data source.
-   ElastiCache does not support data replication across regions.

Memory DB, on the other hand, is AWS’s in-memory database that is designed for real-time applications that require sub-millisecond response times. Memory DB is fully managed and highly available, and it supports high-throughput, low-latency workloads that require fast and predictable response times. Memory DB can be used for applications such as gaming, real-time bidding, and finance, where sub-millisecond response times are critical.

Limitation of Memory DB:

-   MemoryDB is designed for high performance, but it may not be as flexible or scalable as other database engines.
-   MemoryDB is currently only available in a limited number of AWS regions.

**How to choose between ElastiCache and MemoryDB?**

In short, if cache is needed, choose ElastiCache, if latency is the issue or you want to build some real time application, choose Memory DB

# In Sum

> This article does not include all database categories, for example, AWS Timestream and AWs Ledget Database.
> 
> Different cloud provider may offer similar products, for example Oracle’s JSON-base Database is very similar to AWS Document DB.