DDCRDS Patching & Upgrades

High Level Overview

One key feature of Amazon RDS is that you can easily upgrade a database instance to a new minor or major version of your database engine. You can perform upgrades on demand by using the AWS Management Console or AWS CLI. You can decide to automatically upgrade to a new minor engine version when it is marked as the preferred version by the Amazon RDS service team. You also need to upgrade your database engine version when an existing version is deprecated. Such deprecation happens when a version is no longer supported or has functional issues that are resolved in a future version.

Although Amazon RDS makes upgrades simple, you still need to be aware of a number of caveats to get the best experience. In this post, I discuss some of the caveats about upgrading versions of the MySQL and MariaDB database engines for Amazon RDS in the following topics:

  • What happens behind the scenes during an engine upgrade?
  • Problems that can occur during an upgrade
  • Ways to detect problems before scheduling an upgrade
  • How to minimize downtime using read replicas

What happens behind the scenes during an engine upgrade?

Amazon RDS supports both minor and major engine upgrades. A minor engine upgrade keeps the major version the same while advancing the minor version, for example going from 5.6.27 to 5.6.37. In contrast, a major version upgrade advances both minor and major version numbers, for example going from 5.6.27 to 5.7.19.

Minor version upgrades include only database changes that are backward-compatible with previous minor versions (of the same major version) of the database engine. The distinction between minor and major version upgrades is important. A major version upgrade can take longer than a minor version upgrade. You can also run into compatibility issues during or after a major version upgrade, which are very unlikely after a minor version upgrade.

Also, you can advance the major version only one step at a time. For example, an instance running 5.5.46 that needs to go to 5.7.19 first upgrades to a 5.6 version like 5.6.37 and then to 5.7.19. Additionally, usually the target version is restricted to the most recent version. For example, you might be able to upgrade an instance from 5.6.37 to 5.7.19, but not from 5.6.37 to 5.7.16.

Methods to upgrade the minor version of a DB cluster or to patch a DB cluster:

Upgrading the minor version of an Aurora MySQL cluster applies additional fixes and new features to an existing cluster.

This kind of upgrade applies to Aurora MySQL clusters where the original version and the upgraded version are both in the Aurora MySQL 2.x series. The process is fast and straightforward because it doesn’t involve any conversion for the Aurora MySQL metadata or reorganization of your table data.

You perform this kind of upgrade by modifying the engine version of the DB cluster using the AWS Management Console, AWS CLI, or the RDS API. If your cluster is running Aurora MySQL 2.x, choose a higher 2.x version.

To modify the engine version of a DB cluster

By using the console – Modify the properties of your cluster. In the Modify DB cluster window, change the Aurora MySQL engine version in the DB engine version box. If you aren’t familiar with the general procedure for modifying a cluster, follow the instructions at Modifying the DB cluster by using the console, CLI, and API.

By using the AWS CLI – Call the modify-db-cluster AWS CLI command, and specify the name of your DB cluster for the —db-cluster-identifier option and the engine version for the —engine-version option.

For example, to upgrade to Aurora MySQL version 2.11.1, set the —engine-version option to 5.7.mysql_aurora.2.11.1. Specify the —apply-immediately option to immediately update the engine version for your DB cluster.

By using the RDS API – Call the ModifyDBCluster API operation, and specify the name of your DB cluster for the DBClusterIdentifier parameter and the engine version for the EngineVersion parameter. Set the ApplyImmediately parameter to true to immediately update the engine version for your DB cluster.

Enabling automatic upgrades between minor Aurora MySQL versions

For an Amazon Aurora MySQL DB cluster, you can specify that Aurora upgrades the DB cluster automatically to new minor versions. You do so by using the automatic minor version upgrade property of the DB cluster using the AWS Management Console, AWS CLI, or the RDS API.

The automatic upgrades occur during the maintenance window for the database.

Automatic minor version upgrade doesn’t apply to the following kinds of Aurora MySQL clusters:

  • Clusters that are part of an Aurora global database

  • Clusters that have cross-Region replicas

The outage duration varies depending on workload, cluster size, the amount of binary log data, and if Aurora can use the zero-downtime patching (ZDP) feature. Aurora restarts the database cluster, so you might experience a short period of unavailability before resuming use of your cluster. In particular, the amount of binary log data affects recovery time. The DB instance processes the binary log data during recovery. Thus, a high volume of binary log data increases recovery time.

To enable automatic minor version upgrades for an Aurora MySQL DB cluster

  1. Follow the general procedure to modify the DB instances in your cluster, as described in Modifying a DB instance in a DB cluster. Repeat this procedure for each DB instance in your cluster.

  2. Do the following to enable automatic minor version upgrades for your cluster:

By using the console – Complete the following steps:

  1. Sign in to the Amazon RDS console. choose Databases, and find the DB cluster where you want to turn automatic minor version upgrade on or off.

  2. Choose each DB instance in the DB cluster that you want to modify. Apply the following change for each DB instance in sequence:

  • Choose Modify.

  • Choose the Enable auto minor version upgrade setting. This setting is part of the Maintenance section.

  • Choose Continue and check the summary of modifications.

  • (Optional) Choose Apply immediately to apply the changes immediately.

  • On the confirmation page, choose Modify DB instance.

  • By using the AWS CLI – Call the modify-db-instance AWS CLI command. Specify the name of your DB instance for the —db-instance-identifier option and true for the —auto-minor-version-upgrade option. Optionally, specify the —apply-immediately option to immediately enable this setting for your DB instance. Run a separate modify-db-instance command for each DB instance in the cluster.

  • By using the RDS API – Call the ModifyDBInstance API operation and specify the name of your DB cluster for the DBInstanceIdentifier parameter and true for the AutoMinorVersionUpgrade parameter. Optionally, set the ApplyImmediately parameter to true to immediately enable this setting for your DB instance. Call a separate ModifyDBInstance operation for each DB instance in the cluster.