All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::MONGODB::Instance

Last Updated:Jun 03, 2026

Creates or clones a 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,
    "ClusterId": String,
    "SrcRegion": String,
    "AuditPolicyOptions": Map,
    "DBInstanceReleaseProtection": Boolean,
    "SSLOptions": Map,
    "Encrypted": Boolean,
    "ProvisionedIops": Integer,
    "EncryptionKey": String,
    "RestoreType": Integer,
    "BackupPolicyOptions": Map
  }
}

Properties

Property Name

Type

Required

Update allowed

Description

Constraints

DBInstanceStorage

Integer

Yes

Yes

The storage capacity.

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

Unit: GB.

DBInstanceClass

String

Yes

Yes

The instance type.

Instance types.

TDEStatus

Boolean

No

Yes

Enables Transparent Data Encryption (TDE).

Valid values:

  • true: Enable TDE.

    Note

    Once enabled, TDE cannot be disabled.

  • false (default): Disable TDE.

SrcDBInstanceId

String

No

No

The ID of the source instance.

Required for cloning. Use with BackupId or RestoreTime.

DBInstanceDescription

String

No

No

The description of the instance.

2-256 characters. Must start with a letter or Chinese character. Allows letters, digits, Chinese characters, underscores (_), and hyphens (-).

SecurityIPArray

String

No

Yes

The IP address whitelist.

Separate with commas (,). Each address must be unique. Maximum: 1,000.

Formats: 0.0.0.0/0, 10.23.XX.XX (IP address), or 10.23.XX.XX/24 (CIDR block, prefix length 1-32).

Default: 0.0.0.0/0 (all IP addresses).

ClusterId

String

No

No

The ID of the dedicated cluster.

None

SrcRegion

String

No

No

The region of the source instance.

Note
  • This parameter is required when RestoreType is set to 2 or 3.

AuditPolicyOptions

Map

No

Yes

The audit policy configuration.

AuditPolicyOptions properties.

DBInstanceReleaseProtection

Boolean

No

Yes

Enables release protection.

Valid values:

  • true: Enabled.

  • false: Disabled.

SSLOptions

Map

No

Yes

The TLS/SSL encryption configuration.

SSLOptions properties.

Encrypted

Boolean

No

No

Enables disk encryption.

None

ProvisionedIops

Integer

No

No

The provisioned performance.

None

EncryptionKey

String

No

No

The KMS key for disk encryption.

None

RestoreType

Integer

No

No

The instance restore type.

Valid values:

  • 0: Restore the instance from a specified backup set.

  • 1: Restore the instance to a specified point in time.

  • 2: Restore a released instance from a specified backup set.

  • 3: Restore the instance from a specified geo-redundant backup set.

BackupPolicyOptions

Map

No

Yes

The backup policy configuration.

BackupPolicyOptions properties.

ZoneId

String

No

No

The ID of the zone.

For more information, see DescribeRegions. If the instance is in a VPC, the value of this parameter must be the same as the zone of the vSwitch.

VpcPasswordFree

Boolean

No

No

Enables passwordless access over a VPC.

Valid values:

  • true: Enable passwordless access.

  • false: Disable passwordless access.

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.

Required for cloning. Use with SrcDBInstanceId.

AccountPassword

String

No

Yes

The password of the root account.

6-32 characters. Allows letters, digits, and these special characters: !#$%^&*()_+-=.

EngineVersion

String

No

No

The database engine version.

Valid values:

  • 3.4 (default)

  • 4.0

  • 4.2

  • 4.4

  • 5.0

StorageEngine

String

No

No

The storage engine.

Versions and storage engines.

Valid values:

  • WiredTiger (default): Suitable for most scenarios.

  • RocksDB: Suitable for scenarios with many writes and a few reads.

  • TerarkDB: Suitable for scenarios with more reads than writes, or scenarios with batch writes and many reads.

ReplicationFactor

Integer

No

Yes

The number of nodes in the replica set.

Valid values:

  • 3 (default)

  • 5

  • 7

DatabaseNames

String

No

No

The name of the database.

None

ReadonlyReplicas

Integer

No

Yes

The number of read-only nodes.

Valid values: 1 to 5.

BusinessInfo

String

No

No

The business information.

This is an additional parameter.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None

AutoRenew

Boolean

No

No

Enables auto-renewal.

Valid values:

  • true: Enable auto-renewal.

  • false (default): The resource requires manual renewal.

RestoreTime

String

No

No

The restore point for cloning.

Format: yyyy-MM-ddTHH:mm:ssZ (UTC).

Required for cloning. Use with SrcDBInstanceId and BackupId. Supports restore points within the last 7 days.

CouponNo

String

No

No

The coupon code.

Default: youhuiquan_promotion_option_id_for_blank.

Period

Integer

No

Yes

The subscription duration.

Unit: month.

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

The default value is 1.

Applies only when ChargeType is PrePaid.

ChargeType

String

No

Yes

The billing method.

Valid values:

  • PostPaid: Pay-as-you-go.

  • PrePaid: Subscription.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

Tags properties.

SecondaryZoneId

String

No

No

The zone where the secondary node is deployed.

Valid values:

  • cn-hangzhou-g: Hangzhou Zone G.

  • cn-hangzhou-h: Hangzhou Zone H.

  • cn-hangzhou-i: Hangzhou Zone I.

  • cn-hongkong-b: Hong Kong (China) Zone B.

  • cn-hongkong-c: Hong Kong (China) Zone C.

  • cn-hongkong-d: Hong Kong (China) Zone D.

  • cn-wulanchabu-a: Ulanqab Zone A.

  • cn-wulanchabu-b: Ulanqab Zone B.

  • cn-wulanchabu-c: Ulanqab Zone C.

  • ap-southeast-1a: Singapore Zone A.

  • ap-southeast-1b: Singapore Zone B.

  • ap-southeast-1c: Singapore Zone C.

  • ap-southeast-5a: Jakarta Zone A.

  • ap-southeast-5b: Jakarta Zone B.

  • ap-southeast-5c: Jakarta Zone C.

  • eu-central-1a: Frankfurt Zone A.

  • eu-central-1b: Frankfurt Zone B.

  • eu-central-1c: Frankfurt Zone C.

Note
  • This parameter is available and required when EngineVersion is set to 4.4 or 5.0.

  • The value of this parameter cannot be the same as the value of ZoneId or HiddenZoneId.

HiddenZoneId

String

No

No

The zone where the hidden node is deployed.

Valid values:

  • cn-hangzhou-g: Hangzhou Zone G.

  • cn-hangzhou-h: Hangzhou Zone H.

  • cn-hangzhou-i: Hangzhou Zone I.

  • cn-hongkong-b: Hong Kong (China) Zone B.

  • cn-hongkong-c: Hong Kong (China) Zone C.

  • cn-hongkong-d: Hong Kong (China) Zone D.

  • cn-wulanchabu-a: Ulanqab Zone A.

  • cn-wulanchabu-b: Ulanqab Zone B.

  • cn-wulanchabu-c: Ulanqab Zone C.

  • ap-southeast-1a: Singapore Zone A.

  • ap-southeast-1b: Singapore Zone B.

  • ap-southeast-1c: Singapore Zone C.

  • ap-southeast-5a: Jakarta Zone A.

  • ap-southeast-5b: Jakarta Zone B.

  • ap-southeast-5c: Jakarta Zone C.

  • eu-central-1a: Frankfurt Zone A.

  • eu-central-1b: Frankfurt Zone B.

  • eu-central-1c: Frankfurt Zone C.

Note
  • This parameter is available and required when EngineVersion is set to 4.4 or 5.0.

  • The value of this parameter cannot be the same as the value of ZoneId or SecondaryZoneId.

StorageType

String

No

No

The storage class.

Valid values:

  • cloud_essd1: PL1 ESSD.

  • cloud_essd2: PL2 ESSD.

  • cloud_essd3: PL3 ESSD.

  • local_ssd: Local SSD.

PrivateConnections

Map

No

Yes

The configurations of the private connection.

PrivateConnections properties.

Tags syntax

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

Tags properties

Property Name

Type

Required

Update allowed

Description

Constraints

Key

String

Yes

No

The tag key.

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

Value

String

No

No

The tag value.

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

PrivateConnections syntax

"PrivateConnections": 
  {
    "ReplicaConnections": List
  }  

PrivateConnections properties

Property Name

Type

Required

Update allowed

Description

Constraints

ReplicaConnections

List

Yes

Yes

The connection information of the replica nodes.

Length: 1-6.

Note

You can create or modify the connection information of a node only in the same order as the connection information is queried by calling the DescribeDBInstanceAttribute operation.

ReplicaConnections properties.

AuditPolicyOptions syntax

"AuditPolicyOptions": 
  {
    "StoragePeriod": Integer,
    "AuditStatus": String,
    "AuditLogSwitchSource": String,
    "ServiceType": String
  }  

AuditPolicyOptions properties

Property Name

Type

Required

Update allowed

Description

Constraints

AuditStatus

String

Yes

Yes

The status of the audit log.

Valid values:

  • enable: Enables the audit log.

  • disabled: Disables the audit log.

StoragePeriod

Integer

No

Yes

The retention period of audit logs.

Valid values: 1 to 365. The default value is 30. Unit: days.

AuditLogSwitchSource

String

No

Yes

The source of the audit log request.

The value is Console.

ServiceType

String

No

Yes

The audit log version.

Valid values:

  • Trial: Free trial version.

  • Standard: Official version.

Note

Default: Trial. Since January 6, 2022, the official edition is available in various regions and the free trial is no longer offered. Set this to Standard.

SSLOptions syntax

"SSLOptions": 
  {
    "ForceEncryption": Integer,
    "SwitchMode": Integer,
    "SSLAction": String
  }  

SSLOptions properties

Property Name

Type

Required

Update allowed

Description

Constraints

SSLAction

String

Yes

Yes

The operation to perform on the SSL feature.

Valid values:

  • Open: Enable SSL encryption.

  • Close: Disable SSL encryption.

  • Update: Update the SSL certificate.

ForceEncryption

Integer

No

Yes

Enables forced SSL encryption for connections.

Valid values:

  • 1: Force SSL encryption.

  • 0: Do not force SSL encryption.

SwitchMode

Integer

No

Yes

When to apply SSL configuration changes.

Valid values:

  • 0: Modify immediately.

  • 1: Modify within the O&M window.

BackupPolicyOptions syntax

"SSLOptions": 
  {
    "CrossBackupType": String,
    "BackupInterval": Integer,
    "BackupRetentionPolicyOnClusterDeletion": Integer,
    "HighFrequencyBackupRetention": Integer,
    "BackupRetentionPeriod": Integer,
    "InstanceType": String,
    "LogBackupRetentionPeriod": Integer,
    "CrossRetentionValue": Integer,
    "CrossBackupPeriod": String,
    "PreferredBackupTime": String,
    "DestRegion": String,
    "CrossRetentionType": String,
    "EnableCrossLogBackup": Integer,
    "PreferredBackupPeriod": String,
    "PreserveOneEachHour": Boolean,
    "SnapshotBackupType": String,
    "CrossLogRetentionType": String,
    "CrossLogRetentionValue": Integer,
    "EnableBackupLog": Integer,
    "SrcRegion": String
  }  

BackupPolicyOptions properties

Property Name

Type

Required

Update allowed

Description

Constraints

CrossBackupType

String

No

Yes

The geo-redundancy policy.

Valid values:

  • update: Modify the geo-redundancy policy.

  • delete: Delete the geo-redundancy policy.

BackupInterval

Integer

No

Yes

The high-frequency backup frequency.

Valid values:

  • -1: Disable high-frequency backup.

  • 30: Every 30 minutes.

  • 60: Every 1 hour.

  • 120: Every 2 hours.

  • 180: Every 3 hours.

  • 240: Every 4 hours.

  • 360: Every 6 hours.

  • 480: Every 8 hours.

  • 720: Every 12 hours.

BackupRetentionPolicyOnClusterDeletion

Integer

No

Yes

Backup retention policy.

Valid values:

  • 0: Immediately delete all backup sets of the instance when the instance is released.

  • 1: Automatically create a backup when the instance is released and retain the backup set for a long term.

  • 2: Automatically create a backup when the instance is released and retain all backup sets of the cluster for a long term.

Long-term retention backups.

HighFrequencyBackupRetention

Integer

No

Yes

The retention period of high-frequency backups.

Before you use this parameter, make sure that the BackupInterval parameter is specified. The default retention period is one day. Unit: days.

BackupRetentionPeriod

Integer

No

Yes

The retention period of full backups.

Note
  • For users who created their accounts before September 10, 2021, the default retention period is 7 days.

  • If your instance is created after September 10, 2021, backups are retained for 30 days by default.

InstanceType

String

No

Yes

The instance type.

Valid values:

  • replicate

  • sharding

Note
  • This parameter is required when you restore a deleted instance.

  • This parameter is required when you clone an instance from a geo-redundant backup.

LogBackupRetentionPeriod

Integer

No

Yes

The retention period of log backups.

The default value is 7.

Valid values: 7 to 730. Unit: days.

CrossRetentionValue

Integer

No

Yes

The retention period of geo-redundant backups.

Valid values: 3 to 1825. Unit: days.

Note
  • This parameter is required for geo-redundant backups.

  • This parameter is required and takes effect only when CrossRetentionType is set to delay.

CrossBackupPeriod

String

No

Yes

Geo-redundancy retention period

Valid values:

  1. Monday

  2. Tuesday

  3. Wednesday

  4. Thursday

  5. Friday

  6. Saturday

  7. Sunday

Note

This parameter is required for geo-redundant backups.

  • Separate multiple values with commas (,).

  • If you configure a regular backup policy, the days specified for this parameter must be a subset of the days specified for the PreferredBackupPeriod parameter.

PreferredBackupTime

String

No

Yes

The time to perform a backup.

Specify the time in the HH:mmZ-HH:mmZ format. The time must be in UTC.

Note

The time range must be 1 hour.

DestRegion

String

No

Yes

The region where the backup is stored.

Note

This parameter is required for geo-redundant backups.

CrossRetentionType

String

No

Yes

The retention policy for geo-redundant backups.

Note
  • delay: Retain for a period of time.

  • never: Never expires.

EnableCrossLogBackup

Integer

No

Yes

Enables cross-region log backup.

Note

This parameter is required for geo-redundant backups.

  • 1: Enable. This value is required for sharded cluster instances. For replica set instances, this value is required if you want to enable point-in-time recovery across regions.

  • 0: Disable.

PreferredBackupPeriod

String

No

Yes

The backup cycle.

Valid values:

  • Monday.

  • Tuesday

  • Wednesday

  • Thursday

  • Friday: Friday.

  • Saturday.

  • Sunday

Note

Separate multiple values with commas (,).

PreserveOneEachHour

Boolean

No

Yes

Enables hourly sparse backup.

Valid values:

  • true: If the backup frequency is measured in minutes, all snapshots created within the last hour are retained. For snapshots created more than 1 hour ago but within the last 24 hours, only the first snapshot created after the full hour is retained.

  • false: All snapshots are retained within the high-frequency backup retention period.

SnapshotBackupType

String

No

Yes

The snapshot backup type.

Valid values:

  • Flash: Backup within seconds.

  • Standard: Regular backup (default).

CrossLogRetentionType

String

No

Yes

The retention policy for cross-region log backups.

Valid values:

  • delay: Retain for a period of time.

  • never: Never expires.

CrossLogRetentionValue

Integer

No

Yes

The retention period of cross-region log backups.

Valid values: 3 to 1825. The value must be less than or equal to the value of CrossRetentionValue. Unit: days.

EnableBackupLog

Integer

No

Yes

Enables log backup.

Valid values:

  • 0: Disable (default).

  • 1: Enable.

SrcRegion

String

No

Yes

The region of the instance.

Note
  • This parameter is required for restoring a deleted instance.

  • This parameter is required for geo-redundant backups.

ReplicaConnections syntax

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

ReplicaConnections properties

Property Name

Type

Required

Update allowed

Description

Constraints

ConnectionString

String

Yes

Yes

The connection address prefix

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

Specify only the prefix of the endpoint. The rest of the endpoint cannot be modified.

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

ConnectionPort

Integer

No

Yes

The connection port.

Valid values: 1000 to 65535.

Note

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

Return values

Fn::GetAtt

  • OrderId: The ID of the order used to create the MongoDB instance.

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

  • DBInstanceStatus: The status of the MongoDB instance.

  • ConnectionURI: The connection URI.

  • ReplicaSetName: The name of the replica set.

  • Arn: The Alibaba Cloud Resource Name (ARN) of the instance.

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": {
  }
}           

YAML example on GitHub.