ALIYUN::RDS::ReadOnlyDBInstance類型用于為關系型數據庫RDS(Relational Database Service)實例創建一個只讀實例。
語法
{
"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
}
}
屬性
屬性名稱 | 類型 | 必須 | 允許更新 | 描述 | 約束 |
Category | String | 否 | 否 | 實例系列。 | 取值:
|
VPCId | String | 否 | 否 | 只讀實例的專有網絡ID。 | 無 |
DBInstanceDescription | String | 否 | 否 | 實例描述。 | 長度為2~256個字符。以漢字、英文字母開頭,不能以 |
Tags | Map | 否 | 是 | 實例標簽。 | 實例標簽是鍵值對形式,例如:
最多設置5個鍵值對。其中,key最大長度為64個字符,不能以 |
EngineVersion | String | 是 | 否 | 數據庫版本號。 | EngineVersion必須與主實例的版本保持一致。 取值:
|
DBInstanceId | String | 是 | 否 | 主實例ID。 | 無 |
PayType | String | 否 | 否 | 付費類型。 | 僅支持按量付費。 取值:Postpaid。 |
ZoneId | String | 是 | 否 | 可用區ID。 | 可以通過接口DescribeRegions查看可用區列表。 |
ResourceGroupId | String | 否 | 否 | 資源組ID。 | 無 |
DBInstanceStorage | Integer | 是 | 是 | 存儲空間。 | 單位:GB。 取值范圍:5~3000,步長為5 GB。 不同版本實例,支持的取值范圍不同。更多信息,請參見主實例規格列表。 |
VSwitchId | String | 否 | 否 | 只讀實例的交換機ID。 | 無 |
DBInstanceStorageType | String | 否 | 否 | 實例存儲類型。 | 取值:
說明 MySQL僅支持本地盤存儲類型,SQL Server僅支持云盤存儲類型。 |
DBInstanceClass | String | 是 | 是 | 實例規格。 | 更多信息,請參見主實例規格列表。 建議只讀實例規格不小于主實例規格,否則容易出現只讀實例延遲高、負載高等現象。 |
PrivateIpAddress | String | 否 | 否 | 只讀實例的內網IP。 | 需要在指定交換機的IP地址范圍內,設置只讀實例的內網IP。系統默認通過VPCId和VSwitchId自動分配。 |
PeriodType | String | 否 | 否 | 預付費實例類型。 | 取值:
|
Period | Integer | 否 | 否 | 購買時長。 | 取值范圍:
|
AutoRenew | Boolean | 否 | 否 | 實例是否自動續費。 | 僅在創建包年包月實例時生效。 取值:
說明
|
TargetDedicatedHostIdForMaster | String | 否 | 否 | 在專屬集群內創建只讀實例時,指定主實例的主機ID。 | 無 |
DeletionProtection | Boolean | 否 | 否 | 是否開啟RDS釋放保護功能。 | 取值:
說明 僅計費方式為按量付費時支持開啟。 |
DedicatedHostGroupId | String | 否 | 否 | 在專屬集群內創建只讀實例時指定專屬集群ID。 | 無 |
返回值
Fn::GetAtt
ConnectionString:創建的只讀實例內網數據庫連接地址。
DBInstanceId:創建的只讀實例ID。
Port:創建的只讀實例內網數據庫連接端口。
示例
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
{
"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"
]
}
}
}
}