Create a replica set instance
ApsaraDB for MongoDB replica set instances are suited for read-heavy workloads — where reads outnumber writes or traffic spikes during promotional events. Typical use cases include online reading platforms and order query systems.
Prerequisites
Before you begin, make sure you have:
An Alibaba Cloud account. For more information, seeStep 1: Create an Alibaba Cloud account
A virtual private cloud (VPC) in the target region. If you do not have one, see Create and manage a VPC
A vSwitch in the VPC. If you do not have one, see Create and manage a vSwitch
If your application runs on an Elastic Compute Service (ECS) instance, deploy the replica set instance in the same region and VPC as the ECS instance. If the network type is VPC, you must ensure that they use the same VPC ID. The same zone is recommended to minimize network latency. If the ECS instance uses the classic network, migrate it to a VPC first. For more information, see What is VPC.
Free trial
First-time enterprise users can apply for a free trial on the All Free Tier Products Available page.
Billing
ApsaraDB for MongoDB replica set instances support two billing methods:
Subscription: Pay upfront for the instance. For more information, see Billing items.
Pay-as-you-go: Billed per hour based on instance configuration. Fees are automatically deducted from your account.
For supported regions and zones, see Available regions and zones.
Create a replica set instance
Log on to the ApsaraDB for MongoDB console.
In the left navigation pane, click Replica Set Instances.
On the Replica Set Instances page, click Create Instance.
In the Product Type section, select Replica Set (Subscription) or Replica Set (Pay-as-you-go).
Configure the deployment settings.
Single-zone is only available for instances running MongoDB 4.2 or earlier with local disks. To configure multi-zone deployment using the Zone parameter, use the format: Region (Zone 1 + Zone 2 + Zone 3). Example: Shenzhen Zones (C + D + E).
Parameter
Description
Region
The region where the instance is deployed. Cannot be changed after creation. Deploy in the same region as your ECS instance for internal network access.
Zone type
The zone deployment type: Single-zone, Double-zoneyou can select only MongoDB 7.0, MongoDB 6.0, MongoDB 5.0, MongoDB 4.4, or MongoDB 4.2., or Multi-zone. Double-zone and multi-zone deployments provide zone-level disaster recovery. See Create a multi-zone replica set instance.
Zone
The zone where the instance is deployed. For dual-zone or multi-zone types, also configure Secondary Zone. For supported zones, see Cloud disk-based (Dual-zone) and Cloud disk-based (Three-zone).
Configure the network settings.
Parameter
Description
Network type
Set to VPC only.
VPC
The VPC where the instance is deployed.
vSwitch
The vSwitch in the VPC.
Configure the database settings.
Parameter
Description
Database version
Select the MongoDB version that meets your requirements. For multi-zone deployments, only MongoDB 7.0, 6.0, 5.0, or 4.4 is available.
NoteIf the value of the Zone, Secondary Zone 1, or Secondary Zone 2 parameter that you select does not support multi-zone deployment, the Engine Version parameter is not displayed and the replica set instance cannot be created. You can upgrade the major version after the instance is created.
Active-standby nodes
The number of active-standby nodes. Set as needed.
Read-only nodes
The number of read-only nodes. Set as needed. For details, see Read-only nodes.
Configure the storage settings.
Parameter
Description
Storage type
Select a disk type based on your I/O requirements. See the storage type details below.
Provisioned performance
ESSD AutoPL disks only. Valid values: 0–50000.
Storage
The storage size per node (not the total across all nodes). Determines how many data, system, and log files can be stored.
Storage type options:
Storage type
Description
PL1 Enhanced SSD (ESSD)
Baseline ESSD performance.
PL2 ESSD
Approximately 2× the IOPS and throughput of PL1.
PL3 ESSD
Up to 20× the IOPS and 11× the throughput of PL1. Suitable for high-concurrency, low-latency workloads. For a full comparison, see ESSDs.
ESSD AutoPL Disk
Same baseline performance as PL1 ESSD with configurable provisioned performance.
Local SSD
Resides on the same host as the database engine for lowest I/O latency.
Configure the security settings.
Parameter
Description
Encryption type
Whether to enable disk encryption. For details, see Disk encryption.
Encryption key
The KMS key for disk encryption. If no key exists in the region, create one in the KMS console. See Create a CMK.
Service-linked role
Required for disk encryption. Click Create Service-linked Role if not already created.
Username
Fixed as root. For root account permissions, see What permissions are the root account granted when an instance is created?
Set password
Set Now or Set Later. If you choose Set Later, see (Optional) Reset a password.
Password
Required if Set Now is selected. The password must be 8–32 characters and contain at least three of the following: uppercase letters, lowercase letters, digits, and special characters (
!@#$%^&*()_+-=).Configure the instance management settings.
Parameter
Description
Category
The instance category.
Specifications
The CPU and memory configuration. For supported specifications, see Instance types.
Resource group
The resource group for managing the instance. Select an existing group or create a new one. See Create a resource group.
Tag
Tags to apply to the instance. See Create a tag.
Duration
Subscription instances only. Valid values: 1–9 months, or 1, 2, 3, or 5 years. Enable Auto-renewal to renew automatically before expiration.
Quantity
The number of instances to create (1–10). All instances are created with the same specifications.
Complete the purchase.
Billing method
Steps
Subscription
Click Buy Now → review the order on Confirm Order → accept the Terms of Service → click Pay to complete payment. You can also click Add To Cart and pay with other cart items in bulk.
Pay-as-you-go
Click Buy Now → review the order on Confirm Order → accept the Terms of Service → click Activate Now. Fees are collected within the next hour.
Verify the instance
After payment, click Console to return to the ApsaraDB for MongoDB console. Then:
In the upper-left corner, select the resource group and region of the instance.
In the left navigation pane, click Replica Set Instances.
Confirm that the new instance appears in the list with the status Running.
If the instance does not appear, wait 10–15 minutes and refresh the page. If it still does not appear, check the following:
Possible cause | Solution |
The selected region does not match the instance's region. | Select the correct resource group and region in the upper-left corner of the console. |
The selected instance architecture does not match. | In the left navigation pane, click Replica Set Instances. |
The instance was not created due to insufficient resources. | The system refunds your payment automatically. Create the instance in a different zone. |
If none of the above applies, contact Alibaba Cloud technical support.
Pay for orders in the cart
If you clicked Add To Cart instead of Buy Now, complete payment as follows:
In the lower-right corner of the page, click the Cart icon.
In the Cart panel, select the products to purchase and click Proceed To Checkout.
On the Cart page, confirm the selected orders. You can also adjust the Duration and Quantity at this step.
Click Buy Now.
On the Confirm Order page, accept the Terms of Service and click Confirm Purchase.
On the Purchase page, complete the payment.
What's next
Configure an IP address whitelist to allow connections to the instance. See Configure a whitelist for an instance.
(Optional) If you chose Set Later for the password, set it now. See (Optional) Reset a password.
(Optional) To connect over the Internet, apply for a public endpoint. See (Optional) Apply for a public endpoint for an instance.
API reference
API | Description |
Creates or clones a standalone or replica set instance. | |
Queries whether auto-renewal is enabled for an instance. | |
Queries detailed information about an instance. |