Amazon DocumentDB
Developer Guide

Modifying an Amazon DocumentDB Cluster

You can modify your Amazon DocumentDB cluster that is in the available state using either the AWS Management Console or the AWS CLI.

Using the AWS Management Console

Use the following procedure to modify a specific Amazon DocumentDB cluster using the console.

To modify an Amazon DocumentDB 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. Specify the cluster that you want to modify by choosing the button to the left of the cluster's name.

  4. Choose Actions, and then choose Modify.

  5. In the Modify Cluster: cluster-name pane, make the changes that you want. You can make changes in the following areas:

    • Cluster specifications—The cluster's name, security group, and password.

    • Cluster options—The cluster's port and parameter group.

    • Backup—The cluster's backup retention period and backup window.

    • Log exports—Enable or disable exporting audit logs.

    • Maintenance—Set the cluster's maintenance window.

    • Deletion protection—Enable or disable deletion protection on the cluster.

  6. When you're finished, choose Modify cluster.

It takes a few minutes for your changes to be applied. You can use the cluster only when its status is available. You can monitor the cluster's status using the console or AWS CLI. For more information, see Monitoring an Amazon DocumentDB Cluster's Status.

Using the AWS CLI

Use modify-db-cluster to modify the specified cluster using the AWS CLI.

Parameters

  • --db-cluster-identifier—Required. The identifier of the Amazon DocumentDB cluster that you are going to modify.

  • --backup-retention-period—Optional. The number of days for which automated backups are retained. Valid values are 1–35.

  • --db-cluster-parameter-group-name—Optional. The name of the cluster parameter group to use for the cluster.

  • --master-user-password—Optional. The new password for the master database user.

    Master Password Constraints:
    • Length is [8-100] printable ASCII characters.

    • Can use any printable ASCII characters except for the following:

      • / (forward slash)

      • " (double quotation mark)

      • @ (at symbol)

  • --new-db-cluster-identifier—Optional. The new cluster identifier for the cluster when renaming a cluster. This value is stored as a lowercase string.

    Cluster Naming Constraints:
    • Length is [1–63] letters, numbers, or hyphens.

    • First character must be a letter.

    • Cannot end with a hyphen or contain two consecutive hyphens.

    • Must be unique for all clusters (across Amazon RDS, Amazon Neptune, and Amazon DocumentDB) per AWS account, per Region.

  • --preferred-backup-window—Optional. The daily time range during which automated backups are created, in Universal Coordinated Time (UTC).

    Format: hh24:mm-hh24:mm

  • --preferred-maintenance-window—Optional. The weekly time range during which system maintenance can occur, in UTC.

    Format: ddd:hh24:mm-ddd:hh24:mm

    Valid days: Sun, Mon, Tue, Wed, Thu, Fri, and Sat.

  • --deletion-protection or --no-deletion-protection—Optional. Whether deletion protection should be enabled on this cluster. Deletion protection prevents a cluster from being deleted accidentally until the cluster is modified to disable deletion protection. For more information, see Deleting an Amazon DocumentDB Cluster.

  • --apply-immediately or --no-apply-immediately—Use --apply-immediately to make the change immediately. Use --no-apply-immediately to make the change during your cluster's next maintenance window.

For more information, see ModifyDBCluster in the Amazon DocumentDB API Reference.

The following code changes the backup retention period for the cluster sample-cluster.

For Linux, macOS, or Unix:

aws docdb modify-db-cluster \ --db-cluster-identifier sample-cluster \ --apply-immediately \ --backup-retention-period 7

For Windows:

aws docdb modify-db-cluster ^ --db-cluster-identifier sample-cluster ^ --apply-immediately ^ --backup-retention-period 7

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

{ "DBCluster": { "BackupRetentionPeriod": 7, "DbClusterResourceId": "cluster-VDP53QEWST7YHM36TTXOPJT5YE", "Status": "available", "DBClusterMembers": [ { "PromotionTier": 1, "DBClusterParameterGroupStatus": "in-sync", "DBInstanceIdentifier": "sample-cluster-instance", "IsClusterWriter": true } ], "ReadReplicaIdentifiers": [], "AvailabilityZones": [ "us-east-1b", "us-east-1c", "us-east-1a" ], "ReaderEndpoint": "sample-cluster.cluster-ro-ctevjxdlur57.us-east-1.rds.amazonaws.com", "DBClusterArn": "arn:aws:rds:us-east-1:123456789012:cluster:sample-cluster", "PreferredMaintenanceWindow": "sat:09:51-sat:10:21", "EarliestRestorableTime": "2018-06-17T00:06:19.374Z", "StorageEncrypted": false, "MultiAZ": false, "AssociatedRoles": [], "MasterUsername": "<your-master-user-name>", "DBClusterIdentifier": "sample-cluster", "VpcSecurityGroups": [ { "Status": "active", "VpcSecurityGroupId": "sg-77186e0d" } ], "HostedZoneId": "Z2SUY0A1719RZT", "LatestRestorableTime": "2018-06-18T21:17:05.737Z", "AllocatedStorage": 1, "Port": 27017, "Engine": "docdb", "DBClusterParameterGroup": "default.docdb3.4", "Endpoint": "sample-cluster.cluster-ctevjxdlur57.us-east-1.rds.amazonaws.com", "DBSubnetGroup": "default", "PreferredBackupWindow": "00:00-00:30", "EngineVersion": "3.4", "ClusterCreateTime": "2018-06-06T19:25:47.991Z", "IAMDatabaseAuthenticationEnabled": false } }

It takes a few minutes for your changes to be applied. You can use the cluster only when its status is available. You can monitor the cluster's status using the console or AWS CLI. For more information, see Monitoring an Amazon DocumentDB Cluster's Status.