ALIYUN::RDS::ReadOnlyDBInstance类型用于为某个实例创建一个只读实例。

语法

{
  "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
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
Category String 实例类别。 取值:Basic(基础版)、HighAvailability(高可用版)、AlwaysOn(集群版)。
VPCId String 专有网络ID。 无。
DBInstanceDescription String 实例描述。 长度为2~256个字符。以中文、英文字母开头,可以包含数字、中文、英文、下划线(_)、短横线(-),不能以http://或https://开头。
Tags Map 实例标签。 键值对形式,示例:{"key1": "value1","key2": "value2", ... "key5": "value5"}。最多设置5个键值对。Key最大长度为64个字符,不能以http://或https://开头;Value最大长度为128个字符,不能以aliyun、http://、https://开头。
EngineVersion String 数据库版本号。 必须与主实例的版本保持一致。取值:5.6、5.7、8.0、2017_ent。
DBInstanceId String 主实例ID。 无。
PayType String 付费类型。 仅支持按量付费。取值:Postpaid。
ZoneId String 可用区ID。 无。
ResourceGroupId String 资源组ID。 无。
DBInstanceStorage Integer 存储空间。 单位:GB。取值范围:5~3000,每5GB进行递增。不同版本实例,支持的取值范围不同,详情请参见主实例规格表
VSwitchId String 交换机ID。 无。
DBInstanceStorageType String 实例储存类型。 取值:local_ssd/ephemeral_ssd(本地SSD盘)、cloud_ssd(SSD云盘)、cloud_essd(ESSD云盘)。SQL仅支持本地盘存储类型;MySQL Server仅支持云盘存储类型。
DBInstanceClass String 实例规格。 详情请参见主实例规格表。建议只读实例规格不小于主实例规格,否则容易出现只读实例延迟高、负载高等现象。
PrivateIpAddress String 只读实例的内网IP。 需要在指定交换机的IP地址范围内。系统默认通过VPCId和VSwitchId自动分配。

返回值

Fn::GetAtt

  • ConnectionString:创建的只读实例内网数据库连接地址。
  • DBInstanceId:创建的只读实例ID。
  • Port:创建的只读实例内网数据库连接端口。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "ReadOnlyDBInstance": {
      "Type": "ALIYUN::RDS::ReadOnlyDBInstance",
      "Properties": {
        "Category": {
          "Ref": "Category"
        },
        "VPCId": {
          "Ref": "VPCId"
        },
        "DBInstanceDescription": {
          "Ref": "DBInstanceDescription"
        },
        "Tags": {
          "Ref": "Tags"
        },
        "DBInstanceStorageType": {
          "Ref": "DBInstanceStorageType"
        },
        "DBInstanceId": {
          "Ref": "DBInstanceId"
        },
        "PayType": {
          "Ref": "PayType"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "DBInstanceStorage": {
          "Ref": "DBInstanceStorage"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "EngineVersion": {
          "Ref": "EngineVersion"
        },
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "PrivateIpAddress": {
          "Ref": "PrivateIpAddress"
        }
      }
    }
  },
  "Parameters": {
    "Category": {
      "Type": "String",
      "Description": "The edition of the instance. Valid values:\n- Basic\n- HighAvailability\n- AlwaysOn",
      "AllowedValues": [
        "Basic",
        "HighAvailability",
        "AlwaysOn"
      ]
    },
    "VPCId": {
      "Type": "String",
      "Description": "The ID of the VPC."
    },
    "DBInstanceDescription": {
      "Type": "String",
      "Description": "Description of created database instance."
    },
    "Tags": {
      "Type": "Json",
      "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\"}.\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."
    },
    "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."
    },
    "PayType": {
      "Default": "Postpaid",
      "Type": "String",
      "Description": "The billing method. The system only supports Pay-As-You-Go. Valid value: Postpaid.",
      "AllowedValues": [
        "Postpaid"
      ]
    },
    "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."
    },
    "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."
    },
    "VSwitchId": {
      "Type": "String",
      "Description": "The ID of the VSwitch."
    },
    "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"
      ]
    },
    "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."
    },
    "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."
    }
  },
  "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"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  ReadOnlyDBInstance:
    Type: ALIYUN::RDS::ReadOnlyDBInstance
    Properties:
      Category:
        Ref: Category
      VPCId:
        Ref: VPCId
      DBInstanceDescription:
        Ref: DBInstanceDescription
      Tags:
        Ref: Tags
      DBInstanceStorageType:
        Ref: DBInstanceStorageType
      DBInstanceId:
        Ref: DBInstanceId
      PayType:
        Ref: PayType
      ZoneId:
        Ref: ZoneId
      ResourceGroupId:
        Ref: ResourceGroupId
      DBInstanceStorage:
        Ref: DBInstanceStorage
      VSwitchId:
        Ref: VSwitchId
      EngineVersion:
        Ref: EngineVersion
      DBInstanceClass:
        Ref: DBInstanceClass
      PrivateIpAddress:
        Ref: PrivateIpAddress
Parameters:
  Category:
    Type: String
    Description:
      The edition of the instance. Valid values:
      - Basic
      - HighAvailability
      - AlwaysOn
    AllowedValues:
    - Basic
    - HighAvailability
    - AlwaysOn
  VPCId:
    Type: String
    Description: The ID of the VPC.
  DBInstanceDescription:
    Type: String
    Description: Description of created database instance.
  Tags:
    Type: Json
    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.
  DBInstanceStorageType:
    Type: String
    Descriptio
      The storage type of the instance. Valid values:
      - local_ssd/ephemeral_ssd: local SSDs.
      - cloud_ssd: SSDs.
      - cloud_essd: ESSDs.
    AllowedValues:
    - local_ssd/ephemeral_ssd
    - cloud_ssd
    - cloud_essd
  DBInstanceId:
    Type: String
    Description: The ID of the master instance.
  PayType:
    Default: Postpaid
    Type: String
    Description: 'The billing method. The system only supports Pay-As-You-Go. Valid
      value: Postpaid.'
    AllowedValues:
    - Postpaid
  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.
  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.'
  VSwitchId:
    Type: String
    Description: The ID of the VSwitch.
  EngineVersion:
    Type: String
    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
    AllowedValues:
    - '5.6'
    - '5.7'
    - '8.0'
    - 2017_ent
  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.
  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.
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