All Products
Search
Document Center

ApsaraDB for MongoDB:Create a replica set instance

Last Updated:Aug 21, 2026

ApsaraDB for MongoDB provides replica set instances that are ideal for read-heavy workloads or scenarios with temporary traffic spikes, such as e-commerce promotions, content websites, and order query systems.

Prerequisites

An Alibaba Cloud account is created. For more information, see Create an Alibaba Cloud account.

Free trial

Alibaba Cloud offers a free trial for replica set instances. If you are an enterprise-verified user and new to ApsaraDB for MongoDB, you can visit Alibaba Cloud Free Trial to apply. If you are not eligible for the free trial, follow the steps in this topic to create an instance in the console to get started.

Notes

If your application is deployed on an ECS instance, ensure that both instances meet the following conditions for network connectivity. To view information about your ECS instance, see View instance information.

  • They are in the same region.

  • They use the same network type.

    Note
    • To reduce network latency, place the instances in the same availability zone.

    • A VPC is recommended for its higher security.

    • If you use a VPC, both instances must be in the same VPC.

    • If you want to use a VPC but your ECS instance is in the classic network, you can migrate the ECS instance to a VPC. For more information, see Migrate an ECS instance from the classic network to a VPC.

Supported regions and availability zones

For supported regions and availability zones, see Supported regions and availability zones.

Billing rules

An Alibaba Cloud account is created. For more information, see Sign up with Alibaba Cloud.

  • Subscription: A prepaid billing method where you pay for the instance upon creation.

  • Pay-as-you-go: a postpaid billing method where you are billed hourly based on the instance configuration. Fees are automatically deducted from your account balance.

Note

For more information, see Billable items.

Procedure

  1. Log on to the ApsaraDB for MongoDB console.

  2. In the left-side navigation pane, click Replica Set Instances.

  3. On the Replica Set Instances page, click Create Instance.

  4. In the Product Type section, select Replica Set (Subscription) or Replica Set (Pay-as-you-go).

  5. Configure the following parameters for the instance.

    Parameter

    Description

    Region

    Select the region where you want to create the instance.

    Note
    • You cannot change the region after the instance is created. Choose the region carefully.

    • If your application is deployed on an ECS instance, select the same region as the ECS instance to allow communication over the internal network.

    Zone Type

    Select a zone type for the instance.

    • Single-zone: The primary, secondary, and hidden nodes are in the same availability zone.

    • Dual-zone Deployment: Nodes are distributed across two availability zones for intra-city disaster recovery.

    • Multi-zone: Nodes are distributed across three availability zones for intra-city disaster recovery.

    Note
    • For local SSD-based instances of ApsaraDB for MongoDB 4.2 or earlier, only Single-zone is supported. However, you can achieve a multi-availability zone deployment by configuring the Zone parameter. To do this, select a zone in the format of Region (Zone1+Zone2+Zone3), such as Shenzhen (C+D+E).

    • For more information about dual-zone and multi-zone deployments, see Create a multi-availability zone replica set instance.

    Zone

    Select the availability zone where you want to create the instance.

    If you set Single-zone to Dual-zone Deployment or Multi-zone, you must also configure a Spare zone. For more information about supported availability zones, see Cloud disk-based (dual-zone) and Cloud disk-based (multi-zone).

    Note

    If your application is deployed on an ECS instance, we recommend that you select the same availability zone as the ECS instance to reduce network latency. For local SSD-based instances of ApsaraDB for MongoDB 4.2 or earlier, you can migrate the instance to a different availability zone. For more information, see Migrate an instance across availability zones.

    Network type

    The value is fixed to VPC.

    Note

    If your application is deployed on an ECS instance, make sure that the network type of the ECS instance is VPC to ensure network connectivity.

    VPC

    Select the VPC for the instance. If no VPC is available, you can create one in the VPC console. For more information, see Create and manage a VPC.

    vSwitch

    Select the VSwitch for the instance. If no VSwitch is available, you can create one in the VPC console. For more information, see Create and manage a VSwitch.

    Database Version

    Select a database version.

    If you set Zone Type to Multi-zone, only MongoDB 7.0, MongoDB 6.0, MongoDB 5.0, and MongoDB 4.4 are supported.

    Note
    • If any of the selected Zone, Secondary Zone 1, or Secondary Zone 2 does not support multi-availability zone deployment for replica set instances, the Database Version parameter is not displayed, and you cannot create the instance.

    • You can manually upgrade the database version after the instance is running. For more information, see Upgrade the major version of an ApsaraDB for MongoDB instance.

    Active-standby Nodes

    Select the number of nodes in the replica set instance.

    Read-only Nodes

    Select the number of read-only nodes in the replica set instance. For more information about read-only nodes, see Read-only nodes.

    StorageType

    Select a storage type for the instance.

    • ESSD cloud disk: Enhanced SSD (ESSD) cloud disks are available at the following performance levels:

      • ESSD PL1: An ESSD at performance level 1 (PL1).

      • ESSD PL2: Offers approximately 2x the IOPS and throughput of an ESSD PL1 cloud disk.

      • ESSD PL3: Offers up to 20x the IOPS and 11x the throughput of an ESSD PL1 cloud disk. It is ideal for business scenarios that require high I/O concurrency and extremely stable read and write latency.

      Note

      For a performance comparison of different cloud disk types, including Cloud disk capacity range, Max IOPS per disk, and Max throughput per disk, see ESSD cloud disks.

    • ESSD AutoPL Disk: ESSD AutoPL cloud disks are compatible with all features of ESSD cloud disks and provide the same baseline performance as ESSD PL1 cloud disks. ESSD AutoPL cloud disks also support Provisioned IOPS.

    • Local SSD: An SSD that resides on the same node as the database engine. Storing data on a local SSD can reduce I/O latency.

    The supported storage types vary by database version. The options available in the console take precedence.

    Provisioned Performance

    Set the Provisioned IOPS. The value can range from 0 to 50,000.

    Note

    This parameter is available only for instances that use ESSD AutoPL cloud disks.

    Encryption Type

    Specify whether to enable cloud disk encryption.

    Note

    Cloud disk encryption is supported only for instances that use ESSD cloud disks. For more information about cloud disk encryption, see Configure cloud disk encryption.

    Encryption Key

    Select a Key Management Service (KMS) key for cloud disk encryption. If no KMS key is available in the current region, go to the KMS console to create one. For more information, see Create a key.

    Service-linked Role

    To use the cloud disk encryption feature, you must create a service-linked role.

    If you have already created the service-linked role, this is indicated on the purchase page. If not, click Create Service-linked Role to create one.

    Category

    Select a category for the instance type.

    Specifications

    Select the CPU and memory specifications for the instance. For more information about supported instance types for replica sets, see Replica set instance types.

    Capacity

    Select the storage space for the instance.

    Note
    • This is the storage space for each node, not the total storage space for all nodes.

    • The storage space is used to store data files, system files, and log files for the ApsaraDB for MongoDB instance.

    Username

    The value is fixed to root.

    Note

    This is the root account for the admin database. For more information about the permissions of the root account, see What permissions does the root account have?.

    Password Settings

    Set the password for the root account. You can choose one of the following options:

    • Set Now: Set the password immediately.

    • Set Later: Set the password once the instance is running. For instructions, see (Optional) Reset a password.

    Password

    If you choose to set the password now, it must meet the following requirements:

    • It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters.

      !@#$%^&*()_+-= are special characters.

    • The password must be 8 to 32 characters in length.

    Resource group

    Select the resource group for the instance. You can add the instance to an existing resource group or create a new one. For more information about how to create a resource group, see Create a resource group.

    Note

    Resource groups allow you to centrally manage multiple cloud resources across different regions under a single Alibaba Cloud account.

    Tag

    Add tags to the instance. For more information, see Tag management.

    Purchase Duration

    If you create a Subscription instance, select the subscription duration. For a monthly subscription, you can select a duration of 1 to 9 months. For a yearly subscription, you can select 1 Year, 2 Years, 3 Years, or 4 Years.

    Note

    To enable auto-renewal for the instance, select Auto-Renewal and make sure that your account has a sufficient balance before the expiration date.

    Quantity

    Select the number of instances with the same configuration. You can enter an integer from 1 to 10.

  6. Billing method

    Procedure

    Subscription

    1. After configuring the parameters, click Buy Now.

    2. On the Confirm Order page, review the configuration details and read the terms of service.

    3. Click Payment and complete the payment process on the Pay page.

    Note

    You can also click Add to Cart to check out with other products. For more information, see Shopping cart checkout.

    Pay-As-You-Go

    1. After configuring the parameters, click Buy Now.

    2. On the Confirm Order page, review the configuration details and read the terms of service.

    3. Click Activate Now. The system automatically deducts the fees in the next hour.

  7. Verify that the instance was created successfully.

    1. After completing the payment, click Console to go to the ApsaraDB for MongoDB console.

    2. In the upper-left corner of the page, select the resource group and region where the instance is located.

    3. In the navigation pane, choose Replica Set Instances.

    4. Check whether the created instance appears in the instance list.

      • If the instance is in the list and its state is Running, the instance is created successfully.

      • If the instance does not appear, wait 10 to 15 minutes and refresh the page. If it is still missing, see the following table for troubleshooting. Contact Alibaba Cloud Technical Support if the issue persists.

        The following table describes the possible causes and solutions.

        Possible cause

        Solution

        An incorrect region is selected.

        In the upper-left corner of the ApsaraDB for MongoDB console, select the resource group and region where the instance is located.

        An incorrect instance list is selected.

        In the left-side navigation pane of the ApsaraDB for MongoDB console, click Replica Set Instances.

        Insufficient resources

        Your purchase may be refunded due to insufficient resources.

        After confirming the refund, try creating an instance in a different zone.

Shopping cart checkout

If you are purchasing a Subscription instance, you can click Add to Cart after configuring the instance to check out with other products.

  1. Click the Shopping Cart on the right side of the page.

  2. In the Shopping Cart panel, select the products you want to purchase and click Proceed to Checkout.

  3. On the Shopping Cart page, confirm your product selection.

    Note

    You can also change the Purchase Duration and Quantity for the ApsaraDB for MongoDB instance.

    • If the selection is correct, click Buy Now.

    • If not, update your selection and then click Buy Now.

  4. On the Confirm Order page, read the terms of service and click Buy.

  5. On the Pay page, follow the prompts to complete the payment.

Related APIs

API

Description

CreateDBInstance

  • Creates an ApsaraDB for MongoDB standalone or replica set instance.

  • Clones an ApsaraDB for MongoDB standalone or replica set instance.

DescribeInstanceAutoRenewalAttribute

Queries whether auto-renewal is enabled for an ApsaraDB for MongoDB instance.

DescribeDBInstanceAttribute

Queries the details of an ApsaraDB for MongoDB instance.

Next steps

After creating the instance, complete the following steps: