Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Creating a cluster that uses Amazon DocumentDB serverless
Creating an Amazon DocumentDB serverless cluster
With Amazon DocumentDB serverless, your clusters are interchangeable with provisioned clusters.
You can have clusters where some instances use serverless and some instances are provisioned.
Verify that your desired region and engine version support DocumentDB serverless.
See Requirements and limitations for DocumentDB serverless.
To create an Amazon DocumentDB cluster where you can add serverless instances, follow the same procedure as in Creating an Amazon DocumentDB cluster.
The only difference is that the ServerlessV2ScalingConfiguration
argument must also be provided.
The ServerlessV2ScalingConfiguration
argument specifies the scaling capacity range of your DocumentDB serverless instances.
It consists of the minimum and maximum DocumentDB capacity unit (DCU) values that apply to all the DocumentDB serverless instances in the cluster:
For more information on scaling, see Amazon DocumentDB serverless scaling configuration.
- Using the Amazon Web Services Management Console
-
The following Amazon Web Services Management Console configuration example shows how to create a DocumentDB serverless cluster.
-
Sign into the Amazon Web Services Management Console and open the Amazon DocumentDB console.
-
In the navigation pane, choose Clusters.
If you don't see the navigation pane on the left side of your screen, choose the menu icon
(
)
in the upper-left corner of the page.
The Clusters table appears.
-
Choose Create.
The Create Amazon DocumentDB cluster page appears.
-
On the Create Amazon DocumentDB cluster page, in the Cluster type section, choose
Instance-based cluster (this is the default option).
-
In the Cluster configuration section:
For Cluster identifier, enter a unique name, such as myserverlesscluster
.
Note that the console will change all cluster names into lower-case regardless of how they are entered.
For Engine version, choose 5.0.0 (this is the default option).
-
In the Cluster storage configuration section, choose Amazon DocumentDB Standard (this is the default option).
-
In the Instance configuration section:
For DB instance class, choose Serverless.
For Number of regular replica instances, choose 3 (this is the default option).
In the Capacity range section, leave the default values for Minimum DCUs and Maximum DCUs.
For information on setting these parameters, see Amazon DocumentDB serverless instance limits.
-
In the Connectivity section, leave the default setting of Don't connect to an EC2 compute resource.
-
In the Authentication section, enter a username for the primary user, and then choose Self managed.
Enter a password, then confirm it.
If you instead chose Managed in Amazon Secrets Manager, see Password management with Amazon DocumentDB and Amazon Secrets Manager for more information.
-
Leave all other options as default and choose Create cluster.
- Using the Amazon CLI
-
In the following example, replace each user input placeholder
with your own information or configuration parameters.
To create a cluster compatible with DocumentDB serverless instances using the Amazon CLI, see Creating a cluster using the Amazon CLI.
Include the following additional parameters in your create-db-cluster
command:
--serverless-v2-scaling-configuration
MinCapacity=minimum_capacity
,MaxCapacity=maximum_capacity
Example:
aws docdb create-db-cluster \
--db-cluster-identifier sample-cluster
\
--engine docdb \
--engine-version 5.0.0 \
--serverless-v2-scaling-configuration MinCapacity=0.5
,MaxCapacity=16
\
--master-username user-name
\
--master-user-password password
Adding an Amazon DocumentDB serverless instance
To add an DocumentDB serverless instance, follow the same procedure in Adding an Amazon DocumentDB instance to a cluster, making sure to specify db.serverless as the instance class.
Adding a serverless instance using the Amazon Web Services Management Console.
To add an DocumentDB serverless instances using the console, see Adding an Amazon DocumentDB instance to a cluster and choose the Using the Amazon Web Services Management Console tab.
Adding a serverless instance using the Amazon CLI
To add an DocumentDB serverless instances using the Amazon CLI, see Adding an Amazon DocumentDB instance to a cluster and choose the Using the Amazon CLI tab.
Use the following instance class CLI argument:
--db-instance-class db.serverless
Example:
aws docdb create-db-instance \
--db-cluster-identifier sample-cluster
\
--db-instance-identifier sample-instance
\
--db-instance-class db.serverless \
--engine docdb