ALIYUN::SELECTDB::DBInstance

ALIYUN::SELECTDB::DBInstance类型用于创建一个云数据库SelectDB版实例。

语法

{
  "Type": "ALIYUN::SELECTDB::DBInstance",
  "Properties": {
    "CacheSize": Integer,
    "ChargeType": String,
    "DBInstanceClass": String,
    "EngineVersion": String,
    "VSwitchId": String,
    "VpcId": String,
    "ZoneId": String,
    "AccountPassword": String,
    "ConnectionString": String,
    "DBInstanceDescription": String,
    "Engine": String,
    "Period": String,
    "ResourceGroupId": String,
    "SecurityIPList": List,
    "Tags": List,
    "UsedTime": Integer
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

CacheSize

Integer

预留缓存大小。

无。

ChargeType

String

实例的付费类型。

取值:

  • Postpaid:后付费(按量付费)。

  • Prepaid:预付费(包年包月)。

DBInstanceClass

String

实例计算资源。

取值说明:

  • selectdb.xlarge:4 核 32GB。

  • selectdb.2xlarge: 8 核 64GB。

  • selectdb.4xlarge:16 核 128GB。

EngineVersion

String

数据库版本。

取值:

  • 3.0

  • 4.0

VSwitchId

String

交换机 ID。

VpcId

String

专有网络 ID。

ZoneId

String

可用区 ID。

AccountPassword

String

数据库admin账号的密码。

取值说明:

  • 由大写字母、小写字母、数字和特殊字符中的至少三种组成。

  • !@#$%^&*()_+-=为特殊字符。

  • 长度为 8~32 个字符。

ConnectionString

String

数据库连接地址。

DBInstanceDescription

String

实例备注信息。

Engine

String

数据库类型。

默认值为 selectdb

Period

String

指定预付费集群为包年或包月类型。

取值说明:

  • Year:包年类型。

  • Month:包月类型。

说明

仅当 ChargeType 为 Prepaid 时,该参数才生效且为必填参数。

ResourceGroupId

String

资源组 ID。

SecurityIPList

List

实例的 IP 白名单列表。

最多支持配置1000个白名单。

Tags

List

实例标签列表信息。

最多支持配置20个标签信息,更多信息,请参考Tags属性

UsedTime

Integer

指定预付费实例的购买时长。

取值说明:

  • 当 Period 为 Year 时,UsedTime 取值范围为:1、2、3、5(整数)。

  • 当 Period 为 Month 时,UsedTime 取值范围为:1~9(整数)。

说明

仅当 ChargeType 为 Prepaid 时,该参数才生效且为必填参数。

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

Value

String

标签值。

返回值

Fn::GetAtt

  • DBInstanceId:数据库实例 ID。

  • VpcConnectionString:SelectDB 实例的 VPC 连接地址。

示例

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  EngineVersion:
    Type: String
    Description:
      en: Database version.
    AllowedValues:
      - '3.0'
      - '4.0'
    Required: true
  ZoneId:
    AssociationProperty: ZoneId
    Type: String
    Description:
      en: Availability Zone ID.
    Required: true
  DBInstanceClass:
    Type: String
    Description:
      en: |-
        The class of the DB instance.
        Call DescribeAllDBInstanceClass API to check the latest class list
    Required: true
  VSwitchId:
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${ZoneId}
    AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
    Type: String
    Description:
      en: Switch ID.
    Required: true
  CacheSize:
    Type: Number
    Description:
      en: Reserve cache size.
    Required: true
    MinValue: 100
    MaxValue: 4000
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: VPC id.
    Required: true
  ChargeType:
    Type: String
    Description:
      en: |-
        The paid type of instance.Value:
        Postpaid: Postpaid (pay per quantity).
        Prepaid: Prepaid (year and monthly).
    AllowedValues:
      - Postpaid
      - Prepaid
    Required: true
Resources:
  DBInstance:
    Type: ALIYUN::SELECTDB::DBInstance
    Properties:
      EngineVersion:
        Ref: EngineVersion
      ZoneId:
        Ref: ZoneId
      DBInstanceClass:
        Ref: DBInstanceClass
      VSwitchId:
        Ref: VSwitchId
      CacheSize:
        Ref: CacheSize
      VpcId:
        Ref: VpcId
      ChargeType:
        Ref: ChargeType
Outputs:
  DBInstanceId:
    Description: Instance ID.
    Value:
      Fn::GetAtt:
        - DBInstance
        - DBInstanceId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "EngineVersion": {
      "Type": "String",
      "Description": {
        "en": "Database version."
      },
      "AllowedValues": [
        "3.0",
        "4.0"
      ],
      "Required": true
    },
    "ZoneId": {
      "AssociationProperty": "ZoneId",
      "Type": "String",
      "Description": {
        "en": "Availability Zone ID."
      },
      "Required": true
    },
    "DBInstanceClass": {
      "Type": "String",
      "Description": {
        "en": "The class of the DB instance.\nCall DescribeAllDBInstanceClass API to check the latest class list"
      },
      "Required": true
    },
    "VSwitchId": {
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${ZoneId}"
      },
      "AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
      "Type": "String",
      "Description": {
        "en": "Switch ID."
      },
      "Required": true
    },
    "CacheSize": {
      "Type": "Number",
      "Description": {
        "en": "Reserve cache size."
      },
      "Required": true,
      "MinValue": 100,
      "MaxValue": 4000
    },
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "VPC id."
      },
      "Required": true
    },
    "ChargeType": {
      "Type": "String",
      "Description": {
        "en": "The paid type of instance.Value:\nPostpaid: Postpaid (pay per quantity).\nPrepaid: Prepaid (year and monthly)."
      },
      "AllowedValues": [
        "Postpaid",
        "Prepaid"
      ],
      "Required": true
    }
  },
  "Resources": {
    "DBInstance": {
      "Type": "ALIYUN::SELECTDB::DBInstance",
      "Properties": {
        "EngineVersion": {
          "Ref": "EngineVersion"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "CacheSize": {
          "Ref": "CacheSize"
        },
        "VpcId": {
          "Ref": "VpcId"
        },
        "ChargeType": {
          "Ref": "ChargeType"
        }
      }
    }
  },
  "Outputs": {
    "DBInstanceId": {
      "Description": "Instance ID.",
      "Value": {
        "Fn::GetAtt": [
          "DBInstance",
          "DBInstanceId"
        ]
      }
    }
  }
}