edit-icon download-icon

ALIYUN::RDS::DBInstance

Last Updated: Jun 13, 2018

The ALIYUN::RDS::DBInstance type is used to create a database instance.

Syntax

  1. {
  2. "Type" : "ALIYUN::RDS::DBInstance",
  3. "Properties" : {
  4. "Engine" : String,
  5. "MultiAZ" : Boolean,
  6. "VpcId" : String,
  7. "DBMappings" : List,
  8. "DBInstanceDescription" : String,
  9. "ConnectionMode" : String,
  10. "MasterUsername" : String,
  11. "MasterUserPassword" : String,
  12. "ZoneId" : String,
  13. "DBInstanceNetType" : String,
  14. "DBInstanceStorage" : Integer,
  15. "VSwitchId" : String,
  16. "AllocatePublicConnection" : Boolean,
  17. "EngineVersion" : String,
  18. "PreferredBackupTime" : String,
  19. "DBInstanceClass" : String,
  20. "SecurityIPList" : String,
  21. "BackupRetentionPeriod" : Integer,
  22. "PrivateIpAddress" : String,
  23. "PreferredBackupPeriod" : List
  24. }
  25. }

Properties

Name Type Required Update allowed Description Constraint
Engine string Yes No Data type. Value options: MySQL, SQLServer, PostgreSQL, and PPAS.
DBInstanceStorage integer Yes Yes Database storage space. Value range: [5, 1000] for MySQL; [10, 1000] for SQL Server; [5, 2000] for PostgreSQL and PPAS. The increment is 5 GB. Unit: GB.
EngineVersion string Yes No Database version. Value options: 5.5, 5.6, 2008r2, 9.4, and 9.3.

MySQL: 5.5/5.6;

SQLServer: 2008r2;

PostgreSQL: 9.4;

PPAS: 9.3.
DBInstanceClass string Yes Yes Instance type. Examples: rds.mys2.large, rds.mss1.large, and rds.pg.s1.small.
SecurityIPList string Yes Yes List of IP addresses allowed to access all databases of the instance. The IP addresses are separated by commas(,) and cannot be repeated. The list contains up to 1,000 IP addresses. Supported format: 0.0.0.0/0, such as, 10.23.12.24 (IP) and 10.23.12.24/24 (CIDR mode; classless inter-domain routing. “/24” represents the length of the prefix of an IP address. The range of the prefix length is [1, 32]). 0.0.0.0/0 indicates that no access restriction is applied.
MultiAZ boolean No No Whether the database instance supports multiple zones. N/A
VpcId string No No VPC ID. N/A
DBMappings list No No Databases created in the instance. N/A
DBInstanceDescription string No No Instance description or remarks. The parameter value is a string of 2 to 256 characters. It must start with a Chinese character or an English letter, and cannot start with http:// or https://. It can include English letters, numbers, underscores(), and hyphens(-).
ConnectionMode string No No Database connection mode. Value options: Performance and Safety. “Performance” is the standard access mode, whereas “Safety” is the advanced security access mode. If this parameter is not specified, the database connection mode is automatically specified by the ApsaraDB for RDS instance.
MasterUsername string No No Name of the primary account of the database instance. The primary account name requires a uniqueness check. It must start with an English letter and contain a maximum of 16 characters including lowercase letters, numbers, and underscores().
MasterUserPassword string No No Password of the primary account of the database instance. The password is a string of 6 to 32 characters and must contain English letters, numbers, and underscores(_).
ZoneId string No No Zone ID. N/A
DBInstanceNetType string No No Network type of the database instance. Value options: Internet and intranet. The Internet type is used by access from the public network, whereas the intranet type is used by access from the private network. The default value is intranet.
VSwitchId string No No ID of the VSwitch in VPC. N/A
AllocatePublicConnection boolean No No Whether to apply for an Internet connection string of the instance. N/A
PreferredBackupTime string No No Backup time. Format: HH:mmZ- HH:mm Z. Value options: 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 Backup retention period, measured in days. Value range: [7, 730]. Default value: 7.
PrivateIpAddress string No No Private IP address associated with the VSwitch ID. If it is not specified, the private IP address is automatically allocated by the system.
PreferredBackupPeriod list No No Backup cycle. Value options: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday.

DBMappings syntax

  1. "DBMappings" : [
  2. {
  3. "DBDescription" : String,
  4. "CharacterSetName" : String,
  5. "DBName" : String
  6. }
  7. ]

DBMappings properties

Name Type Required Update allowed Description Constraint
CharacterSetName string Yes No Character set. Value options: utf8, gbk, latin1, utf8mb4, ChinesePRC_CI_AS, Chinese_PRC_CS_AS, SQL_Latin1_General_CP1_CI_AS, SQL_Latin1_General_CP1_CS_AS, and Chinese_PRC_BIN.

MySQL: utf8, gbk, latin1, and utf8mb4 (applicable to 5.5 and 5.6).

SQL Server: 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 Database name. The database name requires a uniqueness check. It must start with a letter and can contain lowercase letters, numbers, and underscores. The maximum length is 64 characters.
DBDescription string No No Database description. The parameter is a string of 2 to 256 characters including English letters, numbers, underscores(_), and hyphens(-). It cannot start with http:// or https://.

Return values

Fn::GetAtt

  • DBInstanceId: ID of the database instance.

  • InnerPort: internal port of the database instance.

  • InnerIPAddress: internal IP address.

  • InnerConnectionString: intranet connection string.

  • PublicPort: public port of the database instance.

  • PublicConnectionString: Internet connection string.

  • PublicIPAddress: public IP address.

Example

Create an ApsaraDB for RDS instance.

  1. {
  2. "ROSTemplateFormatVersion" : "2015-09-01",
  3. "Resources" : {
  4. "Database": {
  5. "Type": "ALIYUN::RDS::DBInstance",
  6. "Properties": {
  7. "Engine":"MySQL",
  8. "EngineVersion":"5.6",
  9. "DBInstanceClass":"rds.mysql.t1.small",
  10. "DBInstanceStorage":"10",
  11. "DBInstanceNetType":"Intranet",
  12. "SecurityIPList": "0.0.0.0/0",
  13. "MasterUsername": "hope",
  14. "DBMappings":[{
  15. "DBName": "hope",
  16. "CharacterSetName": "utf8"
  17. }]
  18. }
  19. }
  20. },
  21. "Outputs": {
  22. "DBInstanceId": {
  23. "Value" : {"get_attr": ["DBInstanceId"]}
  24. },
  25. "PublicConnectionString": {
  26. "Value" : {"get_attr": ["ConnectionString"]}
  27. },
  28. "PublicPort": {
  29. "Value" : {"get_attr": ["Port"]}
  30. }
  31. }
  32. }

Create an ApsaraDB for RDS instance in VPC.

  1. {
  2. "ROSTemplateFormatVersion" : "2015-09-01",
  3. "Resources" : {
  4. "Database": {
  5. "Type": "ALIYUN::RDS::DBInstance",
  6. "Properties": {
  7. "Engine":"MySQL",
  8. "EngineVersion":"5.6",
  9. "DBInstanceClass":"rds.mys2.small",
  10. "DBInstanceStorage":"10",
  11. "DBInstanceNetType":"Intranet",
  12. "SecurityIPList": "0.0.0.0/0",
  13. "VSwitchId": "ttt",
  14. "VpcId": "myvpc_id"
  15. }
  16. }
  17. },
  18. "Outputs": {
  19. "DBInstanceId": {
  20. "Value" : {"get_attr": ["DBInstanceId"]}
  21. },
  22. "InnerConnectionString": {
  23. "Value" : {"get_attr": ["ConnectionString"]}
  24. },
  25. "InnerPort": {
  26. "Value" : {"get_attr": ["Port"]}
  27. }
  28. }
  29. }
Thank you! We've received your feedback.