All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::RDS::ReadOnlyDBInstance

Last Updated:May 17, 2023

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.

Valid values:

  • Basic: Basic Edition

  • HighAvailability (default): High-availability Edition

  • AlwaysOn: Cluster Edition

VPCId

String

No

No

The virtual private cloud (VPC) ID of the read-only instance.

None.

DBInstanceDescription

String

No

No

The description of the read-only instance.

The description must be 2 to 256 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The description must start with a letter and cannot start with http:// or https://.

Tags

Map

No

Yes

The tags of the read-only instance.

The tags are in the key-value pair format. Example:

{"key1": "value1","key2": "value2", ... "key5": "value5"}

You can specify up to five key-value pairs. 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 the database engine version 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 zone ID of the read-only instance.

You can call the DescribeRegions operation to query the most recent zone list.

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. The 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 vSwitch ID 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: SSD

  • cloud_essd: enhanced SSD (ESSD)

Note

You can use only local SSDs for read-only ApsaraDB RDS for MySQL instances, and use only standard SSDs or enhanced SSDs for read-only ApsaraDB RDS for SQL Server instances.

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 the instance type 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.

The private IP address must be within the IP address range of the vSwitch that you specify. The system automatically assigns a private IP address to the instance based on the values of VPCId and VSwitchId.

PeriodType

String

No

No

The unit of the subscription duration of the read-only instance.

Valid values:

  • Year

  • Month

Period

Integer

No

No

The subscription duration 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 property takes effect only when the read-only instance uses the subscription billing method.

Valid values:

  • true

  • false (default)

Note
  • If you set PeriodType to Month, the auto-renewal cycle is one month.

  • If you set PeriodType to Year, the auto-renewal cycle is one year.

Return values

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

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  DBInstanceId:
    Type: String
    Description: The ID of the master instance.
  ZoneId:
    Type: String
    Description: Create an Availability Zone for an instance to ensure that the Availability Zone supports the creation of rds resource specifications.
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    Label: Zone ID
  VPC:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description: Please search the ID starts with (vpc-xxx)from console-Virtual Private Cloud
    Label: Existing VPC Instance ID
  VSwitch:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    Type: String
    Description: Please search the business VSwitch ID starts with(vsw-xxx)from console-Virtual Private Cloud-VSwitches
    Label: Existing VSwitch ID
    AssociationPropertyMetadata:
      VpcId: VPC
      ZoneId: ZoneId
  EngineVersion:
    Type: String
    Description: 'Valid values when the database engine is MySQL: 5.5, 5.6, 5.7, and 5.8. Valid values when the database engine is SQL Server: 2008r2. Valid values when the database engine is PostgreSQL: 9.4'
    Default: '5.6'
  DBInstanceClass:
    Type: String
    Description: Instance Class
    Default: rds.mysql.s2.large
  DBInstanceStorage:
    Type: Number
    Description: Valid values when the database engine is MySQL: 5 to 1000. Valid values when the database engine is SQL Server: 10 to 1000. Valid values when the database engine is of another type: 5 to 2000
    Default: 40
Resources:
  ReadOnlyDBInstance:
    Type: ALIYUN::RDS::ReadOnlyDBInstance
    DependsOn: RDSInstance
    Properties:
      VPCId:
        Ref: VPC
      DBInstanceId:
        Ref: DBInstanceId
      ZoneId:
        Ref: ZoneId
      DBInstanceStorage:
        Ref: DBInstanceStorage
      VSwitchId:
        Ref: VSwitch
      EngineVersion:
        Ref: EngineVersion
      DBInstanceClass:
        Ref: DBInstanceClass
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

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "DBInstanceId": {
      "Type": "String",
      "Description": "The ID of the master instance."
    },
    "ZoneId": {
      "Type": "String",
      "Description": "Create an Availability Zone for an instance to ensure that the Availability Zone supports the creation of rds resource specifications.",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "Label": "Zone ID"
    },
    "VPC": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": "Please search the ID starts with (vpc-xxx)from console-Virtual Private Cloud",
      "Label": "Existing VPC Instance ID"
    },
    "VSwitch": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "Type": "String",
      "Description": "Please search the business VSwitch ID starts with(vsw-xxx)from console-Virtual Private Cloud-VSwitches",
      "Label": "Existing VSwitch ID",
      "AssociationPropertyMetadata": {
        "VpcId": "VPC",
        "ZoneId": "ZoneId"
      }
    },
    "EngineVersion": {
      "Type": "String",
      "Description": "Valid values when the database engine is MySQL: 5.5, 5.6, 5.7, and 5.8. Valid values when the database engine is SQL Server: 2008r2. Valid values when the database engine is PostgreSQL: 9.4",
      "Default": "5.6"
    },
    "DBInstanceClass": {
      "Type": "String",
      "Description": "Instance Class",
      "Default": "rds.mysql.s2.large"
    },
    "DBInstanceStorage": {
      "Type": "Number",
      "Description": "Valid values when the database engine is MySQL: 5 to 1000. Valid values when the database engine is SQL Server: 10 to 1000. Valid values when the database engine is of another type: 5 to 2000",
      "Default": 40
    }
  },
  "Resources": {
    "ReadOnlyDBInstance": {
      "Type": "ALIYUN::RDS::ReadOnlyDBInstance",
      "DependsOn": "RDSInstance",
      "Properties": {
        "VPCId": {
          "Ref": "VPC"
        },
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "DBInstanceStorage": {
          "Ref": "DBInstanceStorage"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "EngineVersion": {
          "Ref": "EngineVersion"
        },
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        }
      }
    }
  },
  "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"
        ]
      }
    }
  }
}