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
}
}
Properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
ResourceGroupId | String | No | Yes | The ID of the resource group to which the instance belongs. | None. |
Engine | String | Yes | No | The database engine. | Valid values:
|
DBInstanceStorage | Integer | Yes | Yes | The storage capacity of the ApsaraDB RDS instance. | Valid values:
Note You can specify values in multiples of 5. |
EngineVersion | String | Yes | No | The version of the database engine. | Valid values:
|
Port | Integer | No | Yes | The port that is used to connect to the instance. | None. |
ConnectionStringPrefix | String | No | Yes | The prefix of the connection string. | The prefix must be 8 to 64 characters in length and can contain letters, digits, and hyphens (-). |
ConnectionStringType | String | No | Yes | The type of the connection string. | Valid values:
|
DBTimeZone | String | No | No | The UTC time zone of the instance. | Valid values: -12:59 to +13:00. Note
|
DBParamGroupId | String | No | No | The ID of the parameter template. | None. |
Category | String | No | No | The edition of the instance. | Valid values:
|
TargetDedicatedHostIdForMaster | String | No | No | The ID of the host on which you want to create the primary instance within a dedicated cluster. | None. |
DBIsIgnoreCase | Integer | No | No | Specifies whether table names on the instance are case-sensitive. | Valid values:
|
EncryptionKey | String | No | No | The ID of the key that is used for disk encryption in the region where the instance resides. You can obtain the ID of the key from the Key Management Service (KMS) console. You can also create a key. | If you specify this property, disk encryption is enabled and you must also specify the RoleARN property. Disk encryption cannot be disabled 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 ID of the host on which you want to create the secondary instance within 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 | No | The storage type of the instance. | Valid values:
|
RoleARN | String | No | No | The Alibaba Cloud Resource Name (ARN) that is provided by your Alibaba Cloud account for RAM users. RAM users can use the ARN to connect ApsaraDB RDS to KMS. | For more information about the RoleARN property, see Authorize an ApsaraDB RDS for MySQL instance to access KMS. |
DBInstanceClass | String | Yes | Yes | The instance class. | For more information about the DBInstanceClass property, see Primary ApsaraDB RDS instance types. |
SecurityIPList | String | Yes | Yes | The whitelist of IP addresses that are allowed to access all databases in the instance. | Separate IP addresses with commas (,). Each IP address in the whitelist must be unique. A maximum of 1,000 IP addresses can be specified. You can specify the following types of IP addresses:
|
SecurityGroupId | String | No | Yes | The ID of the associated security group. | Each ApsaraDB RDS instance can be associated with up to three security groups. Separate security groups with commas (,). To disassociate the instance from all security groups, set this property to an empty string. |
MultiAZ | Boolean | No | No | Specifies whether the instance can be deployed across zones. | Valid values:
|
VpcId | String | No | No | The ID of the virtual private cloud (VPC). | None. |
DBMappings | List | No | No | The databases that are to be created in the instance. | For more information about the DBMappings property, see DBMappings properties. |
DBInstanceDescription | String | No | No | The description of the instance. | The description must be 2 to 256 characters in length, The description must start with a letter and cannot start with http:// or https:// . The description can contain letters, digits, underscores (_), and hyphens (-). |
ConnectionMode | String | No | No | The connection mode of the database instance. | Valid values:
Note SQL Server 2012, SQL Server 2016, and SQL Server 2017 support only the standard mode. |
MasterUsername | String | No | No | The username of the account that is used to manage the databases of the instance. | The username must be globally unique. The username must be 1 to 16 characters in length and can contain letters, digits, and underscores (_). It must start with a letter. |
MasterUserPassword | String | No | No | The password of the account that is used to manage the databases 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 where the instance resides. | None. |
DBInstanceNetType | String | No | No | The type of network connection of the instance. | Valid values:
|
VSwitchId | String | No | No | The ID of the vSwitch to which the database instance is connected. | Separate vSwitch IDs with commas (,). If you set the Engine property to MariaDB, you must specify the VSwitchId property. |
BackupPolicyMode | String | No | No | 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 | No | The backup window. |
|
BackupRetentionPeriod | Number | No | No | The number of days for which the backup is retained. | Valid values: 7 to 30. Unit: day. Default value: 7. |
PrivateIpAddress | String | No | No | The private IP address within the CIDR block of the vSwitch. | If you do not specify this property, the system allocates a private IP address. |
PreferredBackupPeriod | List | No | No | The day on which data is backed up. | Valid values:
|
MasterUserType | String | No | No | The type of the account that is used to manage the databases of the instance. | Valid values:
|
Tags | Map | No | Yes | The tags. Each tag consists of a tag key and a tag value. | You cannot specify an empty string as the tag key. You can specify an empty string as the tag value. Format example: |
PeriodType | String | No | No | The unit of the subscription period. | Valid values:
|
PayType | String | No | No | The billing method of the instance. | Valid values:
|
Period | Integer | No | No | The subscription duration of the instance. | Valid values:
|
TargetDedicatedHostIdForLog | String | No | No | The ID of the host on which you want to create the logger instance within a dedicated cluster. | None. |
SlaveZoneIds | List | No | No | The secondary zone IDs that you need to specify when you create a High-availability Edition or Enterprise Edition instance. | You can specify a maximum of two secondary zones. For example, you can set this property to ["zone-b"] or ["zone-b", "zone-c"] . You must specify a vSwitch for each primary or secondary zone. For example, if ZoneId is set to "zone-a" and SlaveZoneIds is set to ["zone-c", "zone-b"] , you must set the VSwitchId value in the following format:
|
SQLCollectorStatus | String | No | Yes | Specifies whether to enable SQL Explorer and Audit. | Valid values:
|
SSLSetting | String | No | No | The secure sockets layer (SSL) connection settings for the instance. | Valid values:
|
AutoRenew | Boolean | No | No | Specifies whether to enable auto-renewal for the database instance. | If you create a subscription instance, you must specify this property. Valid values:
Note
|
LogBackupFrequency | String | No | No | The backup frequency of logs. | Set the value to LogInterval. This value specifies that logs are backed up every 30 minutes. The default value of LogBackupFrequency is the same as that of PreferredBackupPeriod. Note If you create an instance that runs SQL Server, you must specify the LogBackupFrequency property. |
EnableBackupLog | Boolean | No | No | Specifies whether to enable the log backup feature. | Valid values:
Note If you set the BackupPolicyMode property to LogBackupPolicy, you must specify the EnableBackupLog property. |
ReleasedKeepPolicy | String | No | No | The policy that is used to retain archived backup files if the instance is released | Valid values:
|
ArchiveBackupRetentionPeriod | Integer | No | No | The number of days for which the archived backup is retained. | Valid values: 30 to 1095. Unit: day. |
ArchiveBackupKeepPolicy | String | No | No | The cycle based on which the archived backup is retained. | Valid values:
|
ArchiveBackupKeepCount | Integer | No | No | The number of archived backup files that are retained. | Valid values:
Default value: 1. |
LogBackupRetentionPeriod | Integer | No | No | The number of days for which the log backup is retained. | Valid values: 7 to 730. The retention period of log backup files cannot be longer than that of data backup files. Note If you enable the log backup feature, you can specify the retention period of log backup files. |
HighSpaceUsageProtection | String | No | No | Specifies whether to delete log backup files if the disk capacity is insufficient. The capacity is insufficient if the usage of your RDS instance capacity exceeds 80% or the remaining capacity is less than 5 GB on the instance. | Valid values:
If you set the BackupPolicyMode property to LogBackupPolicy, you must specify the HighSpaceUsageProtection property. |
LocalLogRetentionSpace | Integer | No | No | The maximum percentage of space that can be used to store log backup files on the instance. | Valid values: 0 to 50. If the space usage of log backup files exceeds this percentage, the system deletes earlier binary log files until the space usage falls below this percentage. Note If you set the BackupPolicyMode property to LogBackupPolicy, you must specify the LocalLogRetentionSpace property. |
BackUpCategory | String | No | No | Specifies whether to enable level-2 backup. | Valid values:
|
CompressType | Integer | No | No | The format that is used to compress backup data. | Valid values:
|
LocalLogRetentionHours | Integer | No | No | The number of hours for which the log backup is retained on the instance. | Valid values: 0 to 168. Unit: hour. A value of 0 specifies that the log backup is not retained on the instance. Note If you set the BackupPolicyMode property to LogBackupPolicy, you must specify the LocalLogRetentionHours property. |
LogBackupLocalRetentionNumber | Integer | No | No | 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 about the ServerlessConfig property, see ServerlessConfig properties. |
ServerlessConfig syntax
"ServerlessConfig": {
"SwitchForce": Boolean,
"MaxCapacity": Number,
"MinCapacity": Number,
"AutoPause": Boolean
}
ServerlessConfig properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
SwitchForce | Boolean | No | No | Specifies whether to enable the forced scaling feature for the serverless instance. | Valid values:
Note
|
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 the MinCapacity property. |
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 the MaxCapacity property. |
AutoPause | Boolean | No | No | Specifies whether to enable the smart startup and suspension feature for the serverless instance. | Valid values:
Note After the smart startup and suspension feature is enabled, if no connections to the instance are established within 10 minutes, the instance is suspended. After a connection to the instance is established, the instance is resumed. |
DBMappings syntax
"DBMappings": [
{
"DBDescription": String,
"CharacterSetName": String,
"DBName": String
}
]
DBMappings properties
Property | Type | Required | Editable | Description | Constraint |
---|---|---|---|---|---|
CharacterSetName | String | Yes | No | The character set. | Valid values:
|
DBName | String | Yes | No | The name of the database. | The name must be globally unique. The name must be 1 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, The description must start with a letter and cannot start with http:// or https:// . The description can contain letters, digits, underscores (_), and hyphens (-). |
Return values
Fn::GetAtt
- DBInstanceId: the ID of the instance.
- InnerPort: the internal port of the instance.
- InnerIPAddress: the internal IP address of the instance.
- InnerConnectionString: the internal connection string of the instance.
- PublicPort: the public port of the instance.
- PublicConnectionString: the public connection string of the instance.
- PublicIPAddress: the public IP address of the instance.
Examples
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": { "DependsOn": "VSwitch", "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" ] } } } }
For more examples, visit DBInstance.json and DBInstance.yml. The examples use the ALIYUN::RDS::DBInstance, ALIYUN::RDS::Account, ALIYUN::RDS::AccountPrivilege, ALIYUN::RDS::DBInstanceParameterGroup, ALIYUN::RDS::DBInstanceSecurityIps, ALIYUN::RDS::ReadOnlyDBInstance, and ALIYUN::RDS::Database resource types.