All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::MONGODB::ShardingInstance

Last Updated:Jan 24, 2025

ALIYUN::MONGODB::ShardingInstance is used to create or clone an ApsaraDB for MongoDB sharded cluster instance.

Syntax

{
  "Type": "ALIYUN::MONGODB::ShardingInstance",
  "Properties": {
    "EngineVersion": String,
    "ZoneId": String,
    "AutoRenew": Boolean,
    "VSwitchId": String,
    "Period": Integer,
    "SecurityIPArray": String,
    "Mongos": List,
    "StorageEngine": String,
    "RestoreTime": String,
    "AccountPassword": String,
    "VpcId": String,
    "ProtocolType": String,
    "ChargeType": String,
    "ConfigServer": List,
    "SrcDBInstanceId": String,
    "ReplicaSet": List,
    "Tags": List,
    "TDEStatus": Boolean,
    "DBInstanceDescription": String,
    "ResourceGroupId": String,
    "SecondaryZoneId": String,
    "HiddenZoneId": String,
    "StorageType": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

EngineVersion

String

No

No

The version of the database engine.

Valid values:

  • 3.4

  • 4.0

  • 4.2

Note

When you clone an instance, the value of this property must be the same as the database engine version of the source instance.

ZoneId

String

No

No

The ID of the zone.

None.

AutoRenew

Boolean

No

No

Specifies whether to enable auto-renewal for the instance.

Valid values:

  • true: enables auto-renewal for the instance.

  • false (default): disables auto-renewal for the instance. You must manually renew the instance.

Note

This property takes effect when ChargeType is set to PrePaid.

VSwitchId

String

No

No

The ID of the vSwitch.

None.

Period

Integer

No

No

The subscription duration of the instance.

Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36.

Unit: month.

Note

You must specify this property when ChargeType is set to PrePaid.

SecurityIPArray

String

No

No

The entries in the IP address whitelist of the instance.

Separate multiple IP addresses in the whitelist with commas (,). Each IP address must be unique in the whitelist. The whitelist can contain up to 1,000 IP addresses.

You can specify entries in the whitelist in the following formats:

  • %.

  • 0.0.0.0/0.

  • IP addresses, such as 10.23.XX.XX.

  • CIDR blocks, such as 10.23.XX.XX/24. /24 specifies that the prefix of the CIDR block is 24 bits in length. You can replace 24 with an integer that ranges from 1 to 32.

Note

Values of % and 0.0.0.0/0 specify that the databases on the instance can be accessed from all IP addresses. This may cause security risks. Exercise caution when you use these values.

Mongos

List

Yes

No

The mongos nodes.

You can use 2 to 32 mongos nodes.

For more information, see Mongos property.

StorageEngine

String

No

No

The storage engine that is used by the instance.

Valid values:

  • WiredTiger (default): suitable for most scenarios.

  • RocksDB: suitable for scenarios in which a large number of write operations and a few read operations are performed.

  • TerarkDB: suitable for scenarios in which more read operations are performed than write operations or scenarios in which multiple write operations are performed at a time and a large number of read operations are performed.

Note

When you clone an instance, the value of this property must be the same as the storage engine of the source instance.

RestoreTime

String

No

No

The point in time at which the cloned instance is restored.

Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. You can specify this property only when you clone an instance. You must specify this property together with the SrcDBInstanceId property.

Note

You can set this property to a point in time within the previous seven days.

AccountPassword

String

No

Yes

The password of the root account.

The password must be 8 to 32 characters in length. It must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The following special characters are supported: ! # $ % ^ & * ( ) _ + - =.

VpcId

String

No

No

The ID of the virtual private cloud (VPC).

None.

ProtocolType

String

No

No

The type of the access protocol.

Valid values:

  • mongodb

  • dynamodb

ChargeType

String

No

No

The billing method of the instance.

Valid values:

  • PostPaid (default): pay-as-you-go.

  • PrePaid: subscription.

    Note

    If you set this property to PrePaid, you must specify Period.

ConfigServer

List

Yes

No

The configurations of the Configserver node.

For more information, see ConfigServer properties.

SrcDBInstanceId

String

No

No

The ID of the source instance.

You can specify this property only when you clone an instance. You must specify this property together with the RestoreTime property.

ReplicaSet

List

Yes

No

The shard nodes.

You can use 2 to 32 shard nodes.

For more information, see ReplicaSet properties.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

For more information, see Tags properties.

TDEStatus

Boolean

No

Yes

Specifies whether to enable Transparent Data Encryption (TDE).

Valid values:

  • true: enables TDE.

    Note

    After TDE is enabled, you cannot disable it.

  • false (default): disables TDE.

ResourceGroupId

String

No

Yes

The ID of the resource group to which the instance belongs.

None.

DBInstanceDescription

String

No

No

The name of the instance.

The name must be 2 to 256 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter.

SecondaryZoneId

String

No

No

The zone ID of the secondary node.

Valid values:

  • cn-hangzhou-g: the ID of Hangzhou Zone G.

  • cn-hangzhou-h: the ID of Hangzhou Zone H.

  • cn-hangzhou-i: the ID of Hangzhou Zone I.

  • cn-hongkong-b: the ID of Hong Kong Zone B.

  • cn-hongkong-c: the ID of Hong Kong Zone C.

  • cn-hongkong-d: the ID of Hong Kong Zone D.

  • cn-wulanchabu-a: the ID of Ulanqab Zone A.

  • cn-wulanchabu-b: the ID of Ulanqab Zone B.

  • cn-wulanchabu-c: the ID of Ulanqab Zone C.

  • ap-southeast-1a: the ID of Singapore Zone A.

  • ap-southeast-1b: the ID of Singapore Zone B.

  • ap-southeast-1c: the ID of Singapore Zone C.

  • ap-southeast-5a: the ID of Jakarta Zone A.

  • ap-southeast-5b: the ID of Jakarta Zone B.

  • ap-southeast-5c: the ID of Jakarta Zone C.

  • eu-central-1a: the ID of Frankfurt Zone A.

  • eu-central-1b: the ID of Frankfurt Zone B.

  • eu-central-1c: the ID of Frankfurt Zone C.

Note
  • You must specify this property when EngineVersion is set to 4.4 or 5.0.

  • The value of SecondaryZoneId must be different from the values of ZoneId and HiddenZoneId.

HiddenZoneId

String

No

No

The zone ID of the hidden node.

Valid values:

  • cn-hangzhou-g: the ID of Hangzhou Zone G.

  • cn-hangzhou-h: the ID of Hangzhou Zone H.

  • cn-hangzhou-i: the ID of Hangzhou Zone I.

  • cn-hongkong-b: the ID of Hong Kong Zone B.

  • cn-hongkong-c: the ID of Hong Kong Zone C.

  • cn-hongkong-d: the ID of Hong Kong Zone D.

  • cn-wulanchabu-a: the ID of Ulanqab Zone A.

  • cn-wulanchabu-b: the ID of Ulanqab Zone B.

  • cn-wulanchabu-c: the ID of Ulanqab Zone C.

  • ap-southeast-1a: the ID of Singapore Zone A.

  • ap-southeast-1b: the ID of Singapore Zone B.

  • ap-southeast-1c: the ID of Singapore Zone C.

  • ap-southeast-5a: the ID of Jakarta Zone A.

  • ap-southeast-5b: the ID of Jakarta Zone B.

  • ap-southeast-5c: the ID of Jakarta Zone C.

  • eu-central-1a: the ID of Frankfurt Zone A.

  • eu-central-1b: the ID of Frankfurt Zone B.

  • eu-central-1c: the ID of Frankfurt Zone C.

Note
  • You must specify this property when EngineVersion is set to 4.4 or 5.0.

  • The value of HiddenZoneId must be different from the values of ZoneId and SecondaryZoneId.

StorageType

String

No

No

The storage category.

Valid values:

  • cloud_essd1: PL1 Enterprise SSD (ESSD).

  • cloud_essd2: PL2 ESSD.

  • cloud_essd3: PL3 ESSD.

  • local_ssd: local SSD.

Mongos syntax

"Mongos": [
  {
    "Class": String
  }
]

Mongos property

Property

Type

Required

Editable

Description

Constraint

Class

String

Yes

No

The instance type of the mongos node.

For more information, see Instance types.

ConfigServer syntax

"ConfigServer": [
  {
    "Storage": Integer,
    "Class": String
  }
]

ConfigServer properties

Property

Type

Required

Editable

Description

Constraint

Storage

Integer

Yes

No

The storage capacity of the Configserver node.

Set the value to 20.

Unit: GB.

Note

The storage capacity is fixed as 20 GB.

Class

String

Yes

No

The instance type of the Configserver node.

Set the value to dds.cs.mid.

Note

This instance type has 1 vCPU and 2 GB of memory. The number of Configserver nodes is fixed as 1.

ReplicaSet syntax

"ReplicaSet": [
  {
    "Storage": Integer,
    "Class": String,
    "ReadonlyReplicas": Integer
  }
]

ReplicaSet properties

Property

Type

Required

Editable

Description

Constraint

Storage

Integer

Yes

No

The storage capacity of the shard node.

Valid values: 10 to 2000.

Unit: GB.

The value must be in increments of 10 GB.

Class

String

Yes

No

The instance type of the shard node.

For more information, see Instance types.

ReadonlyReplicas

Integer

No

No

The number of read-only nodes that you want to create.

Valid values: 1 to 5.

Tags syntax

"Tags": [
  {
    "Key": String,
    "Value": String
  }
]  

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The key of the tag.

The key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The value of the tag.

The value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • DBInstanceStatus: the status of the instance.

  • DBInstanceId: the ID of the instance.

  • OrderId: the ID of the order.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ZoneId:
    Type: String
    AssociationProperty: ALIYUN::ECS::ZoneId
Resources:
  MongoDbShardingInstance:
    Type: ALIYUN::MONGODB::ShardingInstance
    Properties:
      ZoneId:
        Ref: ZoneId
      EngineVersion: '4.0'
      Mongos:
        - Class: dds.mongos.mid
        - Class: dds.mongos.mid
      ReplicaSet:
        - Class: dds.shard.mid
          Storage: 10
        - Class: dds.shard.mid
          Storage: 20
      ConfigServer:
        - Class: dds.cs.mid
          Storage: 20
      TDEStatus: false
Outputs:
  DBInstanceStatus:
    Description: Status of mongodb instance.
    Value:
      Fn::GetAtt:
        - MongoDbShardingInstance
        - DBInstanceStatus
  DBInstanceId:
    Description: The instance id of created mongodb instance.
    Value:
      Fn::GetAtt:
        - MongoDbShardingInstance
        - DBInstanceId
  OrderId:
    Description: Order Id of created instance.
    Value:
      Fn::GetAtt:
        - MongoDbShardingInstance
        - OrderId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ZoneId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::ZoneId"
    }
  },
  "Resources": {
    "MongoDbShardingInstance": {
      "Type": "ALIYUN::MONGODB::ShardingInstance",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "EngineVersion": "4.0",
        "Mongos": [
          {
            "Class": "dds.mongos.mid"
          },
          {
            "Class": "dds.mongos.mid"
          }
        ],
        "ReplicaSet": [
          {
            "Class": "dds.shard.mid",
            "Storage": 10
          },
          {
            "Class": "dds.shard.mid",
            "Storage": 20
          }
        ],
        "ConfigServer": [
          {
            "Class": "dds.cs.mid",
            "Storage": 20
          }
        ],
        "TDEStatus": false
      }
    }
  },
  "Outputs": {
    "DBInstanceStatus": {
      "Description": "Status of mongodb instance.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbShardingInstance",
          "DBInstanceStatus"
        ]
      }
    },
    "DBInstanceId": {
      "Description": "The instance id of created mongodb instance.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbShardingInstance",
          "DBInstanceId"
        ]
      }
    },
    "OrderId": {
      "Description": "Order Id of created instance.",
      "Value": {
        "Fn::GetAtt": [
          "MongoDbShardingInstance",
          "OrderId"
        ]
      }
    }
  }
}

For more examples, visit sharding-instance.yml.