← Cloud Practitioner study path

Technology and services · 12 min

Amazon RDS and Amazon Aurora

In this lesson you will learn what a relational database is, who manages what when you run it on premises, on Amazon EC2 or on Amazon RDS, how Multi-AZ and a read replica differ, and what Amazon Aurora offers.

A database is a program that stores organized information so it can be found quickly, and a relational database stores it in tables that are related to each other. For example, an online store stores its customers, its products and its orders in tables, where each order points to a customer and to several products. That way, when the store opens an order, it knows who placed it and what they bought without writing the customer's name in every order. This type of database is the one used by , and almost any e-commerce site.

On AWS you can have a relational database in two ways. The first is to install it yourself on an EC2 , and the second is to use a managed service, where AWS does the and the for you. For example, if the store installs its database on EC2, someone on its team has to remember to back it up every night; with the managed service, AWS does it on its own.

Who manages the database?

What you manage and what AWS manages on premises, on Amazon EC2 and on Amazon RDS

The Amazon RDS guide compares three places where a database can live, and in each one AWS takes care of a different part of the work:

  • On premises, that is, on computers your company buys and keeps in its own building, which is where you do everything, from power and cooling to the database.
  • On Amazon EC2, where AWS takes care of the , and you install, patch, back up and scale the database, that is, give it more capacity as it grows.
  • On Amazon RDS, where AWS takes care of almost everything, and all that is left for you is to optimize your application, that is, make it request the data in the best way.

That is why AWS recommends RDS as the default option for most relational databases. Installing the database on EC2 makes sense when you need full control, for example when you need a version or a configuration of the that RDS doesn't offer. For example, the store uses RDS so it doesn't have to deal with backups or patching, while a bank that needs a very old version of its engine installs it on EC2 and looks after it itself.

Amazon RDS

The Amazon RDS engines: IBM Db2, MariaDB, Microsoft SQL Server, MySQL, Oracle Database and PostgreSQL, along with Amazon Aurora

Amazon RDS (Relational Database Service) is the AWS service for managed relational databases. In RDS you choose the engine and the size of the database, and AWS takes care of backups, patching, failure detection and recovery. For example, if the computer running the store's database fails in the middle of the night, RDS detects it and recovers it without anyone at the store having to wake up.

RDS offers the best-known database engines, which are IBM Db2, MariaDB, Microsoft SQL Server, MySQL, Oracle Database and PostgreSQL. Also, Amazon Aurora is part of RDS too. For example, if the store already used MySQL on its own computer, it chooses MySQL on RDS and its application keeps talking to the database the same way.

Where do you put the database?

Your application needs a database engine configuration that Amazon RDS doesn't offer, and your team agrees to take care of patching and backups. Where do you put the database?

What is the difference between Multi-AZ and a read replica?

Multi-AZ and read replicas are two RDS features that create another copy of your database, and that is why they get confused. However, each one solves a different problem, because Multi-AZ keeps the database available if something fails and the read replica makes the database respond faster. For example, the store uses Multi-AZ to keep selling if a data center goes down, and uses a read replica so its reports don't slow down the website.

Multi-AZ deployment with a standby instance and a read replica

Multi-AZ

In a Multi-AZ deployment, RDS keeps a standby instance in another , synchronized with the primary, that is, with the same data at all times. If the primary instance fails, RDS switches to the standby instance without you doing anything, and that switch is called failover. For example, if the zone where the store's primary database lives loses power, RDS switches to the copy in the other zone and customers keep shopping.

In the deployment with a single standby instance, that copy doesn't serve reads, because it is only there for availability. There is also the Multi-AZ cluster, with two standby instances that do serve reads. For example, with a single standby instance, the store can't send queries to that copy while the primary is working.

Read replica

A read replica is a read-only copy of the database, that is, a copy that data can be read from but not written to. The application sends it queries that read a lot, such as heavy end-of-month reports. That way, the replica takes load off the primary database and the application doesn't slow down. For example, the store's accounting team runs its monthly sales report on the replica, while customers keep shopping on the primary database without noticing anything.

Multi-AZ or read replica?

0 of 5

Tap the correct column for each case.

  1. If the primary database's zone fails, the database stays available

  2. Heavy end-of-month reports slow down the database

  3. A synchronized copy in another zone that, with a single standby instance, doesn't serve reads

  4. Scale the application's reads

  5. Automatic failover

Amazon Aurora

The three characteristics of Amazon Aurora: up to 6 times the throughput of standard MySQL and PostgreSQL, copies in three Availability Zones and a volume that grows on its own up to 256 TiB

Amazon Aurora is the relational database built by AWS. Aurora is compatible with MySQL and PostgreSQL, so the code and tools you already use with those engines work with it. For example, if the store's application already works with MySQL, it can move to Aurora without rewriting how it saves and reads its orders.

The Aurora documentation attributes three characteristics to it:

  • Performance, which reaches up to 6 times the of standard MySQL and PostgreSQL. For example, the store can handle more orders per second on its biggest sales day.
  • Copies of the data, which are stored in three Availability Zones in the same Region, so the data is still there if a zone fails. For example, if a zone goes out of service, the store's orders are still stored in the other two.
  • The volume, which is the space where the data is stored and which grows on its own up to 256 . For example, the store doesn't have to ask for more space when its catalog grows.

True or false?

0 of 4
  1. To move from MySQL to Aurora you have to rewrite your code.

  2. Aurora stores copies of the data in three Availability Zones in the same Region.

  3. In Aurora you choose the volume size and expand it by hand.

  4. Aurora is part of Amazon RDS.

Other AWS databases

Apart from RDS and Aurora, AWS has Amazon Redshift, a managed, petabyte-scale data warehouse. A data warehouse is a store where huge amounts of data are gathered to analyze them with SQL, the language used to ask a database questions. Databases that don't store data in related tables, such as Amazon DynamoDB, are called NoSQL databases. For example, the store keeps its orders in Aurora, gathers years of sales in Redshift to analyze them and can store each customer's cart in DynamoDB.

How do you recognize each option on the exam?

In questions about relational databases, look in the question for how much the company wants to manage. These are the phrases that point to each option:

  • "Less administrative work", "automatic backups and patching" or "managed relational database", which point to RDS.
  • "Full control of the operating system or the engine", which points to installing the database on EC2.
  • "Compatible with MySQL or PostgreSQL" together with "high performance", which points to Aurora.

When the question is about Multi-AZ or replicas, look for the problem to solve:

  • "If the zone fails", "high availability" or "failover", which point to Multi-AZ.
  • "Reporting queries slow down the database" or "scale reads", which point to a read replica.
  • "Data warehouse" or "analyze petabytes", which point to Redshift.

For example, if a question says that a school wants its grades database to keep working even if a zone fails, the phrase points to Multi-AZ.

cloud path tip: if you use an account with the new AWS experience, RDS and Aurora are included in the free plan, while Redshift is only available with the paid plan.

Review question

A company's production database runs on Amazon RDS for PostgreSQL. The finance department runs heavy queries every hour, and meanwhile customers notice the store is slow. What solves the problem with the fewest changes?

Next