The market keeps its catalogue and orders on the web server's own disk. When that server goes, so does the data. A database belongs somewhere that outlives any one server.
Where the database lives
| Option | You run | AWS runs |
|---|---|---|
| PostgreSQL on EC2 | the engine, patches, backups, failover | the server |
| RDS | your tables and queries | the engine, patches, backups, failover |
| Aurora | your tables and queries | RDS, with storage across three zones |
| DynamoDB | your items and keys | everything: no server at all |
Relational or key-value
RDS runs a relational engine (PostgreSQL, MySQL, MariaDB, Oracle, SQL Server) on an instance AWS looks after. You get SQL: tables, joins, reports.
DynamoDB is a key-value store. Each item is found by its key; there is no SQL and no joins, and it stays fast however big it grows. It suits carts, sessions and catalogue lookups.
| The data is read | Choose |
|---|---|
| with joins, sums and new questions every week | RDS (or Aurora) |
| one item at a time by its key, at any scale | DynamoDB |
Aurora is AWS's own engine, compatible with PostgreSQL and MySQL, with storage copied across three zones and up to 15 replicas.
In front of a database, ElastiCache (Redis or Memcached) and DAX (for DynamoDB) keep hot data in memory, and RDS Proxy shares a few database connections among many short-lived clients.
What the account has
aws rds describe-db-instances --query "DBInstances[].[DBInstanceIdentifier,Engine,DBInstanceStatus]" --output tableaws dynamodb list-tablesBoth are empty for now. This chapter fills them: PostgreSQL on RDS for orders and reports, DynamoDB for the catalogue.