aws cloud databases nosql

Should I use Aurora or DynamoDB?

Recently someone posted a question on Reddit regarding the selection of a database for their use case. They want to manage some game data:

  • Player name
  • Player ID
  • Status (active/inactive)

This blog has my take on the question.

Read on Reddit:

Access patterns

Access patterns are known:

  1. Search player by name
  2. Search player by ID
  3. Get player’s status

Writes & Reads

Writes are infrequent and there are 100 reads expected per day.

Go with DynamoDB?

Here is my take on why I would go with Amazon DynamoDB for this use case. Amazon Aurora is PosgreSQL-compatible/MySQL-compatible database engine. It is an enterprise grade database meant for OLTP applications that needs to deal with high volume transactions and throughput. This use-case will not take advantage of any of those capabilities. DynamoDB on the other hand is a name-value NoSQL database that is serverless, offers high performance & automatic scaling.

Use-case

  • Use DynamoDB as access patterns are well defined
  • Queries are simple name-value type
  • Joins are NOT needed; which are not available in DynamoDB
  • Aurora shines for Write-Intensive applications and this use case is not the kind of application that will get any value from a enterprise class database like Aurora

Ease of development

  • DynamoDB API are simple/straight forward to use
  • Simplified code means easier maintenance

Cost

  • DynamoDB is serverless with pricing control that can help with keeping the usage costs low
  • Aurora will require at-least one DB instance to be up and running at all times. Even with smallest instance we are talking about $100s per month

Operations

  • Much simpler to manage DynamoDB
  • No housekeeping tasks such as re-indexing/vacuuming/analyze needed for DynamoDB
  • For High-Availability, Aurora needs at least 2 instances to be up whereas DynamoDB is highly available as the data is replicated across 3 availability zones (at no extra cost)

How would you model it?

  • Setup a table with PK = name, SK = id
  • Setup an inverted GSI i.e., PK = id, SK = name

Solution walkthrough

Join Raj’s course “Amazon DynamoDB Data Modeling”

Read/Enroll in course on UDEMY (discount applied)

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *