All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::MONGODB::Instance

Last Updated:Feb 05, 2025

ALIYUN::MONGODB::Instance is used to create or clone an ApsaraDB for MongoDB replica set instance.

Syntax

{
  "Type": "ALIYUN::MONGODB::Instance",
  "Properties": {
    "DatabaseNames": String,
    "VpcPasswordFree": Boolean,
    "ReadonlyReplicas": Integer,
    "BusinessInfo": String,
    "AccountPassword": String,
    "VpcId": String,
    "SecurityGroupId": String,
    "AutoRenew": Boolean,
    "ResourceGroupId": String,
    "VSwitchId": String,
    "StorageEngine": String,
    "SrcDBInstanceId": String,
    "ReplicationFactor": Integer,
    "ZoneId": String,
    "EngineVersion": String,
    "RestoreTime": String,
    "DBInstanceStorage": Integer,
    "DBInstanceDescription": String,
    "CouponNo": String,
    "Period": Integer,
    "SecurityIPArray": String,
    "ChargeType": String,
    "BackupId": String,
    "TDEStatus": Boolean,
    "DBInstanceClass": String,
    "Tags": List,
    "SecondaryZoneId": String,
    "HiddenZoneId": String,
    "StorageType": String,
    "PrivateConnections": Map
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

VpcPasswordFree

Boolean

No

No

Specifies whether to enable password-free access to the instance over a virtual private cloud (VPC).

Valid values:

  • true

  • false

DBInstanceStorage

Integer

Yes

Yes

The storage capacity of the instance.

Valid values: 10 to 3000. The value must be a multiple of 10.

Unit: GB.

DBInstanceClass

String

Yes

Yes

The instance type.

For more information, see Instance types.

TDEStatus

Boolean

No

Yes

Specifies whether to enable transparent data encryption (TDE).

Valid values:

  • true

    Note

    After TDE is enabled, you cannot disable it.

  • false (default)

SrcDBInstanceId

String

No

No

The ID of the source instance.

You can specify this property only if you use ALIYUN::MONGODB::Instance to clone an instance. You must specify this property together with BackupId or RestoreTime.

DBInstanceDescription

String

No

No

The description of the instance.

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

SecurityIPArray

String

No

No

The entries in the IP address whitelist that is used to access the instance.

Separate multiple entries with commas (,). Each entry must be unique in the whitelist. You can specify up to 1,000 entries.

Supported formats include 0.0.0.0/0, 10.23.XX.XX (IP address format), and 10.23.XX.XX/24 (CIDR block format). /24 specifies that the prefix of the CIDR block is 24 bits in length. You can replace 24 with a value that ranges from 1 to 32.

Default value of this property: 0.0.0.0/0. A value of 0.0.0.0/0 specifies that all IP addresses can be used to access the instance.

ZoneId

String

No

No

The ID of the zone.

For more information, see DescribeRegions. If you use a VPC, you must set this property to the zone ID of the vSwitch in the VPC.

VpcId

String

No

No

The ID of the VPC.

None.

SecurityGroupId

String

No

Yes

The ID of the security group.

None.

VSwitchId

String

No

No

The ID of the vSwitch.

None.

BackupId

String

No

No

The ID of the backup set.

You can specify this property only if you use ALIYUN::MONGODB::Instance to clone an instance. You must specify this property together with SrcDBInstanceId.

AccountPassword

String

No

Yes

The password of the root account.

The password must be 6 to 32 characters in length, and can contain letters, digits, and the following special characters: ! # $ % ^ & * ( ) _ + - =.

EngineVersion

String

No

No

The version of the database engine.

Valid values:

  • 3.4 (default)

  • 4.0

  • 4.2

  • 4.4

  • 5.0

StorageEngine

String

No

No

The storage engine.

For more information about storage engines and MongoDB versions, see MongoDB versions and storage engines.

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.

ReplicationFactor

Integer

No

Yes

The number of nodes in the instance.

Valid values:

  • 3 (default)

  • 5

  • 7

DatabaseNames

String

No

No

The names of the databases.

None.

ReadonlyReplicas

Integer

No

Yes

The number of read-only nodes.

Valid values: 1 to 5.

BusinessInfo

String

No

No

The business information.

This property is an additional property.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

AutoRenew

Boolean

No

No

Specifies whether to enable auto-renewal for the instance.

Valid values:

  • true

  • false (default)

RestoreTime

String

No

No

The point in time to which you want to restore data if you use ALIYUN::MONGODB::Instance to clone an instance.

Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

You can specify this property only if you use ALIYUN::MONGODB::Instance to clone an instance. You must specify this property together with SrcDBInstanceId and BackupId. You can set this property to a point in time within the previous seven days.

CouponNo

String

No

No

The coupon code.

Default value: youhuiquan_promotion_option_id_for_blank.

Period

Integer

No

No

The subscription duration of the instance.

Unit: month.

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

Default value: 1.

This property takes effect when ChargeType is set to PrePaid.

ChargeType

String

No

No

The billing method of the instance.

Valid values:

  • PostPaid: pay-as-you-go.

  • PrePaid: subscription.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

For more information, see Tags properties.

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.

PrivateConnections

Map

No

Yes

The private connection configurations.

For more information, see PrivateConnections property.

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:.

PrivateConnections syntax

"PrivateConnections": 
  {
    "ReplicaConnections": List
  }  

PrivateConnections property

Property

Type

Required

Editable

Description

Constraint

ReplicaConnections

List

No

Yes

The endpoint configurations of nodes in the instance.

Number of supported nodes: 1 to 6.

Note

You can add or modify the endpoint configurations of nodes only in the sequence of the endpoint configurations queried by using the DescribeDBInstanceAttribute operation.

For more information, see ReplicaConnections properties.

ReplicaConnections syntax

{
  "PrivateConnections": {
    "ReplicaConnections": [
      {
        "ConnectionString": String,
        "ConnectionPort": Integer
      }
    ]
  }
}

ReplicaConnections properties

Property

Type

Required

Editable

Description

Constraint

ConnectionPort

Integer

No

Yes

The port.

Valid values: 1000 to 65535.

Note

You can modify the ports only of an instance that runs MongoDB 4.2 or later and uses ESSDs.

ConnectionString

String

Yes

Yes

The prefix of the endpoint.

The prefix must start with a lowercase letter and end with a lowercase letter or a digit. It must consist of lowercase letters, digits, and hyphens (-). It must be 8 to 63 characters in length.

Note

You need to only specify the prefix of the endpoint. The remaining part of the endpoint cannot be modified.

You can modify the endpoints of primary, secondary, and read-only nodes for instances that use local SSDs and ESSDs.

Return values

Fn::GetAtt

  • OrderId: the order ID of the instance.

  • DBInstanceId: the ID of the instance. The ID is globally unique.

  • DBInstanceStatus: the status of the instance.

  • ConnectionURI: the connection Uniform Resource Identifier (URI).

  • ReplicaSetName: the name of the replica set.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Description: Test MONGODB Instance
Parameters:
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  ZoneId:
    Type: String
    AssociationProperty: ALIYUN::ECS::ZoneId
  VSwitchId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      ZoneId: ${ZoneId}
      VpcId: ${VpcId}
Resources:
  MongoDB:
    Type: ALIYUN::MONGODB::Instance
    Properties:
      DBInstanceClass: dds.mongo.mid
      DBInstanceStorage: 10
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test MONGODB Instance",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "ZoneId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::ZoneId"
    },
    "VSwitchId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "ZoneId": "${ZoneId}",
        "VpcId": "${VpcId}"
      }
    }
  },
  "Resources": {
    "MongoDB": {
      "Type": "ALIYUN::MONGODB::Instance",
      "Properties": {
        "DBInstanceClass": "dds.mongo.mid",
        "DBInstanceStorage": 10,
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        }
      }
    }
  },
  "Outputs": {
  }
}           

For more examples, visit mongodb-instance.yml.