ApsaraDB for MongoDB sharded cluster instances are designed for high-concurrency read and write workloads. This topic walks you through creating one from the ApsaraDB for MongoDB console.
Prerequisites
Before you begin, make sure you have:
An Alibaba Cloud account. See Sign up for an Alibaba Cloud account.
A Virtual Private Cloud (VPC) and vSwitch in the region where you plan to deploy the instance. See Create and manage a VPC and Create and manage vSwitches.
Reviewed the billing details for your chosen billing method. See Billing items and pricing.
(If your application runs on ECS) An Elastic Compute Service (ECS) instance in the same region and VPC as your planned MongoDB instance.
Deploy the MongoDB instance in the same zone as your ECS instance to minimize network latency. If your ECS instance uses classic network, migrate it to VPC first. See Migrate ECS instances from the classic network to a VPC.
Supported regions and zones
For a full list of regions and zones that support sharded cluster instances, see Sharded cluster instances.
Billing
ApsaraDB for MongoDB sharded cluster instances support two billing methods:
Subscription: Pay an upfront fee for a fixed duration.
Pay-as-you-go: Billed per hour based on your configuration. Fees are deducted automatically from your account.
For pricing details, see Billing items and pricing.
Create a sharded cluster instance
Log on to the ApsaraDB for MongoDB console.
In the left-side navigation pane, click Sharded Cluster Instances.
On the Sharded Cluster Instances page, click Create Instance.
Set Product Type to Sharded Cluster (Subscription) or Sharded Cluster (Pay-as-you-go).
Configure the required parameters. The following table describes the key parameters. Parameters not listed here have sensible defaults — you can accept the defaults or adjust them based on your requirements.
Required parameters
Parameter Description Region The region where the instance is deployed. Deploy the instance in the same region as your ECS instance to enable communication over the internal network. Cannot be changed after creation. Zone type Deployment zone type. Single-zone: all nodes (mongos, shard, and ConfigServer) are deployed in one zone. Multi-zone: nodes are spread across three zones for higher availability. Local disk instances support only Single-zone; however, you can configure the Zone parameter to deploy the instance across zones. To deploy across zones, select a region that includes a zone combination in the format: Region Zones (1 + 2 + 3). Example: Shenzhen Zones (C + D + E). Zone The zone for the instance. For Multi-zone deployments, also set Secondary zone 1 and Secondary zone 2 — all three zones must be different. Deploy the instance in the same zone as your ECS instance to reduce latency. See Cloud disk-based instances (multi-zone deployment) and Create a multi-zone sharded cluster instance. Engine version The MongoDB version. For Multi-zone deployments, only MongoDB 7.0, 6.0, 5.0, or 4.4 are supported. You can upgrade the version after the instance is created. See Upgrade the major version of an instance. Storage type The disk type for the instance. Options: ESSD PL1 (baseline), ESSD PL2 (~2x the IOPS and throughput of PL1), ESSD PL3 (up to 20x IOPS and 11x throughput of PL1, for high-I/O low-latency workloads), ESSD AutoPL (PL1 baseline with configurable provisioned performance), or Local SSD (co-located with the database engine for lower I/O latency). For IOPS and throughput comparisons, see ESSDs. Network type Set to VPC. The ECS instance must also use VPC. VPC The VPC for the instance. vSwitch The vSwitch for the instance. Mongos specification The spec for each mongos node. See Sharded cluster instance specifications. Mongos quantity The number of mongos nodes. Valid values: 2–32. By default, mongos nodes use the standalone architecture. Set at least 2 nodes to ensure high availability. Shard specifications The spec for each shard node. See Sharded cluster instance specifications. Shard storage The storage capacity per shard node (not the total for all nodes). This space stores data, system, and log files. See Sharded cluster instance specifications. Shard quantity The number of shard nodes. Valid values: 2–32. Each shard uses a three-node replica set by default. Set at least 2 shards to distribute data effectively. See Configure sharding to maximize the performance of shards. Username Fixed as root. See What permissions are granted to the root account when an instance is created? Set password Choose Set now to configure the root password immediately, or Set later to do it after creation. See (Optional) Reset a password. Optional parameters
Parameter Description Protocol type Fixed as MongoDB. Storage engine Fixed as WiredTiger. Encryption type Enable disk encryption (ESSD instances only). See Disk encryption. Service-linked role Required for disk encryption. A Resource Access Management (RAM) role that only the linked Alibaba Cloud service can assume. Click Create service-linked role if one does not already exist. Encryption key The customer master key (CMK) for disk encryption, managed in Key Management Service (KMS). See Create a CMK. Shard read-only nodes The number of read-only nodes per shard. Valid values: 0–5. See Read-only nodes. ConfigServer specification The spec for the ConfigServer component. See Sharded cluster instance specifications. ConfigServer storage The storage capacity for the ConfigServer component. Password The root account password (required if Set password is set to Set now). Must be 8–32 characters and include at least three of the following: uppercase letters, lowercase letters, digits, and special characters ( ! @ # $ % ^ & * ( ) _ + - =).Duration Subscription instances only. Valid values: 1–9 months, or 1, 2, 3, or 5 years. Select Auto-renewal to renew automatically; make sure your Alibaba Cloud account has sufficient balance before the renewal date. Complete the purchase based on your billing method.
For subscription instances, you can also click Add to cart and pay for multiple orders in a single checkout. See Pay for orders in the cart.
Billing method Steps Subscription Click Buy now → review the order on the Confirm order page → accept the Terms of Service → click Pay and complete payment. Pay-as-you-go Click Buy now → review the order on the Confirm order page → accept the Terms of Service → click Activate now. Fees are collected within the next hour.
Verify the instance
After you complete the purchase:
Click Console to return to the ApsaraDB for MongoDB console.
In the upper-left corner, select the resource group and region of the instance.
In the left-side navigation pane, click Sharded Cluster Instances.
Confirm the instance appears in the list with a status of Running.
If the instance is not displayed, wait 10–15 minutes and refresh the page. If it still does not appear, check the following:
| Possible cause | Solution |
|---|---|
| Wrong region or resource group selected | Select the correct region and resource group in the upper-left corner of the console. |
| Viewing the wrong instance type | Click Sharded Cluster Instances in the left navigation pane. |
| Instance creation failed due to insufficient resources | Your payment is refunded automatically. Try creating the instance in a different zone. |
Pay for orders in the cart
For subscription instances, you can batch multiple orders and pay for them in one checkout.
After configuring instance parameters, click Add to cart.
In the lower-right corner, click the Cart icon.
In the Cart panel, select the orders to pay for and click Proceed to checkout.
On the Cart page, confirm the selected orders. Adjust Duration and Quantity if needed.
Click Buy now.
On the Confirm order page, read the MongoDB Sharded Cluster (Subscription) Service Agreement, select I have read and agreed to the terms, and click Confirm purchase.
Complete the payment.
What's next
After the instance is created:
(Optional) If you skipped setting a password during creation, set it now. See (Optional) Reset a password.
Configure an IP whitelist to allow access to the instance. See Configure a whitelist for an instance.
(Optional) To connect over the Internet, apply for a public endpoint. See Apply for a public endpoint for an ApsaraDB for MongoDB standalone instance.
API reference
| Operation | Description |
|---|---|
| CreateShardingDBInstance | Creates or clones an ApsaraDB for MongoDB sharded cluster instance. |
| DescribeInstanceAutoRenewalAttribute | Queries whether auto-renewal is enabled for an instance. |
| DescribeDBInstanceAttribute | Queries detailed information about an instance. |