Start tracking your progress
Trailhead Home
Trailhead Home

Scale Amazon RDS

Learning Objectives

After completing this unit, you’ll be able to:

  • Explain how to scale Amazon RDS.
  • Describe Amazon RDS Multi-AZ.
  • Differentiate between scaling and high availability on Amazon RDS.

You have an EC2 instance running your cat photo application. You also have one Amazon RDS DB instance that runs your relational database. However, there may come a time when your cat photo records are too much for one DB instance to handle. Luckily, with Amazon RDS, you have scalability options. 

Scaling Amazon RDS

Two databases with an arrow in between, meant to show a scaling operation on a database.

Amazon RDS separates compute and storage. This separation allows you to scale compute and storage independently. If you want to scale compute, you can increase the size of your DB instance or change the DB instance family. If you want to scale storage, you can manually modify your storage layer to increase the size of your EBS volumes or you can enable Amazon RDS Storage Auto Scaling to automatically increase storage capacity. With Amazon RDS Storage Auto Scaling enabled, Amazon RDS will detect when you are running low on database storage and scale up your storage for you. 

There are some limitations when working with Amazon RDS Storage Auto Scaling. To see if it matches your workload, see the Amazon RDS Storage Auto Scaling documentation

Another way of scaling is by using Amazon RDS read replicas. While this module doesn’t cover this information, you can find more details about this feature in the resources section at the end of this unit. 

Achieve High Availability with Amazon RDS

When you increase the size of your DB instance, you may experience some downtime. To limit negative effects of this downtime, you can schedule your scaling operation to occur during a maintenance window of your choice. Typically, this maintenance window occurs during a period of time when your database experiences minimal activity.

If you want to reduce this downtime even further, you can create a highly available database that experiences less downtime during scaling operations, patching, and system failures. High availability on Amazon RDS ensures that you have a database presence in two Availability Zones (AZs). This feature is referred to as Amazon RDS Multi-AZ. 

Get Redundancy with Amazon RDS Multi-AZ

When you enable Amazon RDS Multi-AZ, Amazon RDS creates a redundant copy of your database in another AZ. You end up with two copies of your database: a primary copy in a subnet in one AZ and a standby copy in a subnet in a second AZ. The primary copy of your database provides access to your cat data so that applications can query and display that information. 

The cat data in the primary copy is synchronously replicated to the standby copy. The standby copy is not considered an active database, and does not get queried by applications.

A primary and standby copy of an RDS database. The cat photo application queries only the primary database. The primary copy synchronously replicates to the standby copy.

To improve availability, Amazon RDS Multi-AZ ensures that you have two copies of your database running and that one of them is in the primary role. If there’s an availability issue, such as the primary database losing connectivity, Amazon RDS triggers an automatic failover.

When you create a DB instance, a domain name system (DNS) name is provided. AWS uses that DNS name to failover to the standby database. In an automatic failover, the standby database is promoted to the primary role and queries are redirected to the new primary database. 

To ensure that you don’t lose Multi-AZ configuration, a new standby database is created by either: 

  • Demoting the previous primary to standby if it’s still up and running
  • Or standing up a new standby DB instance

In the previous unit, you learned about subnet groups. The reason you can select multiple subnets for an Amazon RDS database is because of the Multi-AZ configuration. You’ll want to ensure that you have used subnets in different AZs for your primary and standby copies.

It’s important to note, Multi-AZ deployments are only available for MySQL, MariaDB, Oracle, and PostgreSQL engines.

Wrap Up

For scalability, you can increase your DB instance size and storage capacity. For high availability, you can enable Multi-AZ for your database. In the next unit, you learn about database options on AWS that go beyond the relational model. 

Resources