ALIYUN::RDS::DBInstance

Updated at: 2025-03-26 07:08

ALIYUN::RDS::DBInstance is used to create an ApsaraDB RDS instance.

Syntax

{
  "Type": "ALIYUN::RDS::DBInstance",
  "Properties": {
    "PeriodType": String,
    "Category": String,
    "PrivateIpAddress": String,
    "ResourceGroupId": String,
    "TargetDedicatedHostIdForSlave": String,
    "DBInstanceNetType": String,
    "DBTimeZone": String,
    "DedicatedHostGroupId": String,
    "EncryptionKey": String,
    "PreferredBackupPeriod": List,
    "SecurityIPList": String,
    "SecurityGroupId": String,
    "DBIsIgnoreCase": Integer,
    "DBInstanceStorage": Integer,
    "DBMappings": List,
    "Port": Integer,
    "ConnectionStringPrefix": String,
    "ConnectionStringType": String,
    "MultiAZ": Boolean,
    "MaintainTime": String,
    "Engine": String,
    "DBParamGroupId": String,
    "DBInstanceDescription": String,
    "Tags": Map,
    "TargetDedicatedHostIdForMaster": String,
    "EngineVersion": String,
    "ZoneId": String,
    "DBInstanceClass": String,
    "AllocatePublicConnection": Boolean,
    "PreferredBackupTime": String,
    "VSwitchId": String,
    "BackupPolicyMode": String,
    "Period": Integer,
    "PayType": String,
    "DBInstanceStorageType": String,
    "RoleARN": String,
    "MasterUserPassword": String,
    "MasterUserType": String,
    "VpcId": String,
    "MasterUsername": String,
    "ConnectionMode": String,
    "BackupRetentionPeriod": Number,
    "TargetDedicatedHostIdForLog": String,
    "SlaveZoneIds": List,
    "AutoRenew": Boolean,
    "SQLCollectorStatus": String,
    "SSLSetting": String,
    "LogBackupFrequency": String,
    "EnableBackupLog": Boolean,
    "ReleasedKeepPolicy": String,
    "ArchiveBackupRetentionPeriod": Integer,
    "ArchiveBackupKeepPolicy": String,
    "ArchiveBackupKeepCount": Integer,
    "LogBackupRetentionPeriod": Integer,
    "HighSpaceUsageProtection": String,
    "LocalLogRetentionSpace": Integer,
    "BackUpCategory": String,
    "CompressType": Integer,
    "LocalLogRetentionHours": Integer,
    "LogBackupLocalRetentionNumber": Integer,
    "ServerlessConfig": Map,
    "InstanceNetworkType": String,
    "StorageAutoScale": String,
    "StorageUpperBound": Number,
    "StorageThreshold": Number,
    "BurstingEnabled": Boolean,
    "IoAccelerationEnabled": String,
    "ColdDataEnabled": Boolean,
    "DeletionProtection": Boolean
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Property

Type

Required

Editable

Description

Constraint

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

Engine

String

Yes

No

The type of the database engine.

Valid values:

  • MySQL

  • SQLServer

  • PostgreSQL

  • PPAS

  • MariaDB

DBInstanceStorage

Integer

Yes

Yes

The storage capacity of the instance.

  • Valid values when Engine is set to MySQL: 5 to 1000.

  • Valid values when Engine is set to SQLServer: 10 to 1000.

  • Valid values when Engine is set to PostgreSQL: 5 to 2000.

  • Valid values when Engine is set to PPAS: 5 to 2000.

Unit: GB.

Note

The value of DBInstanceStorage must be in increments of 5 GB.

EngineVersion

String

Yes

No

The version of the database engine.

  • Valid values when Engine is set to MySQL: 5.5, 5.6, 5.7, and 8.0.

  • Valid values when Engine is set to SQLServer: 2008r2, 08r2_ent_ha, 2012, 2012_ent_ha, 2012_std_ha, 2012_web, 2014_std_ha, 2016_ent_ha, 2016_std_ha, 2016_web, 2017_std_ha, 2017_ent, and 2019_ent.

  • Valid values when Engine is set to PostgreSQL: 9.4, 10.0, 11.0, and 12.0.

  • Valid values when Engine is set to PPAS: 9.3 and 10.0.

  • Valid value when Engine is set to MariaDB: 10.3.

Port

Integer

No

Yes

The port of the instance.

None.

ConnectionStringPrefix

String

No

Yes

The prefix of the endpoint.

The prefix can contain lowercase letters, digits, and hyphens (-). The prefix must start with a lowercase letter and end with a lowercase letter or a digit.

The prefix must be at least 8 characters in length. The endpoint, including the prefix and suffix, can be up to 63 characters in length.

ConnectionStringType

String

No

Yes

The endpoint type.

Valid values:

  • Inner: private.

  • Public: public.

DBTimeZone

String

No

No

The UTC time zone.

Valid values: -12:59 to +13:00.

Note
  • If you do not specify this property, the default time zone of the region where the instance resides is used.

  • If you create an instance to which local SSDs are attached, you can name the time zone.

DBParamGroupId

String

No

No

The ID of the parameter template.

None.

Category

String

No

Yes

The edition of the instance.

Valid values:

  • Basic: RDS Basic Edition.

  • HighAvailability: RDS High-availability Edition.

  • AlwaysOn: RDS Cluster Edition.

  • Finance: RDS Enterprise Edition.

Note

To ensure complete validation, we recommend that you specify ZoneId, DBInstanceStorageType, and Category when you use the parameter constraint query feature.

TargetDedicatedHostIdForMaster

String

No

No

The host ID of the primary instance that you want to create in a dedicated cluster.

None.

DBIsIgnoreCase

Integer

No

No

Specifies whether table names are case-insensitive.

Valid values:

  • 0: Table names are case-sensitive.

  • 1 (default): Table names are case-insensitive.

EncryptionKey

String

No

No

The ID of the key that is used for cloud disk encryption in the region where the instance resides. You can obtain the key ID from the Key Management Service (KMS) console. You can also create a key.

If you specify this property, cloud disk encryption is enabled and the RoleARN property is required. You cannot disable cloud disk encryption after it is enabled.

MaintainTime

String

No

No

The maintenance window of the instance.

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

TargetDedicatedHostIdForSlave

String

No

No

The host ID of the secondary instance that you want to create in a dedicated cluster.

None.

DedicatedHostGroupId

String

No

No

The ID of the dedicated cluster in which you want to create the instance.

None.

DBInstanceStorageType

String

No

Yes

The storage type of the instance.

Valid values:

  • local_ssd: local SSD. This storage type is recommended.

  • cloud_ssd: standard SSD. This storage type is not recommended. Standard SSDs are no longer available for purchase in specific Alibaba Cloud regions.

  • cloud_essd: performance level (PL) 1 Enterprise SSD (ESSD).

  • cloud_essd2: PL2 ESSD.

  • cloud_essd3: PL3 ESSD.

  • general_essd: general ESSD.

The default value of DBInstanceStorageType varies based on the instance type specified by the DBInstanceClass property:

  • If the instance type corresponds to the local disk storage type, the default value of DBInstanceStorageType is local_ssd.

  • If the instance type corresponds the cloud disk storage type, the default value of DBInstanceStorageType is cloud_essd.

Note
  • To ensure complete validation, we recommend that you specify ZoneId, DBInstanceStorageType, and Category when you use the parameter constraint query feature.

  • Serverless instances support only PL1 ESSDs and general ESSDs.

RoleARN

String

No

No

The Alibaba Cloud Resource Name (ARN) of the Resource Access Management (RAM) role. You can access KMS from ApsaraDB RDS by using the RAM role.

For more information, see Authorize ApsaraDB RDS to access KMS.

DBInstanceClass

String

Yes

Yes

The instance type.

For more information, see Primary ApsaraDB RDS instance types.

SecurityIPList

String

Yes

Yes

The IP address whitelist that allows access to all databases on the instance.

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

Entries in the whitelist support the following formats:

  • IP address. Example: 10.23.XX.XX.

  • CIDR block. Example: 10.23.XX.XX/24. 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.

SecurityGroupId

String

No

Yes

The ID of the security group with which you want to associate the instance.

You can associate the instance with up to three security groups. Separate multiple security group IDs with commas (,). If you want to disassociate the instance from all security groups, leave this property empty.

MultiAZ

Boolean

No

No

Specifies whether the instance supports multiple zones.

Valid values:

  • true

  • false

Note

To ensure complete validation, we recommend that you set MultiAZ to false when you use the parameter constraint query feature.

VpcId

String

No

No

The ID of the virtual private cloud (VPC).

None.

DBMappings

List

No

No

The databases that you want to create on the instance.

For more information, see DBMappings properties.

DBInstanceDescription

String

No

Yes

The description of the instance.

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

ConnectionMode

String

No

No

The connection mode of the database.

Valid values:

  • Standard: standard mode.

  • Safe: database proxy mode.

If you do not specify this property, the system assigns a connection mode by default.

Note

Instances that run SQL Server 2012, SQL Server 2016, or SQL Server 2017 support only the standard mode.

MasterUsername

String

No

Yes

The username of the database management account of the instance.

The username must be globally unique. It can be up to 16 characters in length, and can contain letters, digits, and underscores (_). It must start with a letter.

MasterUserPassword

String

No

Yes

The password of the database management account of the instance.

The password must be 8 to 32 characters in length, and can contain letters, digits, and underscores (_).

ZoneId

String

No

No

The ID of the zone.

Note

To ensure complete validation, we recommend that you specify ZoneId, DBInstanceStorageType, and Category when you use the parameter constraint query feature.

DBInstanceNetType

String

No

No

The network connection type of the instance.

Valid values:

  • Internet

  • Intranet (default)

VSwitchId

String

No

No

The ID of the vSwitch.

Separate multiple vSwitch IDs with commas (,).

This property must be specified when Engine is set to MariaDB.

BackupPolicyMode

String

No

Yes

The backup type.

Valid values:

  • DataBackupPolicy

  • LogBackupPolicy

AllocatePublicConnection

Boolean

No

No

Specifies whether to apply for a public endpoint for the instance.

Valid values:

  • true

  • false

PreferredBackupTime

String

No

Yes

The backup time.

Specify the time in the HH:mmZ- HH:mmZ format.

Valid values: 00:00Z-01:00Z, 01:00Z-02:00Z, 02:00Z-03:00Z, 03:00Z-04:00Z, 04:00Z-05:00Z, 05:00Z-06:00Z, 06:00Z-07:00Z, 07:00Z-08:00Z, 08:00Z-09:00Z, 09:00Z-10:00Z, 10:00Z-11:00Z, 11:00Z-12:00Z, 12:00Z-13:00Z, 13:00Z-14:00Z, 14:00Z-15:00Z, 15:00Z-16:00Z, 16:00Z-17:00Z, 17:00Z-18:00Z, 18:00Z-19:00Z, 19:00Z-20:00Z, 20:00Z-21:00Z, 21:00Z-22:00Z, 22:00Z-23:00Z, and 23:00Z-24:00Z.

BackupRetentionPeriod

Number

No

Yes

The number of days for which you want to retain backup data.

Valid values: 7 to 30.

Unit: day.

Default value: 7.

PrivateIpAddress

String

No

No

The private IP address that corresponds to the vSwitch ID.

If you do not specify this property, the system assigns a private IP address by default.

PreferredBackupPeriod

List

No

Yes

The day of a week on which the system backs up data.

Valid values:

  • Monday

  • Tuesday

  • Wednesday

  • Thursday

  • Friday

  • Saturday

  • Sunday

MasterUserType

String

No

No

The type of the database management account.

Valid values:

  • Normal (default): standard account.

  • Super: privileged account.

  • Sysadmin: system admin account.

    Note

    You can set this property to Sysadmin only when Engine is set to SQLServer.

Tags

Map

No

Yes

The tags. Each tag consists of a tag key and a tag value.

The tag key is required, and the tag value is optional.

Sample format: {"key1":"value1","key2":""}.

PeriodType

String

No

No

The unit of the billing cycle.

Valid values:

  • Month (default)

  • Year

PayType

String

No

No

The billing method of the instance.

Valid values:

Note
  • ServerlessConfig must be specified when PayType is set to Serverless. For more information, see ServerlessConfig properties.

  • The system automatically generates an order and completes the payment.

Period

Integer

No

No

The subscription duration.

  • Valid values when PeriodType is set to Year: 1 to 3.

  • Valid values when PeriodType is set to Month: 1 to 9.

TargetDedicatedHostIdForLog

String

No

No

The host ID of the logger instance that you want to create in a dedicated cluster.

None.

SlaveZoneIds

List

No

No

The secondary zone IDs of the instance that runs RDS High-availability Edition or RDS Enterprise Edition.

You can specify up to two secondary zone IDs. For example, you can set this property to ["zone-b"] or ["zone-b", "zone-c"].

You must specify a vSwitch ID for each primary or secondary zone. For example, if you set ZoneId to "zone-a" and SlaveZoneIds to ["zone-c", "zone-b"], you must specify vSwitch IDs in the following format:

"vsw-zone-a,vsw-zone-c,vsw-zone-b"

SQLCollectorStatus

String

No

Yes

Specifies whether to enable SQL Explorer and Audit.

Valid values:

  • Enable

  • Disabled

SSLSetting

String

No

No

The SSL connection settings of the instance.

Valid values:

  • Disabled (default): disables the SSL connection settings of the instance.

  • EnabledForPublicConnection: enables the SSL connection settings of the instance. SSL certificates are used to protect public endpoints.

    Note

    If you set this property to EnabledForPublicConnection, you must set AllocatePublicConnection to true.

  • EnabledForInnerConnection: enables the SSL connection settings of the instance. SSL certificates are used to protect private endpoints.

AutoRenew

Boolean

No

No

Specifies whether to enable auto-renewal.

This property must be specified only when the instance uses the subscription billing method.

Valid values:

  • true

  • false

Note
  • If you set PeriodType to Month, the auto-renewal cycle is one month.

  • If you set PeriodType to Year, the auto-renewal cycle is one year.

LogBackupFrequency

String

No

Yes

The frequency at which you want to back up logs.

Set the value to LogInterval. A value of LogInterval specifies that the system backs up logs every 30 minutes. The default value of LogBackupFrequency is the same as the value of PreferredBackupPeriod.

Note

LogBackupFrequency is supported only when Engine is set to SQLServer.

EnableBackupLog

Boolean

No

Yes

Specifies whether to enable the log backup feature.

Valid values:

  • true

  • false

Note

This property must be specified when BackupPolicyMode is set to LogBackupPolicy.

ReleasedKeepPolicy

String

No

Yes

The policy that you want to use to retain archived backups after the instance is released.

Valid values:

  • Lastest: retains only the most recent archived backup.

  • All: retains all archived backups.

ArchiveBackupRetentionPeriod

Integer

No

Yes

The number of days for which you want to retain archived backups.

Valid values: 30 to 1095.

Unit: day.

ArchiveBackupKeepPolicy

String

No

Yes

The cycle based on which you want to retain archived backups.

Valid values:

  • ByMonth

  • ByWeek

  • KeepAll

ArchiveBackupKeepCount

Integer

No

Yes

The number of archived backups that you want to retain.

  • Set this property to a value that ranges from 1 to 31 if you set ArchiveBackupKeepPolicy to ByMonth.

  • Set this property to a value that ranges from 1 to 7 if you set ArchiveBackupKeepPolicy to ByWeek.

  • Leave this property empty if you set ArchiveBackupKeepPolicy to KeepAll.

Default value: 1.

LogBackupRetentionPeriod

Integer

No

Yes

The number of days for which you want to retain log backups.

Valid values: 7 to 730.

The retention period of log backups cannot be longer than that of data backups.

Note

If you enable the log backup feature, you can specify the retention period of log backups.

HighSpaceUsageProtection

String

No

Yes

Specifies whether to forcefully delete log backup files when the disk capacity is insufficient. The capacity is considered insufficient if the storage usage of your instance exceeds 80% or the remaining storage capacity of your instance is less than 5 GB.

Valid values:

  • Enable

  • Disable

This property must be specified when BackupPolicyMode is set to LogBackupPolicy.

LocalLogRetentionSpace

Integer

No

Yes

The maximum storage usage that is allowed for log backup files on the instance. Unit: %.

Valid values: 0 to 50.

If the storage usage for log backup files on the instance exceeds the value of this property, the system deletes earlier log backup files until the storage usage falls below the value of this property.

Note

This property must be specified when BackupPolicyMode is set to LogBackupPolicy.

BackUpCategory

String

No

Yes

Specifies whether to enable the single-digit second backup feature.

Valid values:

  • Flash: enables the single-digit second backup feature.

  • Standard: disables the single-digit second backup feature.

CompressType

Integer

No

Yes

The method that you want to use to compress backup data.

Valid values:

  • 1: uses zlib to compress backup data into .tar.gz files.

  • 4: uses QuickLZ to compress backup data into .xb.gz files. This method is supported only for instances that run MySQL 5.6 or MySQL 5.7 and can be used to restore individual databases and tables.

  • 8: uses QuickLZ to compress backup data into .xb.gz files. This method is supported only for instances that run MySQL 8.0 and cannot be used to restore individual databases or tables.

LocalLogRetentionHours

Integer

No

Yes

The number of hours for which you want to retain local log backups on the instance.

Valid values: 0 to 168.

Unit: hour.

A value of 0 specifies that log backup files are not retained on the instance.

Note

This property must be specified when BackupPolicyMode is set to LogBackupPolicy.

LogBackupLocalRetentionNumber

Integer

No

Yes

The number of log backup files that can be retained on the instance.

Valid values: 6 to 100.

Default value: 60.

ServerlessConfig

Map

No

No

The settings of the serverless instance.

For more information, see ServerlessConfig properties.

InstanceNetworkType

String

No

No

The network type of the instance.

Valid values:

  • VPC

  • Classic

Note

For instances that run MySQL and use cloud disks, you must set this property to VPC.

For instances that run PostgreSQL or MariaDB, you must set this property to VPC.

For instances that run SQL Server Basic or SQL Server Web, you can set this property to VPC or Classic. For other types of instances, you must set this property to VPC.

StorageAutoScale

String

No

No

Specifies whether to enable automatic storage expansion.

This property is supported only when Engine is set to MySQL or PostgreSQL. Valid values:

  • Enable

  • Disable (default)

Note

You can also call the ModifyDasInstanceConfig operation to adjust the settings of automatic storage expansion for an instance after the instance is created. For more information, see Configure automatic storage expansion.

StorageUpperBound

Number

No

No

The maximum storage capacity that is allowed for automatic storage expansion.

Automatic storage expansion does not cause the storage capacity of the instance to exceed the value of this property. Unit: GB.

Note

The value of this property must be greater than or equal to 0.

This property must be specified when StorageAutoScale is set to Enable.

StorageThreshold

Number

No

No

The threshold based on which automatic storage expansion is triggered. Unit: %.

Valid values:

  • 10

  • 20

  • 30

  • 40

  • 50

Note

This property must be specified when StorageAutoScale is set to Enable.

BurstingEnabled

Boolean

No

No

Specifies whether to enable the I/O burst feature of general ESSDs.

Valid values:

  • true

  • false

Note

For more information about the I/O burst feature of general ESSDs, see What is a general ESSD?

IoAccelerationEnabled

String

No

No

Specifies whether to enable the I/O acceleration feature of general ESSDs.

Valid values:

  • 1: enables the I/O acceleration feature of general ESSDs.

  • 0: disables the I/O acceleration feature of general ESSDs.

Note

For more information about the I/O acceleration feature of general ESSDs, see Use the I/O acceleration feature of general ESSDs.

ColdDataEnabled

Boolean

No

No

Specifies whether to enable the data archiving feature of general ESSDs.

Valid values:

  • true

  • false

For more information about the data archiving feature of general ESSDs, see Use the data archiving feature of general ESSDs.

DeletionProtection

Boolean

No

Yes

Specifies whether to enable the release protection feature.

Valid values:

  • true

  • false

ServerlessConfig syntax

"ServerlessConfig": {
    "SwitchForce": Boolean,
    "MaxCapacity": Number,
    "MinCapacity": Number,
    "AutoPause": Boolean
  }

ServerlessConfig properties

Property

Type

Required

Editable

Description

Constraint

Property

Type

Required

Editable

Description

Constraint

SwitchForce

Boolean

No

No

Specifies whether to enable the forced scaling feature for the serverless instance.

Valid values:

  • true

  • false (default)

Note
  • If you set this property to true, a transient disconnection that lasts for up to 1 minute occurs during the forced scaling process of the instance. Exercise caution when you specify this property.

  • In most cases, the scaling for RDS Capacity Units (RCUs) of a serverless instance immediately takes effect. In some cases, such as the executions of large transactions, the scaling does not immediately take effect. In this case, you can enable the forced scaling feature to forcefully scale the RCUs of the instance.

MaxCapacity

Number

Yes

No

The maximum value of RCU scaling.

Valid values: 0.5 to 8.

Note

The value of this property must be greater than or equal to the value of MinCapacity.

MinCapacity

Number

Yes

No

The minimum value of RCU scaling.

Valid values: 0.5 to 8.

Note

The value of this property must be less than or equal to the value of MaxCapacity.

AutoPause

Boolean

No

No

Specifies whether to enable the automatic startup and suspension feature for the serverless instance.

Valid values:

  • true

  • false (default)

Note

After you enable the feature, the instance is suspended if the instance is not connected within 10 minutes, and the instance is resumed if the instance is connected.

DBMappings syntax

"DBMappings": [
  {
    "DBDescription": String,
    "CharacterSetName": String,
    "DBName": String
  }
]

DBMappings properties

Property

Type

Required

Editable

Description

Constraint

Property

Type

Required

Editable

Description

Constraint

CharacterSetName

String

Yes

No

The character set.

  • Valid values when Engine is set to MySQL:

    • utf8

    • gbk

    • latin1

    • utf8mb4 (applicable to versions 5.5 and 5.6)

  • Valid values when Engine is set to SQLServer:

    • Chinese_PRC_CI_AS

    • Chinese_PRC_CS_AS

    • SQL_Latin1_General_CP1_CI_AS

    • SQL_Latin1_General_CP1_CS_AS

    • Chinese_PRC_BIN

DBName

String

Yes

No

The name of the database.

The name must be globally unique.

It can be up to 64 characters in length, and can contain letters, digits, and underscores (_). It must start with a letter.

DBDescription

String

No

No

The description of the database.

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

Return values

Fn::GetAtt

  • DBInstanceId: the ID of the instance.

  • InnerPort: the private port of the instance.

  • InnerIPAddress: the private IP address.

  • InnerConnectionString: the private endpoint.

  • PublicPort: the public port of the instance.

  • PublicConnectionString: the public endpoint.

  • PublicIPAddress: the public IP address.

Examples

YAML format
JSON format
ROSTemplateFormatVersion: '2015-09-01'
Description: Test RDS DBInstance
Parameters:
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud
       
    Label:
      en: VPC ID
       
  VSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${VSwitchZoneId}
    Type: String
    Description:
      en: Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query
       
    Label:
      en: VSwitch ID
       
Resources:
  RDSInstance:
    Type: ALIYUN::RDS::DBInstance
    Properties:
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
      EngineVersion: '5.6'
      DBInstanceClass: rds.mysql.s2.large
      SecurityIPList: 0.0.0.0/0
      DBInstanceStorage: 5
      Engine: MySQL
      DBMappings:
        - CharacterSetName: utf8
          DBName: DBTest
Outputs:
  DBInstanceId:
    Value:
      Fn::GetAtt:
        - RDSInstance
        - DBInstanceId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test RDS DBInstance",
  "Parameters": {
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "Please search the ID starting with (vpc-xxx) from console-Virtual Private Cloud",
         
      },
      "Label": {
        "en": "VPC ID",
         
      }
    },
    "VSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${VSwitchZoneId}"
      },
      "Type": "String",
      "Description": {
        "en": "Instance ID of existing business network switches, console-Virtual Private Cloud-VSwitches under query",
         
      },
      "Label": {
        "en": "VSwitch ID",
         
      }
    }
  },
  "Resources": {
    "RDSInstance": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "EngineVersion": "5.6",
        "DBInstanceClass": "rds.mysql.s2.large",
        "SecurityIPList": "0.0.0.0/0",
        "DBInstanceStorage": 5,
        "Engine": "MySQL",
        "DBMappings": [
          {
            "CharacterSetName": "utf8",
            "DBName": "DBTest"
          }
        ]
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Value": {
        "Fn::GetAtt": [
          "RDSInstance",
          "DBInstanceId"
        ]
      }
    }
  }
}

To create an ApsaraDB RDS instance that resides in multiple zones, you can use one of the following methods:

Method 1. Set MultiAZ to true and leave ZoneId empty. This way, the system automatically selects multiple zones for the instance when you create the instance.

Method 2: Set MultiAZ to false or leave MultiAZ empty, and specify ZoneId and ZoneIdSlave.

For more examples, visit db-instance.yml. In the examples, the following resource types are used: ALIYUN::RDS::DBInstance, ALIYUN::RDS::Account, ALIYUN::RDS::AccountPrivilege, ALIYUN::RDS::DBInstanceParameterGroup, ALIYUN::RDS::DBInstanceSecurityIps, ALIYUN::RDS::ReadOnlyDBInstance, and ALIYUN::RDS::Database.

  • On this page (1, T)
  • Syntax
  • Properties
  • ServerlessConfig syntax
  • ServerlessConfig properties
  • DBMappings syntax
  • DBMappings properties
  • Return values
  • Examples
Feedback