All Products
Search
Document Center

ApsaraDB for MongoDB:Create an instance

Last Updated:Dec 03, 2025

Before you can use ApsaraDB for MongoDB, you must create an instance. This topic describes how to quickly create one.

Prerequisites

You have created an Alibaba Cloud account. For more information, see Step 1: Create an Alibaba Cloud account.

Billing

When you create a MongoDB instance, you are charged for its specifications and storage capacity. For more information, see Billable items.

Free trial

Alibaba Cloud offers free trials for ApsaraDB for MongoDB replica set instances. If you are an enterprise user who uses ApsaraDB for MongoDB for the first time, you can go to the All Free Tier Products Available page to apply for a trial. If you are not a first-time user of ApsaraDB for MongoDB, follow the steps described in this topic to create a replica set instance in the ApsaraDB for MongoDB console.

Procedure

Replica set instance

This tutorial provides an example of how to create a pay-as-you-go replica set instance that runs MongoDB 8.0. For more information about how to create a replica set instance, see Create a replica set instance.

  1. Go to the ApsaraDB for MongoDB buy page.

  2. On the ApsaraDB for MongoDB buy page, configure the following parameters.

    Parameter

    Description

    Example

    Product Type

    Select a product type as needed.

    Replica Set (Pay-As-You-Go)

    Region

    Select the region where the instance resides.

    China (Hangzhou)

    Zone Type

    Select the zone type of the instance.

    Single Zone

    Zone

    Select the zone where the instance resides.

    Hangzhou Zone J

    Database Version

    Select a database version as needed.

    MongoDB 8.0

    Number of Nodes

    Select the number of nodes for the replica set instance as needed.

    Three nodes

    Number of Read-only Nodes

    Select the number of read-only nodes for the replica set instance as needed.

    No read-only nodes

    Storage Engine

    This parameter is fixed to WiredTiger.

    WiredTiger

    Storage Type

    Select the storage type for the replica set instance as needed.

    PL1 ESSD

    Encryption Type

    Select whether to enable disk encryption.

    No Encryption

    Resource Group

    Select a resource group to manage the instance.

    Default Resource Group

    Tag

    Add tags to the instance.

    None

    Network Type

    This parameter is fixed to VPC.

    VPC

    VPC

    Select the VPC in which you want to deploy the instance. If you want to access the instance from an ECS instance, we recommend that you select the same VPC as the ECS instance. This way, you can connect to the MongoDB instance over a private network.

    You can use the Default VPC. If the Default VPC option is not available, select an existing VPC or go to the VPC console to create a VPC.

    Default VPC

    vSwitch

    Select the vSwitch to which the instance belongs.

    You can use the Default Switch. If the Default Switch option is not available, select an existing vSwitch or go to the VPC console to create a vSwitch.

    Default Switch

    Specification Category

    Select the instance family of the instance.

    Dedicated

    Specifications

    Select the instance type of the instance.

    2 vCPU, 4 GB (Dedicated)

    Storage Capacity

    Select the storage capacity of the instance.

    20 GB

    Username

    This parameter is fixed to root.

    root

    Password Settings

    Select Set Now.

    If you select Set Later, you must reset the password before you connect to the instance.

    Set Now

    Password

    Enter the password for the root account and confirm the password.

    This password is for demonstration purposes only. Do not use it in your production environment.

    PassWord123!

    Instance Name

    Enter a custom name for the instance.

    test-instance

    Quantity

    Select the number of instances that you want to create with the same configuration.

    1

  3. Click Buy Now.

  4. Review the Parameter Configuration and click Activate Now.

  5. On the Purchase page, click Console to go to the Instances page. You can view the new instance in the instance list.

    It takes about 10 to 15 minutes to create the instance. If the instance does not appear in the list, refresh the page later.

Sharded cluster instance

This tutorial provides an example of how to create a pay-as-you-go sharded cluster instance that runs MongoDB 8.0. For more information about how to create a sharded cluster instance, see Create a sharded cluster instance.

  1. Go to the ApsaraDB for MongoDB buy page.

  2. On the ApsaraDB for MongoDB buy page, configure the following parameters.

    Parameter

    Description

    Example

    Product Type

    Select a product type as needed.

    Sharded Cluster (Pay-As-You-Go)

    Region

    Select the region where the instance resides.

    China (Hangzhou)

    Zone Type

    Select the zone type of the instance.

    Single Zone

    Zone

    Select the zone where the instance resides.

    Hangzhou Zone J

    Protocol Type

    This parameter is fixed to MongoDB.

    MongoDB

    Database Version

    Select a database version as needed.

    MongoDB 8.0

    Storage Engine

    This parameter is fixed to WiredTiger.

    WiredTiger

    Storage Type

    Select the storage type for the replica set instance as needed.

    PL1 ESSD

    Encryption Type

    Select whether to enable disk encryption.

    No Encryption

    Specification Category

    Select the instance family of the instance.

    Dedicated

    Resource Group

    Select a resource group to manage the instance.

    Default Resource Group

    Tag

    Add tags to the instance.

    None

    Network Type

    This parameter is fixed to VPC.

    VPC

    VPC

    Select the VPC in which you want to deploy the instance. If you want to access the instance from an ECS instance, we recommend that you select the same VPC as the ECS instance. This way, you can connect to the MongoDB instance over a private network.

    You can use the Default VPC. If no default VPC exists, you can go to the VPC console to create one.

    Default VPC

    vSwitch

    Select the vSwitch to which the instance belongs.

    You can use the Default Switch. If no default vSwitch exists, you can go to the VPC console to create one.

    Default Switch

    Mongos Instance Type

    Select the instance type of the Mongos nodes.

    2 vCPU, 8 GB (Dedicated)

    Number of Mongos Nodes

    Select the number of Mongos nodes.

    2

    Shard Instance Type

    Select the instance type of the shard nodes.

    2 vCPU, 8 GB (Dedicated)

    Shard Storage Capacity

    Select the storage capacity of the shard nodes.

    20 GB

    Number of Read-only Nodes per Shard

    Select the number of read-only nodes for each shard.

    No read-only nodes

    Number of Shards

    Select the number of shards.

    2

    ConfigServer Instance Type

    Select the instance type of the Configserver nodes.

    4 vCPU, 8 GB (Dedicated)

    ConfigServer Storage Capacity

    Select the storage capacity of the Configserver nodes.

    20 GB

    Username

    This parameter is fixed to root.

    root

    Password Settings

    Select Set Now.

    If you select Set Later, you must reset the password before you connect to the instance.

    Set Now

    Password

    Enter the password for the root account and confirm the password.

    This password is for demonstration purposes only. Do not use it in your production environment.

    PassWord123!

    Instance Name

    Enter a custom name for the instance.

    test-instance

  3. Click Buy Now.

  4. Review the Parameter Configuration and click Activate Now.

  5. On the Purchase page, click Console to go to the Instances page. You can view the new instance in the instance list.

    It takes about 10 to 15 minutes to create the instance. If the instance does not appear in the list, refresh the page later.

Standalone instance

This tutorial provides an example of how to create a pay-as-you-go standalone instance that runs MongoDB 4.0. For more information about how to create a standalone instance, see Create a standalone instance.

  1. Go to the ApsaraDB for MongoDB buy page.

  2. On the ApsaraDB for MongoDB buy page, configure the following parameters.

    Parameter

    Description

    Example

    Product Type

    Select a product type as needed.

    Replica Set (Pay-As-You-Go)

    Region

    Select the region where the instance resides.

    China (Hangzhou)

    Zone Type

    Select the zone type of the instance.

    Single Zone

    Zone

    Select the zone where the instance resides.

    Hangzhou Zone G

    Database Version

    Select MongoDB 4.0.

    MongoDB 4.0

    Number of Nodes

    Select the number of nodes for the replica set instance as needed.

    Single node

    Number of Read-only Nodes

    This parameter is fixed to No Read-only Nodes.

    No read-only nodes

    Storage Engine

    This parameter is fixed to WiredTiger.

    WiredTiger

    Storage Type

    This parameter is fixed to PL1 ESSD.

    PL1 ESSD

    Resource Group

    Select a resource group to manage the instance.

    Default Resource Group

    Tag

    Attach tags to the instance.

    None

    Network Type

    This parameter is fixed to VPC.

    VPC

    VPC

    Select the VPC in which you want to deploy the instance. If you want to access the instance from an ECS instance, we recommend that you select the same VPC as the ECS instance. This way, you can connect to the MongoDB instance over a private network.

    You can use the Default VPC. If no default VPC exists, you can go to the VPC console to create one.

    Default VPC

    vSwitch

    Select the vSwitch to which the instance belongs.

    You can use the Default Switch. If no default vSwitch exists, you can go to the VPC console to create one.

    Default Switch

    Category

    This parameter is fixed to General-purpose.

    General-purpose

    Specifications

    Select the instance type of the instance.

    1 vCPU, 2 GB (General-purpose)

    Storage Capacity

    Select the storage capacity of the instance.

    20 GB

    Username

    This parameter is fixed to root.

    root

    Password Settings

    Select Set Now.

    If you select Set Later, you must reset the password before you connect to the instance.

    Set Now

    Password

    Enter the password for the root account and confirm the password.

    This password is for demonstration purposes only. Do not use it in your production environment.

    PassWord123!

    Instance Name

    Enter a custom name for the instance.

    test-instance

    Quantity

    Select the number of instances that you want to create with the same configuration.

    1

  3. Click Buy Now.

  4. Review the Parameter Configuration and click Activate Now.

  5. On the Purchase page, click Console to go to the Instances page. You can view the new instance in the instance list.

    It takes about 10 to 15 minutes to create the instance. If the instance does not appear in the list, refresh the page later.

Next step

Configure a whitelist