ALIYUN::RDS::ReadOnlyDBInstance is used to create a read-only ApsaraDB RDS instance.

Syntax

{
  "Type": "ALIYUN::RDS::ReadOnlyDBInstance",
  "Properties": {
    "Category": String,
    "VPCId": String,
    "DBInstanceDescription": String,
    "Tags": Map,
    "EngineVersion": String,
    "DBInstanceId": String,
    "PayType": String,
    "ZoneId": String,
    "ResourceGroupId": String,
    "DBInstanceStorage": Integer,
    "VSwitchId": String,
    "DBInstanceStorageType": String,
    "DBInstanceClass": String,
    "PrivateIpAddress": String,
    "PeriodType": String,
    "Period": Integer,
    "AutoRenew": Boolean
  }
}

Properties

Property Type Required Editable Description Constraint
Category String No No The edition of the read-only instance. Default value: HighAvailability. Valid values:
  • Basic: Basic Edition
  • HighAvailability: High-availability Edition.
  • AlwaysOn: Cluster Edition
VPCId String No No The ID of the virtual private cloud (VPC) in which the read-only instance runs. None
DBInstanceDescription String No No The description of the read-only 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 (-).
Tags Map No Yes The tags of the read-only instance. The tags are in the key-value pair format. For example:
{"key1": "value1","key2": "value2", ... "key5": "value5"}
A maximum of five key-value pairs can be specified. A tag key can be up to 64 characters in length and cannot start with http:// or https://. A tag value can be up to 128 characters in length and cannot start with aliyun, http://, or https://.
EngineVersion String Yes No The database engine version of the read-only instance. The database engine version of the read-only instance must be the same as that of the primary instance.
Valid values:
  • Valid values when the database engine is MySQL:
    • 5.6
    • 5.7
    • 8.0
  • Valid values when the database engine is SQL Server: 2017_ent
DBInstanceId String Yes No The ID of the primary instance. None
PayType String No No The billing method of the read-only instance. Only the pay-as-you-go billing method is supported.

Set the value to Postpaid.

ZoneId String Yes No The ID of the zone in which to create the read-only instance. You can call the DescribeRegions operation to query the most recent list of zones.
ResourceGroupId String No No The ID of the resource group. None
DBInstanceStorage Integer Yes Yes The storage capacity of the read-only instance. Unit: GB.

Valid values: 5 to 3000. This value must be a multiple of 5.

Instances of different versions have different value ranges. For more information, see Primary ApsaraDB RDS instance types.
VSwitchId String No No The ID of the vSwitch of the read-only instance. None
DBInstanceStorageType String No No The storage type of the read-only instance. Valid values:
  • local_ssd or ephemeral_ssd: local SSD
  • cloud_ssd: standard SSD
  • cloud_essd: enhanced SSD (ESSD)
Note A read-only MySQL instance can only use local SSDs, and a read-only SQL Server instance can only use standard SSDs or enhanced SSDs.
DBInstanceClass String Yes Yes The instance type of the read-only instance. For more information, see Primary ApsaraDB RDS instance types.

We recommend that you specify an instance type higher than or equal to that of the primary instance. If the instance type of the read-only instance is lower than that of the primary instance, the read-only instance may encounter issues such as high latency and heavy load.

PrivateIpAddress String No No The private IP address of the read-only instance. It must be within the IP address range of the specified vSwitch. The system automatically assigns a private IP address to the instance based on the values of the VPCId and VSwitchId parameters.
PeriodType String No No The unit of the subscription period of the read-only instance. Valid values:
  • Year
  • Month
Period Integer No No The subscription period of the read-only instance. Valid values:
  • Valid values when PeriodType is set to Year: 1 to 3.
  • Valid values when PeriodType is set to Month: 1 to 9.
AutoRenew Boolean No No Specifies whether to enable auto-renewal for the read-only instance.

This parameter is required only when the read-only instance uses the subscription billing method.

Default value: false. Valid values:
  • true: enables auto-renewal.
  • False: disables auto-renewal.
Note
  • If you set the PeriodType parameter to Month, the auto-renewal cycle is one month.
  • If you set the PeriodType parameter to Year, the auto-renewal cycle is one year.

Response parameters

Fn::GetAtt

  • ConnectionString: the internal endpoint of the read-only instance.
  • DBInstanceId: the ID of the read-only instance.
  • Port: the internal port of the read-only instance.

Examples

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "PeriodType": {
      "Type": "String",
      "Description": "Charge period for created instances.",
      "AllowedValues": [
        "Month",
        "Year"
      ],
      "Default": "Month"
    },
    "Category": {
      "Type": "String",
      "Description": "The edition of the instance. Valid values:\n- Basic\n- HighAvailability\n- AlwaysOn",
      "AllowedValues": [
        "Basic",
        "HighAvailability",
        "AlwaysOn"
      ]
    },
    "EngineVersion": {
      "Type": "String",
      "Description": "The version of the database. The database and the master instance must have the same database version. Valid values:\n- 5.6\n- 5.7\n- 8.0\n- 2017_ent",
      "AllowedValues": [
        "5.6",
        "5.7",
        "8.0",
        "2017_ent"
      ]
    },
    "PrivateIpAddress": {
      "Type": "String",
      "Description": "The private IP address of the read-only instance. It must be within the IP address range provided by the switch. The system automatically assigns an IP address based on the VPCId and VSwitchId by default."
    },
    "ZoneId": {
      "Type": "String",
      "Description": "The ID of the zone. You can call the DescribeRegions API operation to view the latest zones."
    },
    "ResourceGroupId": {
      "Type": "String",
      "Description": "Resource group id."
    },
    "VPCId": {
      "Type": "String",
      "Description": "The ID of the VPC."
    },
    "DBInstanceClass": {
      "Type": "String",
      "Description": "The type of the instance. For more information, see Instance type list. The type of the read-only instance must be no less than that of the master instance. Otherwise, the read-only instance incurs high latency and high load."
    },
    "VSwitchId": {
      "Type": "String",
      "Description": "The ID of the VSwitch."
    },
    "AutoRenew": {
      "Type": "Boolean",
      "Description": "Specifies whether to enable auto-renewal. Valid values: true and false. Note\n:Monthly subscription: The auto-renewal cycle is one month.\nAnnual subscription: The auto-renewal cycle is one year.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ]
    },
    "Period": {
      "Type": "Number",
      "Description": "Prepaid time period. While choose by pay by month, it could be from 1 to 9. While choose pay by year, it could be from 1 to 3.",
      "MinValue": 1,
      "MaxValue": 9,
      "Default": 1
    },
    "PayType": {
      "Type": "String",
      "Description": "The billing method. Valid value: Postpaid, Prepaid.",
      "AllowedValues": [
        "Prepaid",
        "Postpaid"
      ],
      "Default": "Postpaid"
    },
    "DBInstanceStorageType": {
      "Type": "String",
      "Description": "The storage type of the instance. Valid values:\n- local_ssd/ephemeral_ssd: local SSDs.\n- cloud_ssd: SSDs.\n- cloud_essd: ESSDs.",
      "AllowedValues": [
        "local_ssd",
        "ephemeral_ssd",
        "cloud_ssd",
        "cloud_essd"
      ]
    },
    "DBInstanceId": {
      "Type": "String",
      "Description": "The ID of the master instance."
    },
    "DBInstanceStorage": {
      "Type": "Number",
      "Description": "The storage space of the instance. Value range: 5 to 3000. The value must be a multiple of 5. Unit: GB."
    },
    "DBInstanceDescription": {
      "Type": "String",
      "Description": "Description of created database instance."
    },
    "Tags": {
      "Type": "Json",
      "Description": "The tags of an instance.\nYou should input the information of the tag with the format of the Key-Value, such as {\"key1\":\"value1\",\"key2\":\"value2\", ... \"key5\":\"value5\"}.\nAt most 5 tags can be specified.\nKey\nIt can be up to 64 characters in length.\nCannot begin with aliyun.\nCannot begin with http:// or https://.\nCannot be a null string.\nValue\nIt can be up to 128 characters in length.\nCannot begin with aliyun.\nCannot begin with http:// or https://.\nCan be a null string."
    }
  },
  "Resources": {
    "ReadOnlyDBInstance": {
      "Type": "ALIYUN::RDS::ReadOnlyDBInstance",
      "Properties": {
        "PeriodType": {
          "Ref": "PeriodType"
        },
        "Category": {
          "Ref": "Category"
        },
        "EngineVersion": {
          "Ref": "EngineVersion"
        },
        "PrivateIpAddress": {
          "Ref": "PrivateIpAddress"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "VPCId": {
          "Ref": "VPCId"
        },
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "AutoRenew": {
          "Ref": "AutoRenew"
        },
        "Period": {
          "Ref": "Period"
        },
        "PayType": {
          "Ref": "PayType"
        },
        "DBInstanceStorageType": {
          "Ref": "DBInstanceStorageType"
        },
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "DBInstanceStorage": {
          "Ref": "DBInstanceStorage"
        },
        "DBInstanceDescription": {
          "Ref": "DBInstanceDescription"
        },
        "Tags": {
          "Ref": "Tags"
        }
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Description": "The instance id of created database instance.",
      "Value": {
        "Fn::GetAtt": [
          "ReadOnlyDBInstance",
          "DBInstanceId"
        ]
      }
    },
    "Port": {
      "Description": "Intranet port of created DB instance.",
      "Value": {
        "Fn::GetAtt": [
          "ReadOnlyDBInstance",
          "Port"
        ]
      }
    },
    "ConnectionString": {
      "Description": "DB instance connection url by Intranet.",
      "Value": {
        "Fn::GetAtt": [
          "ReadOnlyDBInstance",
          "ConnectionString"
        ]
      }
    }
  }
}

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  AutoRenew:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Description: 'Specifies whether to enable auto-renewal. Valid values: true and
      false. Note

      :Monthly subscription: The auto-renewal cycle is one month.

      Annual subscription: The auto-renewal cycle is one year.'
    Type: Boolean
  Category:
    AllowedValues:
    - Basic
    - HighAvailability
    - AlwaysOn
    Description: 'The edition of the instance. Valid values:

      - Basic

      - HighAvailability

      - AlwaysOn'
    Type: String
  DBInstanceClass:
    Description: The type of the instance. For more information, see Instance type
      list. The type of the read-only instance must be no less than that of the master
      instance. Otherwise, the read-only instance incurs high latency and high load.
    Type: String
  DBInstanceDescription:
    Description: Description of created database instance.
    Type: String
  DBInstanceId:
    Description: The ID of the master instance.
    Type: String
  DBInstanceStorage:
    Description: 'The storage space of the instance. Value range: 5 to 3000. The value
      must be a multiple of 5. Unit: GB.'
    Type: Number
  DBInstanceStorageType:
    AllowedValues:
    - local_ssd
    - ephemeral_ssd
    - cloud_ssd
    - cloud_essd
    Description: 'The storage type of the instance. Valid values:

      - local_ssd/ephemeral_ssd: local SSDs.

      - cloud_ssd: SSDs.

      - cloud_essd: ESSDs.'
    Type: String
  EngineVersion:
    AllowedValues:
    - '5.6'
    - '5.7'
    - '8.0'
    - 2017_ent
    Description: 'The version of the database. The database and the master instance
      must have the same database version. Valid values:

      - 5.6

      - 5.7

      - 8.0

      - 2017_ent'
    Type: String
  PayType:
    AllowedValues:
    - Prepaid
    - Postpaid
    Default: Postpaid
    Description: 'The billing method. Valid value: Postpaid, Prepaid.'
    Type: String
  Period:
    Default: 1
    Description: Prepaid time period. While choose by pay by month, it could be from
      1 to 9. While choose pay by year, it could be from 1 to 3.
    MaxValue: 9
    MinValue: 1
    Type: Number
  PeriodType:
    AllowedValues:
    - Month
    - Year
    Default: Month
    Description: Charge period for created instances.
    Type: String
  PrivateIpAddress:
    Description: The private IP address of the read-only instance. It must be within
      the IP address range provided by the switch. The system automatically assigns
      an IP address based on the VPCId and VSwitchId by default.
    Type: String
  ResourceGroupId:
    Description: Resource group id.
    Type: String
  Tags:
    Description: 'The tags of an instance.

      You should input the information of the tag with the format of the Key-Value,
      such as {"key1":"value1","key2":"value2", ... "key5":"value5"}.

      At most 5 tags can be specified.

      Key

      It can be up to 64 characters in length.

      Cannot begin with aliyun.

      Cannot begin with http:// or https://.

      Cannot be a null string.

      Value

      It can be up to 128 characters in length.

      Cannot begin with aliyun.

      Cannot begin with http:// or https://.

      Can be a null string.'
    Type: Json
  VPCId:
    Description: The ID of the VPC.
    Type: String
  VSwitchId:
    Description: The ID of the VSwitch.
    Type: String
  ZoneId:
    Description: The ID of the zone. You can call the DescribeRegions API operation
      to view the latest zones.
    Type: String
Resources:
  ReadOnlyDBInstance:
    Properties:
      AutoRenew:
        Ref: AutoRenew
      Category:
        Ref: Category
      DBInstanceClass:
        Ref: DBInstanceClass
      DBInstanceDescription:
        Ref: DBInstanceDescription
      DBInstanceId:
        Ref: DBInstanceId
      DBInstanceStorage:
        Ref: DBInstanceStorage
      DBInstanceStorageType:
        Ref: DBInstanceStorageType
      EngineVersion:
        Ref: EngineVersion
      PayType:
        Ref: PayType
      Period:
        Ref: Period
      PeriodType:
        Ref: PeriodType
      PrivateIpAddress:
        Ref: PrivateIpAddress
      ResourceGroupId:
        Ref: ResourceGroupId
      Tags:
        Ref: Tags
      VPCId:
        Ref: VPCId
      VSwitchId:
        Ref: VSwitchId
      ZoneId:
        Ref: ZoneId
    Type: ALIYUN::RDS::ReadOnlyDBInstance
Outputs:
  ConnectionString:
    Description: DB instance connection url by Intranet.
    Value:
      Fn::GetAtt:
      - ReadOnlyDBInstance
      - ConnectionString
  DBInstanceId:
    Description: The instance id of created database instance.
    Value:
      Fn::GetAtt:
      - ReadOnlyDBInstance
      - DBInstanceId
  Port:
    Description: Intranet port of created DB instance.
    Value:
      Fn::GetAtt:
      - ReadOnlyDBInstance
      - Port

To view more examples, visit DBInstance.json and DBInstance.yml. In the examples, the following resource types are involved: ALIYUN::RDS::DBInstance, ALIYUN::RDS::Account, ALIYUN::RDS::AccountPrivilege, ALIYUN::RDS::DBInstanceParameterGroup, ALIYUN::RDS::DBInstanceSecurityIps, and ALIYUN::RDS::Database.