Maintaining Amazon DocumentDB

    Some maintenance items require that Amazon DocumentDB take your instance offline for a short time. Maintenance items that require an instance to be offline include required operating system or engine patching. Required patching is automatically scheduled only for patches that are related to security and instance reliability. Such patching occurs infrequently (typically once every few months) and seldom requires more than a fraction of your maintenance window. You should expect that when maintenance is performed on your cluster or instance, if the instance is a primary instance, it will fail over. For more information, see Amazon DocumentDB Failover.

    Both cluster and instances maintenance have their own respective maintenance windows. By default, when you create a cluster, Amazon DocumentDB assigns a maintenance window for both a cluster and each individual instance. You can choose the maintenance window when creating a cluster or an instance. You can also modify the maintenance windows at any time to fit your business schedules or practices. It is generally advised to choose maintenance windows that minimize the impact of the maintenance on your application (for example, on evenings or weekends). This guidance is highly contextual upon the type of application and usage patterns that you experience.

    You can view whether a maintenance update is available for your cluster by using the AWS Management Console or the AWS CLI.

    If an update is available, you can do one of the following:

    • Defer the maintenance actions.

    • Apply the maintenance actions immediately.

    • Schedule the maintenance actions to start during your next maintenance window.

    • Take no action.

    Important

    Certain OS updates are marked as Required. If you defer a required update, you receive a notice from Amazon DocumentDB indicating when the update will be performed on your instance or cluster. Other updates are Available. You can defer these updates indefinitely.

    The maintenance window determines when pending operations start, but it does not limit the total execution time of these operations. Maintenance operations are not guaranteed to finish before the maintenance window ends, and they can continue beyond the specified end time.

    If an update is available, it is indicated by the word Available or Required in the Maintenance column for the cluster on the Amazon DocumentDB console, as shown here:

    Using the AWS CLI

    Use the following AWS CLI operation to determine what maintenance actions are pending. The output here shows no pending maintenance actions.

    Output from this operation looks something like the following (JSON format).

    1. "PendingMaintenanceActions": []
    2. }

    With Amazon DocumentDB, you can choose when to apply maintenance operations. You can decide when Amazon DocumentDB applies updates using the AWS Management Console or AWS CLI.

    Use the procedures in this topic to immediately upgrade or schedule an upgrade for your instance.

    You can use the console to manage updates for your Amazon DocumentDB instances and clusters.

    To manage an update for an instance or cluster

    1. Sign in to the AWS Management Console, and open the Amazon DocumentDB console at https://console.aws.amazon.com/docdb.

    2. In the navigation pane, choose clusters.

    3. In the list of clusters, choose the button next to the name of the cluster that you want to apply the maintenance operation to.

    4. On the Actions menu, choose one of the following:

      • Upgrade at next window to perform the pending maintenance tasks during the cluster’s next maintenance window.

        Note

        If there are no pending maintenance tasks, both of the preceding options are inactive.

    Using the AWS CLI

    To apply a pending update to an instance or cluster, use the apply-pending-maintenance-action AWS CLI operation.

    Parameters

    • --resource-identifier—The Amazon DocumentDB Amazon Resource Name (ARN) of the resource that the pending maintenance action applies to.

    • --apply-action—The pending maintenance action to apply to this resource.

      Valid values: system-update and db-upgrade.

    • --opt-in-type—A value that specifies the type of opt-in request, or undoes an opt-in request. An opt-in request of type immediate can’t be undone.

      Valid values:

      • immediate—Apply the maintenance action immediately.

      • undo-opt-in—Cancel any existing next-maintenance opt-in requests.

    For Linux, macOS, or Unix:

    1. aws docdb apply-pending-maintenance-action \
    2. --resource-identifier arn:aws:rds:us-east-1:123456789012:db:docdb \
    3. --apply-action system-update \
    4. --opt-in-type immediate

    For Windows:

    1. aws docdb apply-pending-maintenance-action ^
    2. --resource-identifier arn:aws:rds:us-east-1:123456789012:db:docdb ^
    3. --apply-action system-update ^
    4. --opt-in-type immediate

    To return a list of resources that have at least one pending update, use the describe-pending-maintenance-actions AWS CLI operation.

    For Linux, macOS, or Unix:

    For Windows:

    1. aws docdb describe-pending-maintenance-actions ^
    2. --resource-identifier arn:aws:rds:us-east-1:001234567890:db:docdb

    Output from this operation looks something like the following (JSON format).

    1. "PendingMaintenanceActions": [
    2. {
    3. "ResourceIdentifier": "arn:aws:rds:us-east-1:001234567890:cluster:sample-cluster",
    4. "PendingMaintenanceActionDetails": [
    5. {
    6. "Action": "system-update",
    7. "CurrentApplyDate": "2019-01-11T03:01:00Z",
    8. "Description": "db-version-upgrade",
    9. "ForcedApplyDate": "2019-01-18T03:01:00Z",
    10. "AutoAppliedAfterDate": "2019-01-11T03:01:00Z"
    11. }
    12. ]
    13. }
    14. ]
    15. }

    You can also return a list of resources for an instance or cluster by specifying the --filters parameter of the describe-pending-maintenance-actions AWS CLI operation. The format for the --filters operation is Name=`filter-name`,Values=`resource-id`,....

    The following are acceptable values for the Name parameter of filter:

    • db-instance-id—Accepts a list of instance identifiers or ARNs. The returned list only includes pending maintenance actions for the instances identified by these identifiers or ARNs.

    For Linux, macOS, or Unix:

    1. --filters Name=db-cluster-id,Values=sample-cluster1,sample-cluster2

    For Windows:

    Each maintenance action has a respective apply date that you can find when describing the pending maintenance actions. When you read the output of pending maintenance actions from the AWS CLI, three dates are listed:

    • CurrentApplyDate—The date the maintenance action will get applied either immediately or during the next maintenance window. If the maintenance is optional, this value can be null.

    • ForcedApplyDate—The date when the maintenance will be automatically applied, independent of your maintenance window.

    • AutoAppliedAfterDate—The date after which the maintenance will be applied during the cluster’s maintenance window.

    As an Amazon DocumentDB user, you can initiate updates to your clusters or instances. For example, you can modify an instance’s class to one with more or less memory, or you can change a cluster’s parameter group. Amazon DocumentDB views these changes differently from Amazon DocumentDB initiated updates. For more information about modifying a cluster or instance, see the following:

    To see a list of pending user initiated modifications, run the following command.

    To see pending user initiated changes for your instances

    For Linux, macOS, or Unix:

    1. aws docdb describe-db-instances \
    2. --query 'DBInstances[*].[DBClusterIdentifier,DBInstanceIdentifier,PendingModifiedValues]'

    For Windows:

    1. aws docdb describe-db-instances ^
    2. --query 'DBInstances[*].[DBClusterIdentifier,DBInstanceIdentifier,PendingModifiedValues]'

    Output from this operation looks something like the following (JSON format).

    In this case, sample-cluster-instance has a pending change to a db.r5.xlarge instance class, while sample-cluster-instance-2 has no pending changes.

    1. [
    2. [
    3. "sample-cluster",
    4. "sample-cluster-instance",
    5. {
    6. "DBInstanceClass": "db.r5.xlarge"
    7. }
    8. ],
    9. [
    10. "sample-cluster",
    11. "sample-cluster-instance-2",
    12. {}
    13. ]

    Each instance and cluster has a weekly maintenance window during which any pending changes are applied. The maintenance window is an opportunity to control when modifications and software patching occur, in the event either are requested or required. If a maintenance event is scheduled for a given week, it is initiated during the 30-minute maintenance window that you identify. Most maintenance events also complete during the 30-minute maintenance window, although larger maintenance events might take more than 30 minutes to complete.

    The 30-minute maintenance window is selected at random from an 8-hour block of time per Region. If you don’t specify a preferred maintenance window when you create the instance or cluster, Amazon DocumentDB assigns a 30-minute maintenance window on a randomly selected day of the week.

    The following table lists the time blocks for each Region from which default maintenance windows are assigned.

    Changing a Maintenance Window

    The maintenance window should fall at the time of lowest usage and thus might need changing from time to time. Your cluster or instance is unavailable during this time only if system changes (such as a scale storage operation or an instance class change) are being applied and require an outage. And then it is unavailable only for the minimum amount of time required to make the necessary changes.

    For upgrades to the database engine, Amazon DocumentDB uses the cluster’s preferred maintenance window and not the maintenance window for individual instances.

    To change the maintenance window

    • For a cluster, see .