‹ Return to How tos

Changing the preferred maintenance and backup windows for your database in Amazon Lightsail

Last updated: March 15, 2019

When a new version of a database is supported by Amazon Lightsail, your existing managed database can be upgraded to it. There are two kinds of upgrades—minor version upgrades and major version upgrades. Currently, Lightsail supports only minor version upgrades.

Minor version upgrades, and other database maintenance tasks, are performed automatically during the preferred maintenance window for your database. The preferred maintenance window is a 30-minute window selected at random from an 8-hour block of time for each AWS Region. It occurs on a random day of the week. Database backups are performed during the preferred backup window. The preferred backup window is a 30-minute window selected at random from an 8-hour block of time for each AWS Region. It also occurs on a random day of the week.

Note

For more information about the preferred maintenance window time blocks for each region, see the Maintaining a DB Instance guide in the Amazon Relational Database Service (Amazon RDS) documentation. For more information about the preferred backup window time blocks for each region, see the Working With Backups guide in the Amazon RDS documentation.

This guide shows you how to change the preferred maintenance and backup windows, so that they occur when your database is under its lowest load.

Prerequisites

You must use the AWS Command Line Interface (AWS CLI) to change your database preferred maintenance and backup windows.

Complete the following prerequisites:

Change your database maintenance window

Your database may become unavailable during maintenance or backup operations. Therefore, you may want to change your preferred maintenance or backup window to a time in which your database is under its lowest load.

    To change your database maintenance window

  1. Open a Terminal or Command Prompt window.

  2. Enter the following command to get the name of the database for which you want to change the maintenance window:

    aws lightsail get-relational-databases

    You should see a result similar to the following example:

    The get-relational-databases response.

    Note

    If the database that you want to modify is not listed, confirm that your AWS CLI is configured for the AWS Region where the database is located. For more information, see Configuring the AWS CLI.

  3. Highlight the name of the database that you want to modify and press Ctrl+C if you’re using Windows, or Cmd+C if you’re using macOS, to copy it to your clipboard so that you can use it in the next step.

    Copy the database name.
  4. Enter one of the following commands depending on the preferred window that you are changing.

    • Enter the following command to change the database maintenance window. Be sure to paste the name of the database in place of DatabaseName, and enter the new maintenance window time frame in place of MaintenanceWindow:

      aws lightsail update-relational-database --relational-database-name DatabaseName --preferred-maintenance-window MaintenanceWindow

      Example:

      aws lightsail update-relational-database --relational-database-name myproductiondb --preferred-maintenance-window Tue:16:00-Tue:16:30

      Note

      You must enter the preferred maintenance window time in ddd:hh24:mi-ddd:hh24:mi format. It also must be in Universal Coordinated Time (UTC) format, and defined for a minimum window of 30 minutes. The preferred maintenance window cannot overlap the preferred backup window.

    • Enter the following command to change the database backup window. Be sure to paste the name of the database in place of DatabaseName, and enter the new backup window time frame in place of BackupWindow:

      aws lightsail update-relational-database --relational-database-name DatabaseName --preferred-backup-window BackupWindow

      Example:

      aws lightsail update-relational-database --relational-database-name myproductiondb --preferred-backup-window 14:00-14:30

      Note

      You must enter the preferred backup window time in hh24:mi-hh24:mi format. It also must be in Universal Coordinated Time (UTC) format, and defined for a minimum window of 30 minutes. The preferred backup window cannot overlap the preferred maintenance window.

    You should see a result similar to the following example:

    Database preferred maintenance window update result.

Next steps

Here are a few guides to help you manage your database in Lightsail: