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,
    "NetworkType": String,
    "ConfigServer": List,
    "SrcDBInstanceId": String,
    "ReplicaSet": List,
    "Tags": List,
    "TDEStatus": Boolean,
    "DBInstanceDescription": String,
    "ResourceGroupId": String,
    "SecondaryZoneId": String,
    "HiddenZoneId": String,
    "StorageType": String
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
EngineVersionStringNoNoThe 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.
ZoneIdStringNoNoThe ID of the zone. None.
AutoRenewBooleanNoNoSpecifies whether to enable auto-renewal for the instance. Default value: false. Valid values:
  • true: enables auto-renewal for the instance.
  • false: disables auto-renewal for the instance. You must manually renew the instance.
Note This property takes effect when the ChargeType property is set to PrePaid.
VSwitchIdStringNoNoThe ID of the vSwitch. This property takes effect when the NetworkType property is set to VPC.
PeriodIntegerNoNoThe subscription duration of the instance. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36.

Unit: months.

Note This property takes effect and is required if the ChargeType property is set to PrePaid.
SecurityIPArrayStringNoNoThe IP addresses in the whitelist of the instance. Separate multiple IP addresses with commas (,). Each IP address must be unique in the whitelist. The whitelist can contain up to 1,000 IP addresses.
The following types of IP addresses are supported:
  • %.
  • 0.0.0.0/0.
  • IP addresses, such as 10.23.XX.XX.
  • CIDR blocks, such as 10.23.XX.XX/24. /24 indicates 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 If you set this property to a percent sign (%) or 0.0.0.0/0, the instance can be accessed from all IP addresses. This may cause security risks to the instance. Proceed with caution.
MongosListYesNoThe mongos nodes. You can add 2 to 32 mongos nodes.

For more information, see Mongos property.

StorageEngineStringNoNoThe storage engine that you want to use for the instance. Default value: WiredTiger. Valid values:
  • WiredTiger: suitable for most business 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.
RestoreTimeStringNoNoThe 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 if you clone an instance. 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 in the previous seven days.
AccountPasswordStringNoYesThe password of the root account. The password must be 8 to 32 characters in length. The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include ! # $ % ^ & * () _ + - =.
VpcIdStringNoNoThe ID of the virtual private cloud (VPC). This property takes effect when the NetworkType property is set to VPC.
ProtocolTypeStringNoNoThe type of the access protocol. Valid values:
  • mongodb
  • dynamodb
ChargeTypeStringNoNoThe billing method of the instance. Default value: PostPaid. Valid values:
  • PostPaid: pay-as-you-go
  • PrePaid: subscription
    Note If you set this property to PrePaid, you must specify the Period property.
NetworkTypeStringNoNoThe network type of the instance. Default value: CLASSIC. Valid values:
  • CLASSIC: classic network
  • VPC: VPC
    Note If you set this property to VPC, you must specify the VpcId and VSwitchId properties.
ConfigServerListYesNoThe configurations of the Configserver node. For more information, see ConfigServer properties.
SrcDBInstanceIdStringNoNoThe ID of the source instance. You can specify this property only if you clone an instance. When you clone an instance, you must specify this property together with the RestoreTime property.
ReplicaSetListYesNoThe shard nodes. You can add 2 to 32 shard nodes.

For more information, see ReplicaSet properties.

TagsListNoYesThe tags of the instance. You can add up to 20 tags.

For more information, see Tags properties.

TDEStatusBooleanNoYesSpecifies whether to enable Transparent Data Encryption (TDE). Default value: false. Valid values:
  • true: enables TDE.
    Note After TDE is enabled, you cannot disable it.
  • false: disables TDE.
ResourceGroupIdStringNoYesThe ID of the resource group to which the instance belongs. None.
DBInstanceDescriptionStringNoNoThe name of the instance. The name must be 2 to 256 characters in length, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter.
SecondaryZoneIdStringNoNoThe ID of the zone in which the secondary node resides. Valid values:
  • cn-hangzhou-g: corresponds to Hangzhou Zone G
  • cn-hangzhou-h: corresponds to Hangzhou Zone H
  • cn-hangzhou-i: corresponds to Hangzhou Zone I
  • cn-hongkong-b: corresponds to Hong Kong Zone B
  • cn-hongkong-c: corresponds to Hong Kong Zone C
  • cn-hongkong-d: corresponds to Hong Kong Zone D
  • cn-wulanchabu-a: corresponds to Ulanqab Zone A
  • cn-wulanchabu-b: corresponds to Ulanqab Zone B
  • cn-wulanchabu-c: corresponds to Ulanqab Zone C
  • ap-southeast-1a: corresponds to Singapore Zone A
  • ap-southeast-1b: corresponds to Singapore Zone B
  • ap-southeast-1c: corresponds to Singapore Zone C
  • ap-southeast-5a: corresponds to Jakarta Zone A
  • ap-southeast-5b: corresponds to Jakarta Zone B
  • ap-southeast-5c: corresponds to Jakarta Zone C
  • eu-central-1a: corresponds to Frankfurt Zone A
  • eu-central-1b: corresponds to Frankfurt Zone B
  • eu-central-1c: corresponds to Frankfurt Zone C
Note
  • This property is required if the EngineVersion property is set to 4.4 or 5.0.
  • You must set this property to a zone ID that is different from the values of the ZoneId and HiddenZoneId properties.
HiddenZoneIdStringNoNoThe ID of the zone in which the hidden node resides. Valid values:
  • cn-hangzhou-g: corresponds to Hangzhou Zone G
  • cn-hangzhou-h: corresponds to Hangzhou Zone H
  • cn-hangzhou-i: corresponds to Hangzhou Zone I
  • cn-hongkong-b: corresponds to Hong Kong Zone B
  • cn-hongkong-c: corresponds to Hong Kong Zone C
  • cn-hongkong-d: corresponds to Hong Kong Zone D
  • cn-wulanchabu-a: corresponds to Ulanqab Zone A
  • cn-wulanchabu-b: corresponds to Ulanqab Zone B
  • cn-wulanchabu-c: corresponds to Ulanqab Zone C
  • ap-southeast-1a: corresponds to Singapore Zone A
  • ap-southeast-1b: corresponds to Singapore Zone B
  • ap-southeast-1c: corresponds to Singapore Zone C
  • ap-southeast-5a: corresponds to Jakarta Zone A
  • ap-southeast-5b: corresponds to Jakarta Zone B
  • ap-southeast-5c: corresponds to Jakarta Zone C
  • eu-central-1a: corresponds to Frankfurt Zone A
  • eu-central-1b: corresponds to Frankfurt Zone B
  • eu-central-1c: corresponds to Frankfurt Zone C
Note
  • This property is required if the EngineVersion property is set to 4.4 or 5.0.
  • You must set this property to a zone ID that is different from the values of the ZoneId and SecondaryZoneId properties.
StorageTypeStringNoNoThe storage type of the instance. Valid values:
  • cloud_essd1: PL1 enhanced SSD (ESSD)
  • cloud_essd2: PL2 ESSD
  • cloud_essd3: PL3 ESSD
  • local_ssd: local SSD

Mongos syntax

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

Mongos property

PropertyTypeRequiredEditableDescriptionConstraint
ClassStringYesNoThe instance type of the Mongos node. For more information, see Instance types .

ConfigServer syntax

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

ConfigServer properties

PropertyTypeRequiredEditableDescriptionConstraint
StorageIntegerYesNoThe storage capacity of the Configserver node. Set the value to 20.

Unit: GB.

Note The storage capacity is fixed as 20 GB.
ClassStringYesNoThe instance type of the Configserver node. Set the value to dds.cs.mid.
Note This instance type has 1 vCPU and 2 GB memory. The number of ConfigServer nodes is fixed as 1.

ReplicaSet syntax

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

ReplicaSet properties

PropertyTypeRequiredEditableDescriptionConstraint
StorageIntegerYesNoThe storage capacity of the shard node. Valid values: 10 to 2000.

Unit: GB.

You can scale the storage capacity in increments of 10 GB.

ClassStringYesNoThe instance type of the shard node. For more information, see Instance types .
ReadonlyReplicasIntegerNoNoThe number of read-only nodes that you want to create. Valid values: 1 to 5.

Tags syntax

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

Tags properties

PropertyTypeRequiredEditableDescriptionConstraint
KeyStringYesNoThe key of the tag. The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.
ValueStringNoNoThe value of the tag. The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • DBInstanceStatus: the state of the instance.
  • DBInstanceId: the ID of the instance.
  • OrderId: the ID of the order.

Examples

  • YAML format

    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
  • JSON format

    {
      "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 ShardingInstance.json and ShardingInstance.yml.