All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::RDS::ReadOnlyDBInstance

Last Updated:Nov 16, 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,
    "TargetDedicatedHostIdForMaster": String,
    "DeletionProtection": Boolean,
    "DedicatedHostGroupId": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

Category

String

No

No

The instance edition.

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 instance description.

The instance description. must be 2 to 256 characters in length and can contain letters, digits, underscores (_), and hyphens (-). The description must start with a letter but 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 version of the database engine.

The database engine version of the read-only instance must be the same as the database engine version of the primary instance.

  • Valid values when the database engine is MySQL:

    • 5.6

    • 5.7

    • 8.0

  • Valid value 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: standard 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 ESSDs 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 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.

TargetDedicatedHostIdForMaster

String

No

No

The ID of the host on which the primary instance resides. This property takes effect when you create the read-only instance in a dedicated cluster.

None.

DeletionProtection

Boolean

No

No

Specifies whether to enable the release protection feature for the read-only instance.

Valid values:

  • true:

  • false (default)

Note

You can enable the release protection feature for instances that are billed on the pay-as-you-go basis.

DedicatedHostGroupId

String

No

No

The ID of the dedicated cluster to which the read-only instance belongs. This property is valid when you create the read-only instance in a dedicated cluster.

None.

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: 'MySQL: 5.5, 5.6, 5.7, 5.8, SQLServer: 2008r2, PostgreSQL: 9.4'
    Default: '5.6'
  DBInstanceClass:
    Type: String
    Description: Instance Class
    Default: rds.mysql.s2.large
  DBInstanceStorage:
    Type: Number
    Description: MySQL: 5-1000, SQLServer: 10-1000, others: 5-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": "MySQL: 5.5, 5.6, 5.7, 5.8, SQLServer: 2008r2, PostgreSQL: 9.4",
      "Default": "5.6"
    },
    "DBInstanceClass": {
      "Type": "String",
      "Description": "Instance Class",
      "Default": "rds.mysql.s2.large"
    },
    "DBInstanceStorage": {
      "Type": "Number",
      "Description": "MySQL:5-1000, SQLServer: 10-1000, others: 5-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"
        ]
      }
    }
  }
}