Lesson 1 of 2 Amazon RDS and Aurora

Choosing Amazon RDS, Aurora or DynamoDB for Application Data

This lesson explains when to use a relational database and what Amazon RDS and Amazon Aurora provide. Amazon RDS runs managed relational database engines, and Aurora is the MySQL- and PostgreSQL-compatible database built for the cloud; both suit data that is relational and needs joins, complex queries or multi-table transactions.

Learning outcomes

After completing this lesson, you will be able to:

  • Choose between a relational database and DynamoDB from an application's query requirements.
  • Distinguish Multi-AZ deployments from read replicas.
  • Describe the principal characteristics of Amazon Aurora.
  • Explain how automated backups and snapshots are restored.

Relational database or DynamoDB?

Relational databases and DynamoDB are designed around different assumptions about how data is queried. A relational database, such as one on Amazon RDS or Aurora, stores data in normalised tables and answers questions that were not planned when the schema was designed, using SQL joins, aggregations and ad hoc filters. It suits reporting, complex transactions across many tables and existing applications written for SQL. Its capacity is bounded by the size of the database instances, and scaling writes usually means a larger instance.

DynamoDB is designed for access patterns that are known in advance. Each request reads or writes items by key, which keeps latency in single-digit milliseconds at any scale and removes servers and connection limits from the design. In return, queries that the keys and indexes do not support require a scan or a copy of the data in another service. The following table summarises the choice.

ChooseWhen you need
RDS or AuroraComplex queries, joins, ad hoc reporting, or an existing SQL application
DynamoDBPredictable key-based access at very large scale with single-digit millisecond latency

Amazon RDS

RDS supports MySQL, PostgreSQL, MariaDB, Oracle, SQL Server and Db2, and handles backups, patching and failover for you. Two features that both create copies of a database are often confused, because they solve different problems.

A Multi-AZ deployment protects availability. In a Multi-AZ DB instance, RDS keeps a standby in another Availability Zone and copies every write to it synchronously, so no committed data is lost if the primary fails. The standby does not serve any traffic. When the primary or its Availability Zone fails, RDS promotes the standby and points the database's DNS name at it, so applications reconnect to the same endpoint, typically within one to two minutes. A Multi-AZ DB cluster instead uses two standbys that can serve reads and usually fails over faster.

A read replica improves read performance. RDS copies changes to the replica asynchronously, so it can lag slightly behind the primary, and the replica has its own endpoint that accepts read-only queries. The application must send its reads, such as reports, to that endpoint; RDS does not split traffic automatically. Replicas can be created in other Regions and promoted to stand-alone databases, for example for disaster recovery. Aurora combines both roles: its replicas share the cluster's storage, serve reads through a reader endpoint and act as failover targets.

The following table summarises the differences.

Multi-AZ
PurposeHigh availability
ReplicationSynchronous to a standby in another AZ
Serves traffic?No, in a Multi-AZ DB instance the standby only takes over on failover; a Multi-AZ DB cluster adds two readable standbys
Read replicas
PurposeScaling reads
ReplicationAsynchronous; may lag slightly
Serves traffic?Yes, read queries

Amazon Aurora

Amazon Aurora is a relational database engine built for the cloud. The following list describes its principal characteristics.

  • Stores six copies of your data across three Availability Zones.
  • Supports up to 15 low-lag replicas.
  • Provides a writer (cluster) endpoint and a reader endpoint that load-balances across the replicas.
  • Aurora Serverless v2 scales capacity automatically.
  • Aurora Global Database replicates across Regions.

Backups and restores

RDS provides automated backups and manual snapshots, which are restored to new instances. The following list describes their behaviour.

  • Automated backups allow point-in-time recovery for up to 35 days.
  • A restore always creates a new instance with a new endpoint, so the application's connection settings must be updated.
  • Manual snapshots are kept until you delete them.
  • Aurora also offers cloning for quick test copies and, for MySQL, Backtrack to rewind a cluster in place.
Worked example

Choosing between DynamoDB and Aurora

An application has several data requirements, each suited to a different type of database. The following table identifies the appropriate choice for each and the reason for it.

RequirementChoiceWhy
Shopping carts for millions of users, looked up by user IDDynamoDBKey-value access at any scale, serverless
Orders, invoices and payments with joins and transactions across tablesAurora PostgreSQLRelational model, SQL, multi-table transactions
Ad hoc reporting queries with GROUP BY across many columnsAurora (or a read replica), not DynamoDBDynamoDB cannot run arbitrary queries efficiently
Variable traffic with idle nightsAurora Serverless v2 or DynamoDB on-demandCapacity follows load

Applications often use both: DynamoDB for high-volume session and cart data, Aurora for the transactional core, each matched to its access pattern.

Check yourself

Which RDS feature provides automatic failover, and which one adds read capacity?

Show answer

A Multi-AZ deployment keeps a synchronous standby and fails over to it automatically. Read replicas use asynchronous replication and serve read traffic, which the standby of a Multi-AZ DB instance does not.

Exam Tips

Remember for the exam

  • High availability with automatic failover is Multi-AZ; read scaling is read replicas.
  • To send read queries to Aurora replicas, use the reader endpoint.
  • A point-in-time restore creates a new instance with a new endpoint.
  • Joins and ad hoc SQL reporting point to RDS or Aurora rather than DynamoDB.