The ALIYUN::RDS::DBInstance type is used to create an ApsaraDB RDS database instance.
Syntax
{
"Type": "ALIYUN::RDS::DBInstance",
"Properties": {
"AutoUpgradeMinorVersion": String,
"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,
"SubscriptionDeletionForce": Boolean,
"ColdDataEnabled": Boolean,
"DeletionProtection": Boolean
}
}Properties
Property Name | Type | Required | Update allowed | Description | Constraints |
ResourceGroupId | String | No | Yes | The ID of the resource group. | None |
Engine | String | Yes | The database type. | Valid values:
| |
DBInstanceStorage | Integer | Yes | Yes | The storage space of the database instance. | Valid values:
Unit: GB. Note The value must be a multiple of 5 GB. |
EngineVersion | String | is | No | The version number of the database. | Valid values:
|
AutoUpgradeMinorVersion | String | No | Yes | The method to upgrade the minor engine version of the instance. | Valid values:
|
Port | Integer | No | Yes | The instance port. | None |
ConnectionStringPrefix | String | No | Yes | The prefix of the endpoint. | The prefix must start with a lowercase letter and end with a lowercase letter or a digit. It can contain lowercase letters, digits, and hyphens (-). The prefix must be at least 8 characters long. The total length of the endpoint (prefix + suffix) cannot exceed 63 characters. |
ConnectionStringType | String | No | Yes | The type of the endpoint. | Valid values:
|
DBTimeZone | String | No | No | The UTC time zone. | The value must be in the range of -12:59 to +13:00. Note
|
DBParamGroupId | String | No | No | The ID of the parameter template. | None |
Category | String | No | Yes | The instance edition. | Valid values:
Note When you query parameters, specify ZoneId, DBInstanceStorageType, and Category. Otherwise, the verification may be incomplete. |
TargetDedicatedHostIdForMaster | String | No | No | When you create an instance in a dedicated cluster, specify the host ID of the primary instance. | None |
DBIsIgnoreCase | Integer | No | No | Specifies whether table names are case-sensitive. | Valid values:
|
EncryptionKey | String | No | No | The ID of the key used for disk encryption in the same region. You can view the key ID in the Key Management Service (KMS) console or create a new key. | If you specify this parameter, disk encryption is enabled and cannot be disabled. You must also specify RoleARN. |
MaintainTime | String | No | No | The maintenance window of the instance. | Format: |
TargetDedicatedHostIdForSlave | String | No | No | When you create an instance in a dedicated cluster, specify the host ID of the secondary instance. | None |
DedicatedHostGroupId | String | No | No | When you create an instance in a dedicated cluster, specify the ID of the dedicated cluster. | None |
DBInstanceStorageType | String | No | Yes | Instance storage class. | The storage class of the instance. Valid values:
The default value of this parameter is automatically determined based on the instance type code specified in the DBInstanceClass parameter:
Note
|
RoleARN | String | No | No | The ARN of the role. RDS uses this role to access KMS. | For more information, see Grant RDS permissions to access KMS. |
DBInstanceClass | String | Yes | Yes | The instance type. | For more information, see Primary instance types. |
SecurityIPList | String | Yes | Yes | The IP address whitelist that is allowed to access all databases of the instance. | Separate multiple IP addresses with commas (,). The IP addresses cannot be repeated. A maximum of 1,000 IP addresses are supported. Supported formats:
|
SecurityGroupId | String | No | Yes | The ID of the associated security group. | You can associate up to three security groups. Separate multiple security group IDs with commas (,). To clear the security groups, specify an empty string. |
MultiAZ | Boolean | No | No | Specifies whether the database instance supports multiple zones. | Valid values:
Note When you query parameters, set MultiAZ to false. Otherwise, the verification may be incomplete. |
VpcId | String | No | No | The ID of the VPC. | None |
DBMappings | List | No | No | Creates a new database in the instance. | For more information, see DBMappings properties. |
DBInstanceDescription | String | No | Yes | The description or remarks of the instance. | The name must be 2 to 256 characters long. It must start with an English letter or a Chinese character. It cannot start with |
SubscriptionDeletionForce | Boolean | No | No | This option applies only to subscription instances. For a subscription instance, if this option is set to true, the instance is converted to a pay-as-you-go instance before it is deleted. If this option is set to false, the instance is not forcibly deleted. This operation may incur additional fees. Use this option with caution. | None |
ConnectionMode | String | No | No | The connection mode of the database. | Valid values:
If this parameter is not specified, RDS assigns a default value. Note SQL Server 2012, 2016, and 2017 support only the standard access mode. |
MasterUsername | String | No | Yes | The name of the master account for the database instance. | The name must be globally unique. It can be up to 16 characters in length. It must start with a letter and can contain letters, digits, and underscores (_). |
MasterUserPassword | String | No | Yes | The password of the master account for the database instance. | The value must be 8 to 32 characters in length. It can contain letters, digits, and underscores (_). |
ZoneId | String | No | No | The ID of the zone. | Note When you query parameters, specify ZoneId, DBInstanceStorageType, and Category. Otherwise, the verification may be incomplete. |
DBInstanceNetType | String | No | No | The network type of the database instance. | Valid values
|
VSwitchId | String | No | No | The ID of the vSwitch. | Separate multiple values with commas (,). If the database type is MariaDB, you must specify this parameter. |
BackupPolicyMode | String | No | Yes | The backup type. | Valid values:
|
AllocatePublicConnection | Boolean | No | No | Specifies whether to apply for a public endpoint for the instance. | Valid values:
|
PreferredBackupTime | String | No | Yes | The backup time. | 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, 23:00Z-24:00Z. |
BackupRetentionPeriod | Number | No | Yes | The number of days to retain backups. | The value must be in the range of 7 to 30. Unit: days. Default value: 7. |
PrivateIpAddress | String | No | No | The private IP address within the specified vSwitch. | If you do not specify this parameter, the system automatically assigns a private IP address. |
PreferredBackupPeriod | List | No | Yes | The backup cycle. | Valid values:
|
MasterUserType | String | No | No | The type of the master account. | Valid values:
|
Tags | Map | No | Yes | A list of tags, including TagKey and TagValue. | TagKey cannot be empty, but TagValue can be empty. Example format: |
PeriodType | String | No | No | The billing cycle. | Valid values:
|
PayType | String | No | No | The billing method of the instance. | Valid values:
Note
|
Period | Integer | No | No | Subscription duration. | Valid values:
|
TargetDedicatedHostIdForLog | String | No | No | When you create an instance in a dedicated cluster, specify the host ID of the logger instance. | None |
SlaveZoneIds | List | No | No | The secondary zone for a High-availability Edition or Three-node Enterprise Edition instance. | You can specify up to two secondary zones, for example, Specify a vSwitch for each primary or secondary zone. For example, if ZoneId is |
SQLCollectorStatus | String | No | Yes | Specifies whether to enable the SQL Explorer (SQL Audit) feature. | Valid values:
|
SSLSetting | String | No | No | The Secure Sockets Layer (SSL) link settings for the instance. | Valid values:
|
AutoRenew | Boolean | No | Yes | Specifies whether to enable auto-renewal. | This parameter is valid only when you create a subscription instance. Valid values:
Note
|
LogBackupFrequency | String | No | Yes | The frequency of log backups. | Valid value: LogInterval, which indicates that a backup is performed every 30 minutes. The default value of LogBackupFrequency is the same as the value of PreferredBackupPeriod. Note The LogBackupFrequency parameter is applicable only to SQL Server. |
EnableBackupLog | Boolean | No | Yes | Specifies whether to enable the log backup feature. | Valid values:
Note You must specify this parameter when BackupPolicyMode is set to LogBackupPolicy. |
ReleasedKeepPolicy | String | No | Yes | The retention policy for archived backups after the instance is released. | Valid values:
Note
|
ArchiveBackupRetentionPeriod | Integer | No | Yes | The number of days to retain archived backups. | The value must be in the range of 30 to 1095. Unit: days. |
ArchiveBackupKeepPolicy | String | No | Yes | The retention period for archived backups. | Valid values:
|
ArchiveBackupKeepCount | Integer | No | Yes | The number of archived backups to retain. | Valid values:
Default value: 1. |
LogBackupRetentionPeriod | Integer | No | Yes | The number of days to retain log backups. | The value must be in the range of 7 to 730. The log backup retention period cannot be longer than the data backup retention period. Note If the log backup feature is enabled, you can specify the retention period for log backups. |
HighSpaceUsageProtection | String | No | Yes | Specifies whether to forcibly delete log backup files when disk space is insufficient (the instance usage exceeds 80% or the remaining space is less than 5 GB). | Valid values:
You must specify this parameter when BackupPolicyMode is set to LogBackupPolicy. |
LocalLogRetentionSpace | Integer | No | Yes | The maximum percentage of space on the instance that can be used to store log backup files. | The value must be in the range of 0 to 50. If the space usage of log backup files exceeds this percentage, the system deletes log backup files in advance until the space usage falls below this percentage. Note You must specify this parameter when BackupPolicyMode is set to LogBackupPolicy. |
BackUpCategory | String | No | Yes | Specifies whether to enable backup within seconds. | Valid values:
|
CompressType | Integer | No | Yes | The backup compression method. | Valid values:
|
LocalLogRetentionHours | Integer | No | Yes | The number of hours to retain local log backups. | The value must be in the range of 0 to 168. Unit: hours. A value of 0 indicates that log backup files are not retained on the instance. Note You must specify this parameter when BackupPolicyMode is set to LogBackupPolicy. |
LogBackupLocalRetentionNumber | Integer | No | Yes | The number of log backup files that can be retained on the instance. | The value must be in the range of 6 to 100. Default value: 60. |
ServerlessConfig | Map | No | No | The settings for the RDS Serverless instance. | For more information, see ServerlessConfig properties. |
InstanceNetworkType | String | No | No | The network type of the instance. | Valid values:
Note RDS for MySQL instances that use cloud disks support only VPCs. You must set this parameter to VPC. PostgreSQL and MariaDB instances support only VPCs. You must set this parameter to VPC. SQL Server Basic Edition and Web Edition instances support classic networks and VPCs. Other instances support only VPCs. You must set this parameter to VPC. |
StorageAutoScale | String | No | No | The switch for automatic storage expansion. | This parameter is supported only for MySQL and PostgreSQL. Valid values:
Note You can also call ModifyDasInstanceConfig to adjust this setting after the instance is created. For more information, see Configure automatic storage expansion. |
StorageUpperBound | Number | No | No | The upper limit of the total storage space for automatic expansion. | Automatic expansion does not cause the total storage space of the instance to exceed this value. Unit: GB. Note The value must be greater than or equal to 0. This parameter is required when StorageAutoScale is set to Enable. |
StorageThreshold | Number | No | No | The threshold (percentage) that triggers automatic storage expansion. | Valid values:
Note This parameter is required when StorageAutoScale is set to Enable. |
BurstingEnabled | Boolean | No | No | The switch for the I/O bursting feature of General-purpose ESSDs. | Valid values:
Note For more information about the I/O bursting feature of General-purpose ESSDs, see What is a premium performance disk?. |
IoAccelerationEnabled | String | No | No | Specifies whether to enable the I/O acceleration feature for General-purpose ESSDs. | Valid values:
Note For more information about the I/O acceleration feature of General-purpose ESSDs, see Buffer Pool Extension (BPE) feature. |
ColdDataEnabled | Boolean | No | No | This option enables or disables the general cloud disk data archiving feature. | Valid values:
For more information about the data archiving feature of General-purpose ESSDs, see Data archiving feature. |
DeletionProtection | Boolean | No | Yes | Specifies whether the release protection feature is enabled. | Valid values:
|
ServerlessConfig syntax
"ServerlessConfig": {
"SwitchForce": Boolean,
"MaxCapacity": Number,
"MinCapacity": Number,
"AutoPause": Boolean
}ServerlessConfig properties
Property Name | Type | Required | Update allowed | Description | Constraints |
SwitchForce | Boolean | No | No | Specifies whether to enable forced elastic scaling for the Serverless instance. | Valid values:
Note
|
MaxCapacity | Number | Yes | No | The maximum value of the automatic scaling range for RDS Capacity Units (RCUs) of the instance. | The value must be in the range of 0.5 to 8. Note The value of this parameter must be greater than or equal to the value of the MinCapacity parameter. |
MinCapacity | Number | Yes | No | The minimum value of the automatic scaling range for RCUs of the instance. | The value must be in the range of 0.5 to 8. Note The value of this parameter must be less than or equal to the value of the MaxCapacity parameter. |
AutoPause | Boolean | No | No | Specifies whether to enable automatic pause and startup for the Serverless instance. | Valid values:
Note If there are no connections for 10 minutes, the instance enters the paused state. When a connection is established, the instance is automatically awakened. |
DBMappings syntax
"DBMappings": [
{
"DBDescription": String,
"CharacterSetName": String,
"DBName": String
}
]DBMappings properties
Property Name | Type | Required | Update allowed | Description | Constraints |
CharacterSetName | String | Yes | No | The character set. | Valid values:
|
DBName | String | Yes | No | The database name. | The name must be globally unique. The value can be up to 64 characters in length. It must start with a letter and can contain letters, digits, and underscores (_). |
DBDescription | String | No | No | The database description. | The value must be 2 to 256 characters in length. It must start with a letter and cannot start with |
Return values
Fn::GetAtt
DBInstanceId: The ID of the database instance.
InnerPort: The internal port of the database instance.
InnerIPAddress: The internal IP address.
InnerConnectionString: The internal endpoint.
PublicPort: The public port of the database instance.
PublicConnectionString: The public endpoint.
PublicIPAddress: The public IP address.
Examples
Scenario 1: Create a pay-as-you-go ApsaraDB RDS for PostgreSQL Basic Edition instance.
ROSTemplateFormatVersion: '2015-09-01'
Description: Create a pay-as-you-go ApsaraDB RDS for PostgreSQL Basic Edition instance.
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Description:
en: The ID of the existing VPC. You can find the ID, which starts with vpc-xxx, in the VPC console.
zh-cn: The ID of the existing VPC.
Label:
en: VPC ID
zh-cn: VPC ID
ZoneId:
Type: String
Label:
en: Zone ID
zh-cn: Zone ID
Description:
en: The ID of the zone.
zh-cn: The ID of the zone.
Required: true
AssociationProperty: ZoneId
AssociationPropertyMetadata:
AutoSelectFirst: true
VSwitchId:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
Type: String
Description:
en: The ID of the existing vSwitch. You can find the ID in the VPC console.
zh-cn: The ID of the existing vSwitch.
Label:
en: VSwitch ID
zh-cn: vSwitch ID
DBInstanceClass:
Type: String
Label:
en: Instance type
zh-cn: Instance type
Required: true
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
InstanceChargeType: Postpaid
ZoneId: ${ZoneId}
EngineVersion: '17.0'
Engine: PostgreSQL
Category: Basic
DBInstanceStorageType: cloud_essd
Resources:
RDSInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
ZoneId:
Ref: ZoneId
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
DBInstanceClass:
Ref: DBInstanceClass
DBInstanceStorage: 50
Engine: PostgreSQL
EngineVersion: '17.0'
Category: Basic
DBInstanceStorageType: cloud_essd
AllocatePublicConnection: true
PayType: Postpaid
SecurityIPList: 0.0.0.0/0
Outputs:
InnerConnectionString:
Value:
Fn::GetAtt:
- RDSInstance
- InnerConnectionString
InnerIPAddress:
Value:
Fn::GetAtt:
- RDSInstance
- InnerIPAddress
PublicConnectionString:
Value:
Fn::GetAtt:
- RDSInstance
- PublicConnectionString
PublicIPAddress:
Value:
Fn::GetAtt:
- RDSInstance
- PublicIPAddress{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": "Create a pay-as-you-go ApsaraDB RDS for PostgreSQL Basic Edition instance.",
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Description": {
"en": "The ID of the existing VPC. You can find the ID, which starts with vpc-xxx, in the VPC console.",
"zh-cn": "The ID of the existing VPC."
},
"Label": {
"en": "VPC ID",
"zh-cn": "VPC ID"
}
},
"ZoneId": {
"Type": "String",
"Label": {
"en": "Zone ID",
"zh-cn": "Zone ID"
},
"Description": {
"en": "The ID of the zone.",
"zh-cn": "The ID of the zone."
},
"Required": true,
"AssociationProperty": "ZoneId",
"AssociationPropertyMetadata": {
"AutoSelectFirst": true
}
},
"VSwitchId": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Description": {
"en": "The ID of the existing vSwitch. You can find the ID in the VPC console.",
"zh-cn": "The ID of the existing vSwitch."
},
"Label": {
"en": "VSwitch ID",
"zh-cn": "vSwitch ID"
}
},
"DBInstanceClass": {
"Type": "String",
"Label": {
"en": "Instance type",
"zh-cn": "Instance type"
},
"Required": true,
"AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"InstanceChargeType": "Postpaid",
"ZoneId": "${ZoneId}",
"EngineVersion": "17.0",
"Engine": "PostgreSQL",
"Category": "Basic",
"DBInstanceStorageType": "cloud_essd"
}
}
},
"Resources": {
"RDSInstance": {
"Type": "ALIYUN::RDS::DBInstance",
"Properties": {
"ZoneId": {
"Ref": "ZoneId"
},
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"DBInstanceClass": {
"Ref": "DBInstanceClass"
},
"DBInstanceStorage": 50,
"Engine": "PostgreSQL",
"EngineVersion": "17.0",
"Category": "Basic",
"DBInstanceStorageType": "cloud_essd",
"AllocatePublicConnection": true,
"PayType": "Postpaid",
"SecurityIPList": "0.0.0.0/0"
}
}
},
"Outputs": {
"InnerConnectionString": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"InnerConnectionString"
]
}
},
"InnerIPAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"InnerIPAddress"
]
}
},
"PublicConnectionString": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"PublicConnectionString"
]
}
},
"PublicIPAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"PublicIPAddress"
]
}
}
}
}Scenario 2: Create a subscription, multi-zone ApsaraDB RDS for MySQL High-availability Edition instance.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create a subscription, multi-zone ApsaraDB RDS for MySQL High-availability Edition instance.
en: Create a subscription, multi-zone ApsaraDB RDS for MySQL High-availability Edition instance.
Parameters:
VSwitch2:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId2}
Type: String
Description:
zh-cn: The ID of the existing vSwitch.
en: The ID of the existing vSwitch. You can find the ID in the VPC console.
Label:
zh-cn: VSwitch 2 ID
en: VSwitch 2 ID
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Description:
zh-cn: The ID of the existing VPC.
en: The ID of the existing VPC. You can find the ID, which starts with vpc-xxx, in the VPC console.
Label:
zh-cn: VPC ID
en: VPC ID
ZoneId1:
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId2
Type: String
Label:
zh-cn: Primary zone
en: Primary zone
ZoneId2:
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
AssociationPropertyMetadata:
ExclusiveTo:
- ZoneId1
Type: String
Label:
zh-cn: Secondary zone
en: Secondary zone
VSwitch1:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId1}
Type: String
Description:
zh-cn: The ID of the existing vSwitch.
en: The ID of the existing vSwitch. You can find the ID in the VPC console.
Label:
zh-cn: VSwitch 1 ID
en: VSwitch 1 ID
DBInstanceClass:
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
Engine: MySQL
Category: HighAvailability
EngineVersion: '8.0'
InstanceChargeType: Prepaid
DBInstanceStorageType: cloud_essd
Type: String
Label:
zh-cn: Instance type
en: Instance type
Outputs:
InnerIPAddress:
Value:
Fn::GetAtt:
- RDSInstance
- InnerIPAddress
InnerConnectionString:
Value:
Fn::GetAtt:
- RDSInstance
- InnerConnectionString
PublicConnectionString:
Value:
Fn::GetAtt:
- RDSInstance
- PublicConnectionString
PublicIPAddress:
Value:
Fn::GetAtt:
- RDSInstance
- PublicIPAddress
Resources:
RDSInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
Category: HighAvailability
Engine: MySQL
PayType: Prepaid
SlaveZoneIds:
- Ref: ZoneId2
DBInstanceStorage: 20
PeriodType: Month
DBInstanceStorageType: cloud_essd
Period: 1
ZoneId:
Ref: ZoneId1
VpcId:
Ref: VpcId
VSwitchId:
Fn::Join:
- ','
- - Ref: VSwitch1
- Ref: VSwitch2
EngineVersion: '8.0'
DBInstanceClass:
Ref: DBInstanceClass
SecurityIPList: 0.0.0.0/0
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcId
- ZoneId1
- ZoneId2
- VSwitch1
- VSwitch2
Label:
default:
zh-cn: Network configuration
en: Network configuration
- Parameters:
- DBInstanceClass
Label:
default:
zh-cn: RDS configuration
en: RDS configuration{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create a subscription, multi-zone ApsaraDB RDS for MySQL High-availability Edition instance.",
"en": "Create a subscription, multi-zone ApsaraDB RDS for MySQL High-availability Edition instance."
},
"Parameters": {
"VSwitch2": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId2}"
},
"Type": "String",
"Description": {
"zh-cn": "The ID of the existing vSwitch.",
"en": "The ID of the existing vSwitch. You can find the ID in the VPC console."
},
"Label": {
"zh-cn": "VSwitch 2 ID",
"en": "VSwitch 2 ID"
}
},
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Description": {
"zh-cn": "The ID of the existing VPC.",
"en": "The ID of the existing VPC. You can find the ID, which starts with vpc-xxx, in the VPC console."
},
"Label": {
"zh-cn": "VPC ID",
"en": "VPC ID"
}
},
"ZoneId1": {
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId2"
]
},
"Type": "String",
"Label": {
"zh-cn": "Primary zone",
"en": "Primary zone"
}
},
"ZoneId2": {
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"AssociationPropertyMetadata": {
"ExclusiveTo": [
"ZoneId1"
]
},
"Type": "String",
"Label": {
"zh-cn": "Secondary zone",
"en": "Secondary zone"
}
},
"VSwitch1": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId1}"
},
"Type": "String",
"Description": {
"zh-cn": "The ID of the existing vSwitch.",
"en": "The ID of the existing vSwitch. You can find the ID in the VPC console."
},
"Label": {
"zh-cn": "VSwitch 1 ID",
"en": "VSwitch 1 ID"
}
},
"DBInstanceClass": {
"AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"Engine": "MySQL",
"Category": "HighAvailability",
"EngineVersion": "8.0",
"InstanceChargeType": "Prepaid",
"DBInstanceStorageType": "cloud_essd"
},
"Type": "String",
"Label": {
"zh-cn": "Instance type",
"en": "Instance type"
}
}
},
"Outputs": {
"InnerIPAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"InnerIPAddress"
]
}
},
"InnerConnectionString": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"InnerConnectionString"
]
}
},
"PublicConnectionString": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"PublicConnectionString"
]
}
},
"PublicIPAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"PublicIPAddress"
]
}
}
},
"Resources": {
"RDSInstance": {
"Type": "ALIYUN::RDS::DBInstance",
"Properties": {
"Category": "HighAvailability",
"Engine": "MySQL",
"PayType": "Prepaid",
"SlaveZoneIds": [
{
"Ref": "ZoneId2"
}
],
"DBInstanceStorage": 20,
"PeriodType": "Month",
"DBInstanceStorageType": "cloud_essd",
"Period": 1,
"ZoneId": {
"Ref": "ZoneId1"
},
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Fn::Join": [
",",
[
{
"Ref": "VSwitch1"
},
{
"Ref": "VSwitch2"
}
]
]
},
"EngineVersion": "8.0",
"DBInstanceClass": {
"Ref": "DBInstanceClass"
},
"SecurityIPList": "0.0.0.0/0"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VpcId",
"ZoneId1",
"ZoneId2",
"VSwitch1",
"VSwitch2"
],
"Label": {
"default": {
"zh-cn": "Network configuration",
"en": "Network configuration"
}
}
},
{
"Parameters": [
"DBInstanceClass"
],
"Label": {
"default": {
"zh-cn": "RDS configuration",
"en": "RDS configuration"
}
}
}
]
}
}
}Scenario 3: Create a pay-as-you-go Serverless ApsaraDB RDS for MySQL instance and associate a database and a database account.
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: Create a pay-as-you-go Serverless ApsaraDB RDS for MySQL instance and associate a database and a database account.
en: Create a pay-as-you-go Serverless ApsaraDB RDS for MySQL instance and associate a database and a database account.
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Description:
zh-cn: The ID of the existing VPC.
en: The ID of the existing VPC. You can find the ID, which starts with vpc-xxx, in the VPC console.
Label:
zh-cn: VPC ID
en: VPC ID
RdsAccountName:
Default: db_root
Type: String
Description:
zh-cn: The name of the MySQL administrator user.
en: Account Name
Label:
zh-cn: Username
en: Account Name
ZoneId:
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
Type: String
Label:
zh-cn: Primary zone
en: Primary zone
VSwitch:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
Type: String
Description:
zh-cn: The ID of the existing vSwitch.
en: The ID of the existing vSwitch. You can find the ID in the VPC console.
Label:
zh-cn: vSwitch ID
en: VSwitch ID
DBInstanceClass:
Default: mysql.n2.serverless.1c
AssociationProperty: ALIYUN::RDS::Instance::InstanceType
AssociationPropertyMetadata:
Engine: MySQL
EngineVersion: '8.0'
InstanceChargeType: Serverless
DBInstanceStorageType: cloud_essd
ZoneId: ${ZoneId}
Type: String
Label:
zh-cn: Instance type
en: Instance type
RdsAccountPassword:
Type: String
NoEcho: true
Description:
zh-cn: |-
The value 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:
!@#$&%^*()_+-= .
en: |-
The value 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:
!@#$& amp;%^* ()_+-= .
Label:
zh-cn: User password
en: DB Account Password
Outputs:
PublicConnectionString:
Value:
Fn::GetAtt:
- RDSInstance
- PublicConnectionString
InnerIPAddress:
Value:
Fn::GetAtt:
- RDSInstance
- InnerIPAddress
AccountName:
Value:
Fn::GetAtt:
- RdsAccount
- AccountName
PublicIPAddress:
Value:
Fn::GetAtt:
- RDSInstance
- PublicIPAddress
DBName:
Value:
Fn::GetAtt:
- Database
- DBName
InnerConnectionString:
Value:
Fn::GetAtt:
- RDSInstance
- InnerConnectionString
Resources:
RDSInstance:
Type: ALIYUN::RDS::DBInstance
Properties:
Category: serverless_basic
Engine: MySQL
DBInstanceStorage: 20
ServerlessConfig:
MinCapacity: 0.5
AutoPause: false
MaxCapacity: 8
SwitchForce: false
DBInstanceStorageType: cloud_essd
PayType: Serverless
ZoneId:
Ref: ZoneId
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitch
EngineVersion: '8.0'
DBInstanceClass:
Ref: DBInstanceClass
SecurityIPList: 0.0.0.0/0
RdsAccount:
Type: ALIYUN::RDS::Account
Properties:
DBInstanceId:
Ref: RDSInstance
AccountPassword:
Ref: RdsAccountPassword
AccountType: Super
AccountName:
Ref: RdsAccountName
Database:
Type: ALIYUN::RDS::Database
Properties:
CharacterSetName: UTF8
DBInstanceId:
Ref: RDSInstance
DBName: springboot_demo
Metadata:
ALIYUN::ROS::Interface:
ParameterGroups:
- Parameters:
- VpcId
- ZoneId
- VSwitch
Label:
default:
zh-cn: Network configuration
en: Network configuration
- Parameters:
- DBInstanceClass
- RdsAccountName
- RdsAccountPassword
Label:
default:
zh-cn: RDS configuration
en: RDS configuration
{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "Create a pay-as-you-go Serverless ApsaraDB RDS for MySQL instance and associate a database and a database account.",
"en": "Create a pay-as-you-go Serverless ApsaraDB RDS for MySQL instance and associate a database and a database account."
},
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Description": {
"zh-cn": "The ID of the existing VPC.",
"en": "The ID of the existing VPC. You can find the ID, which starts with vpc-xxx, in the VPC console."
},
"Label": {
"zh-cn": "VPC ID",
"en": "VPC ID"
}
},
"RdsAccountName": {
"Default": "db_root",
"Type": "String",
"Description": {
"zh-cn": "The name of the MySQL administrator user.",
"en": "Account Name"
},
"Label": {
"zh-cn": "Username",
"en": "Account Name"
}
},
"ZoneId": {
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
"Type": "String",
"Label": {
"zh-cn": "Primary zone",
"en": "Primary zone"
}
},
"VSwitch": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Description": {
"zh-cn": "The ID of the existing vSwitch.",
"en": "The ID of the existing vSwitch. You can find the ID in the VPC console."
},
"Label": {
"zh-cn": "vSwitch ID",
"en": "VSwitch ID"
}
},
"DBInstanceClass": {
"Default": "mysql.n2.serverless.1c",
"AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
"AssociationPropertyMetadata": {
"Engine": "MySQL",
"EngineVersion": "8.0",
"InstanceChargeType": "Serverless",
"DBInstanceStorageType": "cloud_essd",
"ZoneId": "${ZoneId}"
},
"Type": "String",
"Label": {
"zh-cn": "Instance type",
"en": "Instance type"
}
},
"RdsAccountPassword": {
"Type": "String",
"NoEcho": true,
"Description": {
"zh-cn": "The value 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:\n!@#$&%^*()_+-= .",
"en": "The value 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:\n!@#$& amp;%^* ()_+-= ."
},
"Label": {
"zh-cn": "User password",
"en": "DB Account Password"
}
}
},
"Outputs": {
"PublicConnectionString": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"PublicConnectionString"
]
}
},
"InnerIPAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"InnerIPAddress"
]
}
},
"AccountName": {
"Value": {
"Fn::GetAtt": [
"RdsAccount",
"AccountName"
]
}
},
"PublicIPAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"PublicIPAddress"
]
}
},
"DBName": {
"Value": {
"Fn::GetAtt": [
"Database",
"DBName"
]
}
},
"InnerConnectionString": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"InnerConnectionString"
]
}
}
},
"Resources": {
"RDSInstance": {
"Type": "ALIYUN::RDS::DBInstance",
"Properties": {
"Category": "serverless_basic",
"Engine": "MySQL",
"DBInstanceStorage": 20,
"ServerlessConfig": {
"MinCapacity": 0.5,
"AutoPause": false,
"MaxCapacity": 8,
"SwitchForce": false
},
"DBInstanceStorageType": "cloud_essd",
"PayType": "Serverless",
"ZoneId": {
"Ref": "ZoneId"
},
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitch"
},
"EngineVersion": "8.0",
"DBInstanceClass": {
"Ref": "DBInstanceClass"
},
"SecurityIPList": "0.0.0.0/0"
}
},
"RdsAccount": {
"Type": "ALIYUN::RDS::Account",
"Properties": {
"DBInstanceId": {
"Ref": "RDSInstance"
},
"AccountPassword": {
"Ref": "RdsAccountPassword"
},
"AccountType": "Super",
"AccountName": {
"Ref": "RdsAccountName"
}
}
},
"Database": {
"Type": "ALIYUN::RDS::Database",
"Properties": {
"CharacterSetName": "UTF8",
"DBInstanceId": {
"Ref": "RDSInstance"
},
"DBName": "springboot_demo"
}
}
},
"Metadata": {
"ALIYUN::ROS::Interface": {
"ParameterGroups": [
{
"Parameters": [
"VpcId",
"ZoneId",
"VSwitch"
],
"Label": {
"default": {
"zh-cn": "Network configuration",
"en": "Network configuration"
}
}
},
{
"Parameters": [
"DBInstanceClass",
"RdsAccountName",
"RdsAccountPassword"
],
"Label": {
"default": {
"zh-cn": "RDS configuration",
"en": "RDS configuration"
}
}
}
]
}
}
}For more examples, see public templates that contain this resource.