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

Syntax

{
  "Type": "ALIYUN::RDS::DBInstance",
  "Properties": {
    "Engine": String,
    "MultiAZ": Boolean,
    "VpcId": String,
    "DBMappings": List,
    "DBInstanceDescription": String,
    "ConnectionMode": String,
    "MasterUsername": String,
    "MasterUserPassword": String,
    "ZoneId": String,
    "DBInstanceNetType": String,
    "DBInstanceStorage": Integer,
    "VSwitchId": String,
    "AllocatePublicConnection": Boolean,
    "EngineVersion": String,
    "PreferredBackupTime": String,
    "DBInstanceClass": String,
    "SecurityIPList": String,
    "BackupRetentionPeriod": Integer,
    "PrivateIpAddress": String,
    "PreferredBackupPeriod": List,
    "PeriodType": String, 
    "PayType": String, 
    "Period": Integer,
    "ResourceGroupId": String
  }
}

Properties

Property Type Required Editable Description Constraint
ResourceGroupId String No No The ID of the resource group to which the RDS instance belongs. None
Engine String Yes No The database engine that the instance runs. Valid values: MySQL, SQLServer, PostgreSQL, and PPAS.
DBInstanceStorage Integer Yes Yes The storage capacity of the instance. The range of valid storage capacity values varies by database type.
  • Valid values for an ApsaraDB RDS for MySQL instance: 5 to 1000.
  • Valid values for an ApsaraDB RDS for SQL Server instance: 10 to 1000.
  • Valid values for an ApsaraDB RDS for PostgreSQL or PPAS instance: 5 to 2000.
Unit: GB. The storage capacity increases at increments of 5 GB.
EngineVersion String Yes No The version of the database engine that the instance runs. The range of valid engine version values varies by database type.
  • For an ApsaraDB RDS for MySQL instance, the valid values are 5.5, 5.6, 5.7, and 8.0.
  • For an ApsaraDB RDS for SQL Server instance, set the value to 2008r2.
  • For an ApsaraDB RDS for PostgreSQL instance, set the value to 9.4.
  • For an ApsaraDB RDS for PPAS instance, set the value to 9.3.
DBInstanceClass String Yes Yes The type of the instance. Examples of RDS instance types: rds.mys2.large, rds.mss1.large, and rds.pg.s1.small.
SecurityIPList String Yes Yes The whitelist of IP addresses that are allowed to access all databases in the instance.
  • Separate multiple IP addresses with commas (,). Each IP address in the whitelist must be unique. The whitelist can contain a maximum of 1,000 IP addresses.
  • Supported formats include 0.0.0.0/0, 10.23.XX.XX (IP address format), and 10.23.XX.XX/24 (CIDR format). /24 indicates the length of the prefix in the CIDR block, and a prefix length can be in the range of 1 to 32. 0.0.0.0/0 indicates that no access restriction is applied.
MultiAZ Boolean No No Specifies whether the instance can be deployed across multiple zones. None
VpcId String No No The ID of the VPC. None
DBMappings List No No The databases created in the instance. None
DBInstanceDescription String No No The description of the instance. The description must be 2 to 256 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
ConnectionMode String No No The access mode of the instance.
  • Valid values: Performance and Safty.
  • By default, the access mode assigned by the system is used.
MasterUsername String No No The name of the Apsara Stack tenant account for the instance. The name must be unique. It can be up to 16 characters in length and can contain lowercase letters, digits, and underscores (_). It must start with a lowercase letter.
MasterUserPassword String No No The password of the Apsara Stack tenant account for the instance. The password must be 6 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 network type of the instance. Valid values: Internet and Intranet. Default value: Intranet.
VSwitchId String No No The ID of the VSwitch in the specified VPC. None
AllocatePublicConnection Boolean No No Specifies whether to apply for a public connection string for the instance. None
PreferredBackupTime String No No The preferred 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 No The retention period of backup data. Unit: days. Valid values: 7 to 730. Default value: 7.
PrivateIpAddress String No No The private IP address of the instance on the specified VSwitch. If this parameter is not specified, the system automatically assigns a value.
PreferredBackupPeriod List No No The list of preferred backup periods. Valid values: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday.
MasterUserType String No No The user account type. Valid values: Normal and Super. Default value: Normal.
Tags Map No Yes The tags of the instance. Each tag consists of a TagKey and a TagValue.
  • The TagKey is required and the TagValue is optional.
  • Format example: {"key1":"value1","key2":""}.
PeriodType String No No The type of the billing cycle. Valid values: Month and Year. Default value: Month.
PayType String No No The billing method of the instance. Valid values: Postpaid and Prepaid.
Period Integer No No The subscription period of the instance. The subscription period varies with the PeriodType value.
  • Valid values when the PeriodType parameter is set to Year: 1 to 3.
  • Valid values when the PeriodType parameter is set to Month: 1 to 9.

DBMappings syntax

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

DBMappings properties

Property Type Required Editable Description Constraint
CharacterSetName String Yes No The character set of the database.
  • Valid values for a MySQL database: utf8, gbk, latin1, and utf8mb4 (applicable to versions 5.5 and 5.6).
  • Valid values for an SQL Server database: Chinese_PRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, and Chinese_PRC_BIN.
DBName String Yes No The name of the database. The name must be unique. It can be up to 64 characters in length and can contain lowercase letters, digits, and underscores (_). It must start with a lowercase letter.
DBDescription String No No The description of the database. The description must be 2 to 256 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.

Response parameters

Fn::GetAtt

  • DBInstanceId: the ID of the RDS instance.
  • InnerPort: the internal port of the RDS instance.
  • InnerIPAddress: the internal IP address of the RDS instance.
  • InnerConnectionString: the internal connection string of the RDS instance.
  • PublicPort: the public port of the RDS instance.
  • PublicConnectionString: the public connection string of the RDS instance.
  • PublicIPAddress: the public IP address of the RDS instance.

Examples

The following example demonstrates how to create an ApsaraDB for RDS instance in the classic network:
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Database": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "Engine": "MySQL",
        "EngineVersion": "5.6",
        "DBInstanceClass":"rds.mysql.t1.small",
        "DBInstanceStorage": 10,
        "DBInstanceNetType": "Internet",
        "SecurityIPList": "0.0.0.0/0",
        "MasterUsername": "A****",
        "DBMappings":[{
            "DBName": "hope",
            "CharacterSetName": "utf8"
        }]
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Value": {"get_attr": ["DBInstanceId"]}
    },
    "PublicConnectionString": {
      "Value": {"get_attr": ["ConnectionString"]}
    },
    "PublicPort": {
      "Value": {"get_attr": ["Port"]}
    }
  }
}
The following example demonstrates how to create an ApsaraDB for RDS instance in a VPC:
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "Database": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "Engine":"MySQL",
        "EngineVersion":"5.6",
        "DBInstanceClass":"rds.mys2.small",
        "DBInstanceStorage":"10",
        "DBInstanceNetType":"Intranet",
        "SecurityIPList": "0.0.0.0/0",
        "VSwitchId": "ttt",
        "VpcId": "myvp****"
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Value": {"get_attr": ["DBInstanceId"]}
    },
    "InnerConnectionString": {
      "Value": {"get_attr": ["ConnectionString"]}
    },
    "InnerPort": {
      "Value": {"get_attr": ["Port"]}
    }
  }
}