ALIYUN::REDIS::PrepayInstance类型用于创建预付费Redis实例。
语法
{
"Type": "ALIYUN::REDIS::PrepayInstance",
"Properties": {
"VpcId": String,
"EvictionPolicy": String,
"Period": Integer,
"ZoneId": String,
"InstanceClass": String,
"VpcPasswordFree": Boolean,
"VSwitchId": String,
"SecurityGroupId": String,
"EngineVersion": String,
"Password": String,
"SSLEnabled": String,
"InstanceName": String,
"BackupPolicy": Map,
"Tags": List,
"InstanceMaintainTime": Map,
"DeletionForce": Boolean,
"AutoPay": Boolean,
"TLSProtocol": String,
"Connections": Map,
"AutoRenewDuration": Integer,
"ProductType": String,
"SecondaryZoneId": String,
"ResourceGroupId": String,
"PeriodUnit": String,
"TairConfig": Map,
"ShardCount": Integer,
"ReadOnlyCount": Integer,
"SubscriptionDeletionForce": Boolean,
"NodeType": String,
"DeletionProtection": Boolean
}
}
属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
AutoPay |
Boolean |
否 |
否 |
是否自动付费。 |
取值:
|
|
AutoRenewDuration |
Integer |
否 |
是 |
自动续费时长。 |
取值范围:1~12。 单位:月。 当实例即将到期时,将根据该参数指定的时长自动续费。 |
|
BackupPolicy |
Map |
否 |
是 |
备份策略。 |
更多信息,请参见BackupPolicy属性。 |
|
Connections |
Map |
否 |
是 |
连接地址。 |
更多信息,请参见Connections属性。 |
|
DeletionForce |
Boolean |
否 |
是 |
是否在回收时删除实例。 |
取值:
|
|
DeletionProtection |
Boolean |
否 |
是 |
是否已开启释放保护功能。 |
取值:
|
|
EngineVersion |
String |
否 |
是 |
数据库版本。 |
取值:
|
|
EvictionPolicy |
String |
否 |
否 |
数据逐出策略。 |
取值:
|
|
InstanceClass |
String |
否 |
是 |
实例规格。 |
更多信息,请参见实例规格概览。 |
|
InstanceMaintainTime |
Map |
否 |
是 |
实例的可维护时间段。 |
更多信息,请参见InstanceMaintainTime属性。 |
|
InstanceName |
String |
否 |
是 |
实例名称。 |
长度为2~128个字符。必须以英文字母或汉字开头,可包含英文字母、数字、汉字、下划线(_)、短划线(-)和半角句号(.)。 |
|
NodeType |
String |
否 |
否 |
节点类型。 |
取值:
说明
云原生版实例请选择MASTER_SLAVE或STAND_ALONE,经典版实例请选择double或single。 |
|
Password |
String |
否 |
是 |
实例密码。 |
长度为8~32个字符。必须包含大写英文字母、小写英文字母、数字和特殊字符中至少三种。支持特殊字符为: |
|
Period |
Integer |
否 |
否 |
预付费续费时长。 |
取值:1~9、12、24、36。 单位:月。 |
|
PeriodUnit |
String |
否 |
否 |
时长单位。 |
取值:
|
|
ProductType |
String |
否 |
否 |
产品类型。 |
取值:
|
|
ReadOnlyCount |
Integer |
否 |
否 |
主可用区的只读节点数。 |
说明
ReadOnlyCount 参数仅适用于云原生版、开启读写分离的实例。如果实例为集群架构,则上述参数分别表示单分片的(主、备可用区)只读节点数量。 |
|
ResourceGroupId |
String |
否 |
是 |
资源组ID。 |
无 |
|
SecondaryZoneId |
String |
否 |
是 |
备可用区ID。 |
可调用查询支持的可用区接口查询。 说明
传入本参数可以实现主备数据节点分布在不同的可用区,实现跨可用区容灾,能够承受机房级别的故障。 |
|
SecurityGroupId |
String |
否 |
是 |
安全组ID。 |
最多支持设置10个ID,ID之间用半角逗号(,)分隔。 |
|
ShardCount |
Integer |
否 |
否 |
分片数。 |
有效值:
|
|
SSLEnabled |
String |
否 |
是 |
SSL状态。 |
取值:
|
|
SubscriptionDeletionForce |
Boolean |
否 |
否 |
该选项仅适用于包年包月实例。对于包年包月实例,如果此选项为 true,则在删除之前会将实例转换为按量付费实例;如果为 false,则不会执行强制删除。此操作会产生额外费用,请谨慎选择。 |
无 |
|
Tags |
List |
否 |
是 |
标签。 |
每个实例最多可以绑定20个标签。 更多信息,请参见Tags属性。 |
|
TairConfig |
Map |
否 |
否 |
Tair配置。 |
更多信息,请参见TairConfig属性。 |
|
TLSProtocol |
String |
否 |
否 |
该实例的 TLS 版本。 |
取值:
|
|
VpcId |
String |
否 |
否 |
专有网络ID。 |
无 |
|
VpcPasswordFree |
Boolean |
否 |
否 |
是否启用免密码访问专有网络中的实例。 |
取值:
|
|
VSwitchId |
String |
否 |
否 |
交换机ID。 |
无 |
|
ZoneId |
String |
否 |
否 |
可用区ID。 |
当创建的实例属于专有网络时,该参数必须指定。 创建多可用区实例时,调用查询支持的可用区接口查询支持的多可用区ID。 |
BackupPolicy语法
"BackupPolicy": {
"PreferredBackupPeriod": "String",
"PreferredBackupTime": "String",
"EnableBackupLog": "Integer"
}
BackupPolicy属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
PreferredBackupPeriod |
String |
是 |
是 |
备份周期。 |
取值:
|
|
PreferredBackupTime |
String |
是 |
是 |
备份时间。 |
格式: |
|
EnableBackupLog |
Integer |
否 |
是 |
开启或关闭增量备份。 |
取值:
|
InstanceMaintainTime语法
"InstanceMaintainTime": {
"MaintainStartTime": "String",
"MaintainEndTime": "String"
}
InstanceMaintainTime属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
MaintainEndTime |
String |
否 |
否 |
可维护时间段的结束时间。 |
格式: 说明
开始时间和结束时间的间隔应为1小时,例如:MaintainStartTime为 |
|
MaintainStartTime |
String |
否 |
否 |
可维护时间段的开始时间。 |
格式: |
Tags语法
"Tags": [
{
"Key": String,
"Value": String
}
]
Tags属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
Key |
String |
是 |
否 |
标签键。 |
在同账号、同地域下,标签键唯一。 |
|
Value |
String |
否 |
否 |
标签值。 |
无 |
Connections语法
"Connections": {
"VpcPrivateConnection": "Map",
"ClassicInnerConnection": "Map",
"DirectConnection": "Map",
"PublicConnection": "Map"
}
Connections属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
ClassicInnerConnection |
Map |
否 |
是 |
经典内网地址。 |
更多信息,请参见ClassicInnerConnection属性。 |
|
DirectConnection |
Map |
否 |
是 |
直接连接地址。您可以根据需要申请直连端点。 |
更多信息,请参见DirectConnection属性。 |
|
PublicConnection |
Map |
否 |
是 |
公共地址。 |
更多信息,请参见PublicConnection属性。 |
|
VpcPrivateConnection |
Map |
否 |
是 |
VPC内网地址。 |
更多信息,请参见VpcPrivateConnection属性。 |
VpcPrivateConnection语法
"VpcPrivateConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
VpcPrivateConnection属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
ConnectionPort |
Integer |
是 |
是 |
实例的ApsaraDB服务端口号。 |
取值范围:1024~65535。 |
|
ConnectionString |
String |
否 |
是 |
公共端点的前缀。 |
长度为8~64个字符,必须以小写英文字母开头。可包含小写英文字母和数字。 |
PublicConnection语法
"PublicConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
PublicConnection属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
ConnectionPort |
Integer |
是 |
是 |
实例的ApsaraDB服务端口号。 |
取值范围:1024~65535。 |
|
ConnectionString |
String |
否 |
是 |
公共端点的前缀。 |
长度为8~64个字符,必须以小写英文字母开头。可包含小写英文字母和数字。 |
DirectConnection语法
"DirectConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
DirectConnection属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
ConnectionPort |
Integer |
是 |
是 |
实例的ApsaraDB服务端口号。 |
取值范围:1024~65535。 |
|
ConnectionString |
String |
否 |
是 |
公共端点的前缀。 |
长度为8~64个字符,必须以小写英文字母开头。可包含小写英文字母和数字。 |
ClassicInnerConnection语法
"ClassicInnerConnection": {
"ConnectionPort": Integer,
"ConnectionString": String
}
ClassicInnerConnection属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
ConnectionPort |
Integer |
是 |
是 |
实例的ApsaraDB服务端口号。 |
取值范围:1024~65535。 |
|
ConnectionString |
String |
否 |
是 |
公共端点的前缀。 |
长度为8~64个字符,必须以小写英文字母开头。可包含小写英文字母和数字。 |
TairConfig语法
"BackupPolicy": {
"Storage": "Integer",
"StorageType": "String",
"ShardCount": "Integer"
}
TairConfig属性
|
属性名称 |
类型 |
必须 |
允许更新 |
描述 |
约束 |
|
ShardCount |
Integer |
否 |
否 |
实例中的数据节点个数。 |
取值:
|
|
Storage |
Integer |
否 |
否 |
云盘的存储空间。 |
不同的规格取值范围有所区别。更多信息,请参见磁盘型实例规格。 |
|
StorageType |
String |
否 |
否 |
存储类型。 |
取值:
|
返回值
Fn::GetAtt
-
InstanceId:实例ID。
-
OrderId:订单ID。
-
ConnectionDomain:实例的连接域名。
-
Port:实例的连接端口。
-
InstanceName:实例名称。
-
InstanceClass:实例规格。
-
VpcId:专有网络ID。
-
Capacity:实例的存储容量。
-
InstanceType:实例的引擎版本。
-
ChargeType:实例的计费方式。
-
PackageType:计划类型。
-
Connections:实例支持的最大连接数。
-
ArchitectureType:架构类型。
-
NodeType:节点类型。
-
HasRenewChangeOrder:阿里云账号是否有待续订或扩容订单。
-
ResourceGroupId:资源组ID。
-
QPS:每秒访问次数,取值为当前规格实例的理论值。
-
ZoneId:实例所属的可用区ID。
-
Bandwidth:实例带宽。单位:Mbps。
-
EngineVersion:版本类型。
-
NetworkType:网络类型。
-
VSwitchId:交换机ID。
-
PrivateIp:实例的私网IP地址。
-
PublicConnectionString:实例的公共连接字符串。
-
VpcPrivateConnectionPort:VPC私有连接端口。
-
ClassicInnerConnectionString:实例的经典内部连接字符串。
-
VpcPrivateConnectionString:实例的VPC私有连接字符串。
-
PublicConnectionPort:实例的公共连接端口。
-
DirectConnectionString:实例的直接连接字符串。
-
DirectConnectionPort:实例的直接连接端口。
-
ClassicInnerConnectionPort:实例的经典内连接端口。
示例
场景 1 :创建包年包月Redis标准版实例,部署在VPC网络中。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建包年包月Redis标准版实例,部署在VPC网络中。
en: Create a prepaid Redis standard instance in a VPC network.
Parameters:
ZoneId:
Type: String
Label:
zh-cn: 可用区
en: Availability Zone
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
VpcId:
Type: String
Label:
zh-cn: VPC ID
en: VPC ID
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitchId:
Type: String
Label:
zh-cn: 交换机ID
en: VSwitch ID
AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
InstanceName:
Type: String
Label:
zh-cn: 实例名称
en: Instance Name
Description:
zh-cn: Redis实例名称,2~128个字符。
en: Redis instance name, 2-128 characters.
Default: my-redis
InstanceClass:
Type: String
Label:
zh-cn: 实例规格
en: Instance Class
Description:
zh-cn: >-
Redis实例规格。例如:
redis.master.small.default(1GB主从版),
redis.master.mid.default(2GB主从版)。
en: >-
Redis instance class, e.g.
redis.master.small.default (1GB), redis.master.mid.default (2GB).
Default: redis.master.small.default
EngineVersion:
Type: String
Label:
zh-cn: 引擎版本
en: Engine Version
Default: '5.0'
AllowedValues:
- '4.0'
- '5.0'
Password:
Type: String
Label:
zh-cn: 实例密码
en: Instance Password
Description:
zh-cn: 8~32个字符,至少包含大小写字母、数字和特殊字符中的三种。
en: 8-32 characters, at least three of uppercase, lowercase, digits, special chars.
NoEcho: true
MinLength: 8
MaxLength: 32
Period:
Type: Number
Label:
zh-cn: 购买时长(月)
en: Period (Months)
Description:
zh-cn: 包年包月购买时长,单位月。
en: Subscription period in months.
Default: 1
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 12
- 24
- 36
Resources:
RedisInstance:
Type: ALIYUN::REDIS::PrepayInstance
Properties:
InstanceName:
Ref: InstanceName
InstanceClass:
Ref: InstanceClass
EngineVersion:
Ref: EngineVersion
Password:
Ref: Password
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
ZoneId:
Ref: ZoneId
Period:
Ref: Period
AutoPay: true
Outputs:
InstanceId:
Label:
zh-cn: 实例ID
en: Instance ID
Description:
zh-cn: Redis实例ID。
en: The Redis instance ID.
Value:
Fn::GetAtt:
- RedisInstance
- InstanceId
ConnectionDomain:
Label:
zh-cn: 连接域名
en: Connection Domain
Description:
zh-cn: Redis实例的内网连接域名。
en: The private connection domain of the Redis instance.
Value:
Fn::GetAtt:
- RedisInstance
- ConnectionDomain
Port:
Label:
zh-cn: 连接端口
en: Connection Port
Description:
zh-cn: Redis实例的连接端口。
en: The connection port of the Redis instance.
Value:
Fn::GetAtt:
- RedisInstance
- Port{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建包年包月Redis标准版实例,部署在VPC网络中。",
"en": "Create a prepaid Redis standard instance in a VPC network."
},
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": {
"zh-cn": "可用区",
"en": "Availability Zone"
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"VpcId": {
"Type": "String",
"Label": {
"zh-cn": "VPC ID",
"en": "VPC ID"
},
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
},
"VSwitchId": {
"Type": "String",
"Label": {
"zh-cn": "交换机ID",
"en": "VSwitch ID"
},
"AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
}
},
"InstanceName": {
"Type": "String",
"Label": {
"zh-cn": "实例名称",
"en": "Instance Name"
},
"Description": {
"zh-cn": "Redis实例名称,2~128个字符。",
"en": "Redis instance name, 2-128 characters."
},
"Default": "my-redis"
},
"InstanceClass": {
"Type": "String",
"Label": {
"zh-cn": "实例规格",
"en": "Instance Class"
},
"Description": {
"zh-cn": "Redis实例规格。例如:redis.master.small.default(1GB主从版),redis.master.mid.default(2GB主从版)。",
"en": "Redis instance class, e.g. redis.master.small.default (1GB), redis.master.mid.default (2GB)."
},
"Default": "redis.master.small.default"
},
"EngineVersion": {
"Type": "String",
"Label": {
"zh-cn": "引擎版本",
"en": "Engine Version"
},
"Default": "5.0",
"AllowedValues": [
"4.0",
"5.0"
]
},
"Password": {
"Type": "String",
"Label": {
"zh-cn": "实例密码",
"en": "Instance Password"
},
"Description": {
"zh-cn": "8~32个字符,至少包含大小写字母、数字和特殊字符中的三种。",
"en": "8-32 characters, at least three of uppercase, lowercase, digits, special chars."
},
"NoEcho": true,
"MinLength": 8,
"MaxLength": 32
},
"Period": {
"Type": "Number",
"Label": {
"zh-cn": "购买时长(月)",
"en": "Period (Months)"
},
"Description": {
"zh-cn": "包年包月购买时长,单位月。",
"en": "Subscription period in months."
},
"Default": 1,
"AllowedValues": [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36]
}
},
"Resources": {
"RedisInstance": {
"Type": "ALIYUN::REDIS::PrepayInstance",
"Properties": {
"InstanceName": {
"Ref": "InstanceName"
},
"InstanceClass": {
"Ref": "InstanceClass"
},
"EngineVersion": {
"Ref": "EngineVersion"
},
"Password": {
"Ref": "Password"
},
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"ZoneId": {
"Ref": "ZoneId"
},
"Period": {
"Ref": "Period"
},
"AutoPay": true
}
}
},
"Outputs": {
"InstanceId": {
"Label": {
"zh-cn": "实例ID",
"en": "Instance ID"
},
"Description": {
"zh-cn": "Redis实例ID。",
"en": "The Redis instance ID."
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"InstanceId"
]
}
},
"ConnectionDomain": {
"Label": {
"zh-cn": "连接域名",
"en": "Connection Domain"
},
"Description": {
"zh-cn": "Redis实例的内网连接域名。",
"en": "The private connection domain of the Redis instance."
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"ConnectionDomain"
]
}
},
"Port": {
"Label": {
"zh-cn": "连接端口",
"en": "Connection Port"
},
"Description": {
"zh-cn": "Redis实例的连接端口。",
"en": "The connection port of the Redis instance."
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"Port"
]
}
}
}
}场景 2 :创建包年包月Redis实例,配置备份策略、维护窗口、SSL和标签。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建包年包月Redis实例,配置备份策略、维护窗口、SSL和标签。
en: Create a prepaid Redis instance with backup policy, maintenance window, SSL and tags.
Parameters:
ZoneId:
Type: String
Label:
zh-cn: 可用区
en: Availability Zone
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
VpcId:
Type: String
Label:
zh-cn: VPC ID
en: VPC ID
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitchId:
Type: String
Label:
zh-cn: 交换机ID
en: VSwitch ID
AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
SecurityGroupId:
Type: String
Label:
zh-cn: 安全组ID
en: Security Group ID
AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
AssociationPropertyMetadata:
VpcId: ${VpcId}
InstanceName:
Type: String
Label:
zh-cn: 实例名称
en: Instance Name
Default: prod-redis
InstanceClass:
Type: String
Label:
zh-cn: 实例规格
en: Instance Class
Default: redis.master.mid.default
Password:
Type: String
Label:
zh-cn: 实例密码
en: Instance Password
NoEcho: true
MinLength: 8
MaxLength: 32
Period:
Type: Number
Label:
zh-cn: 购买时长(月)
en: Period (Months)
Default: 3
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 12
- 24
- 36
AutoRenewDuration:
Type: Number
Label:
zh-cn: 自动续费时长(月)
en: Auto Renew Duration (Months)
Description:
zh-cn: 实例到期后自动续费的月数,1~12个月。设为0则不自动续费。
en: Auto-renew duration in months (1-12). Set to 0 to disable.
Default: 1
MinValue: 0
MaxValue: 12
Resources:
RedisInstance:
Type: ALIYUN::REDIS::PrepayInstance
Properties:
InstanceName:
Ref: InstanceName
InstanceClass:
Ref: InstanceClass
EngineVersion: '5.0'
NodeType: MASTER_SLAVE
Password:
Ref: Password
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
ZoneId:
Ref: ZoneId
SecurityGroupId:
Ref: SecurityGroupId
Period:
Ref: Period
AutoPay: true
AutoRenewDuration:
Ref: AutoRenewDuration
SSLEnabled: Enable
DeletionProtection: true
BackupPolicy:
PreferredBackupPeriod: Monday,Wednesday,Friday
PreferredBackupTime: 18:00Z-19:00Z
EnableBackupLog: 1
InstanceMaintainTime:
MaintainStartTime: 17:00Z
MaintainEndTime: 18:00Z
Tags:
- Key: Environment
Value: Production
- Key: Service
Value: Cache
Outputs:
InstanceId:
Label:
zh-cn: 实例ID
en: Instance ID
Value:
Fn::GetAtt:
- RedisInstance
- InstanceId
ConnectionDomain:
Label:
zh-cn: 连接域名
en: Connection Domain
Value:
Fn::GetAtt:
- RedisInstance
- ConnectionDomain
Port:
Label:
zh-cn: 连接端口
en: Connection Port
Value:
Fn::GetAtt:
- RedisInstance
- Port
InstanceClass:
Label:
zh-cn: 实例规格
en: Instance Class
Value:
Fn::GetAtt:
- RedisInstance
- InstanceClass{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建包年包月Redis实例,配置备份策略、维护窗口、SSL和标签。",
"en": "Create a prepaid Redis instance with backup policy, maintenance window, SSL and tags."
},
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": {
"zh-cn": "可用区",
"en": "Availability Zone"
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"VpcId": {
"Type": "String",
"Label": {
"zh-cn": "VPC ID",
"en": "VPC ID"
},
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
},
"VSwitchId": {
"Type": "String",
"Label": {
"zh-cn": "交换机ID",
"en": "VSwitch ID"
},
"AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
}
},
"SecurityGroupId": {
"Type": "String",
"Label": {
"zh-cn": "安全组ID",
"en": "Security Group ID"
},
"AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}"
}
},
"InstanceName": {
"Type": "String",
"Label": {
"zh-cn": "实例名称",
"en": "Instance Name"
},
"Default": "prod-redis"
},
"InstanceClass": {
"Type": "String",
"Label": {
"zh-cn": "实例规格",
"en": "Instance Class"
},
"Default": "redis.master.mid.default"
},
"Password": {
"Type": "String",
"Label": {
"zh-cn": "实例密码",
"en": "Instance Password"
},
"NoEcho": true,
"MinLength": 8,
"MaxLength": 32
},
"Period": {
"Type": "Number",
"Label": {
"zh-cn": "购买时长(月)",
"en": "Period (Months)"
},
"Default": 3,
"AllowedValues": [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36]
},
"AutoRenewDuration": {
"Type": "Number",
"Label": {
"zh-cn": "自动续费时长(月)",
"en": "Auto Renew Duration (Months)"
},
"Description": {
"zh-cn": "实例到期后自动续费的月数,1~12个月。设为0则不自动续费。",
"en": "Auto-renew duration in months (1-12). Set to 0 to disable."
},
"Default": 1,
"MinValue": 0,
"MaxValue": 12
}
},
"Resources": {
"RedisInstance": {
"Type": "ALIYUN::REDIS::PrepayInstance",
"Properties": {
"InstanceName": {
"Ref": "InstanceName"
},
"InstanceClass": {
"Ref": "InstanceClass"
},
"EngineVersion": "5.0",
"NodeType": "MASTER_SLAVE",
"Password": {
"Ref": "Password"
},
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"ZoneId": {
"Ref": "ZoneId"
},
"SecurityGroupId": {
"Ref": "SecurityGroupId"
},
"Period": {
"Ref": "Period"
},
"AutoPay": true,
"AutoRenewDuration": {
"Ref": "AutoRenewDuration"
},
"SSLEnabled": "Enable",
"DeletionProtection": true,
"BackupPolicy": {
"PreferredBackupPeriod": "Monday,Wednesday,Friday",
"PreferredBackupTime": "18:00Z-19:00Z",
"EnableBackupLog": 1
},
"InstanceMaintainTime": {
"MaintainStartTime": "17:00Z",
"MaintainEndTime": "18:00Z"
},
"Tags": [
{
"Key": "Environment",
"Value": "Production"
},
{
"Key": "Service",
"Value": "Cache"
}
]
}
}
},
"Outputs": {
"InstanceId": {
"Label": {
"zh-cn": "实例ID",
"en": "Instance ID"
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"InstanceId"
]
}
},
"ConnectionDomain": {
"Label": {
"zh-cn": "连接域名",
"en": "Connection Domain"
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"ConnectionDomain"
]
}
},
"Port": {
"Label": {
"zh-cn": "连接端口",
"en": "Connection Port"
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"Port"
]
}
},
"InstanceClass": {
"Label": {
"zh-cn": "实例规格",
"en": "Instance Class"
},
"Value": {
"Fn::GetAtt": [
"RedisInstance",
"InstanceClass"
]
}
}
}
}场景 3 :创建包年包月Redis集群版实例,配置跨可用区容灾、读写分离和资源组。
ROSTemplateFormatVersion: '2015-09-01'
Description:
zh-cn: 创建包年包月Redis集群版实例,配置跨可用区容灾、读写分离和资源组。
en: Create a prepaid Redis cluster instance with cross-zone HA, read-write splitting and resource group.
Parameters:
ZoneId:
Type: String
Label:
zh-cn: 主可用区
en: Primary Zone
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
SecondaryZoneId:
Type: String
Label:
zh-cn: 备可用区
en: Secondary Zone
Description:
zh-cn: >-
备可用区ID,用于跨可用区容灾。
建议选择与主可用区不同的可用区。
en: >-
Secondary zone ID for cross-zone disaster recovery.
AssociationProperty: ALIYUN::ECS::Instance::ZoneId
VpcId:
Type: String
Label:
zh-cn: VPC ID
en: VPC ID
AssociationProperty: ALIYUN::ECS::VPC::VPCId
VSwitchId:
Type: String
Label:
zh-cn: 交换机ID
en: VSwitch ID
AssociationProperty: ALIYUN::VPC::VSwitch::VSwitchId
AssociationPropertyMetadata:
VpcId: ${VpcId}
ZoneId: ${ZoneId}
InstanceName:
Type: String
Label:
zh-cn: 实例名称
en: Instance Name
Default: prod-redis-cluster
InstanceClass:
Type: String
Label:
zh-cn: 实例规格
en: Instance Class
Description:
zh-cn: >-
Redis集群版实例规格。例如:
redis.shard.small.ce(1GB集群版),
redis.shard.mid.ce(2GB集群版)。
en: >-
Redis cluster instance class, e.g.
redis.shard.small.ce (1GB), redis.shard.mid.ce (2GB).
Default: redis.shard.small.ce
Password:
Type: String
Label:
zh-cn: 实例密码
en: Instance Password
NoEcho: true
MinLength: 8
MaxLength: 32
ShardCount:
Type: Number
Label:
zh-cn: 分片数
en: Shard Count
Description:
zh-cn: 集群版分片数量,取值范围2~32。
en: Number of shards for the cluster, range 2-32.
Default: 4
MinValue: 2
MaxValue: 32
ReadOnlyCount:
Type: Number
Label:
zh-cn: 只读节点数
en: Read-Only Node Count
Description:
zh-cn: 每个分片的只读节点数量,用于读写分离。设为0则不启用。
en: Number of read-only nodes per shard for read-write splitting. Set to 0 to disable.
Default: 1
MinValue: 0
MaxValue: 5
EvictionPolicy:
Type: String
Label:
zh-cn: 数据逐出策略
en: Eviction Policy
Description:
zh-cn: >-
内存不足时的数据逐出策略。
noeviction:不删除,写操作返回错误。
allkeys-lru:优先删除最近最少使用的key。
volatile-lru:仅对设置了过期时间的key执行LRU淘汰。
volatile-ttl:仅删除过期时间最短的key。
en: >-
Data eviction policy when memory is full.
Default: volatile-lru
AllowedValues:
- noeviction
- allkeys-lru
- volatile-lru
- allkeys-random
- volatile-random
- volatile-ttl
ResourceGroupId:
Type: String
Label:
zh-cn: 资源组ID
en: Resource Group ID
Description:
zh-cn: 实例所属的资源组ID。
en: The resource group ID.
AssociationProperty: ALIYUN::ResourceManager::ResourceGroup
Default: ''
Period:
Type: Number
Label:
zh-cn: 购买时长(月)
en: Period (Months)
Default: 6
AllowedValues:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 12
- 24
- 36
Resources:
RedisCluster:
Type: ALIYUN::REDIS::PrepayInstance
Properties:
InstanceName:
Ref: InstanceName
InstanceClass:
Ref: InstanceClass
EngineVersion: '5.0'
NodeType: MASTER_SLAVE
ProductType: OnECS
Password:
Ref: Password
VpcId:
Ref: VpcId
VSwitchId:
Ref: VSwitchId
ZoneId:
Ref: ZoneId
SecondaryZoneId:
Ref: SecondaryZoneId
ShardCount:
Ref: ShardCount
ReadOnlyCount:
Ref: ReadOnlyCount
EvictionPolicy:
Ref: EvictionPolicy
ResourceGroupId:
Ref: ResourceGroupId
Period:
Ref: Period
AutoPay: true
AutoRenewDuration: 1
DeletionProtection: true
DeletionForce: false
BackupPolicy:
PreferredBackupPeriod: Monday,Wednesday,Friday,Sunday
PreferredBackupTime: 18:00Z-19:00Z
EnableBackupLog: 1
Tags:
- Key: Environment
Value: Production
- Key: Architecture
Value: Cluster
Outputs:
InstanceId:
Label:
zh-cn: 实例ID
en: Instance ID
Value:
Fn::GetAtt:
- RedisCluster
- InstanceId
ConnectionDomain:
Label:
zh-cn: 连接域名
en: Connection Domain
Value:
Fn::GetAtt:
- RedisCluster
- ConnectionDomain
Port:
Label:
zh-cn: 连接端口
en: Connection Port
Value:
Fn::GetAtt:
- RedisCluster
- Port
Capacity:
Label:
zh-cn: 存储容量
en: Storage Capacity
Description:
zh-cn: Redis实例的存储容量。
en: The storage capacity of the Redis instance.
Value:
Fn::GetAtt:
- RedisCluster
- Capacity
OrderId:
Label:
zh-cn: 订单ID
en: Order ID
Description:
zh-cn: 预付费订单ID。
en: The prepaid order ID.
Value:
Fn::GetAtt:
- RedisCluster
- OrderId{
"ROSTemplateFormatVersion": "2015-09-01",
"Description": {
"zh-cn": "创建包年包月Redis集群版实例,配置跨可用区容灾、读写分离和资源组。",
"en": "Create a prepaid Redis cluster instance with cross-zone HA, read-write splitting and resource group."
},
"Parameters": {
"ZoneId": {
"Type": "String",
"Label": {
"zh-cn": "主可用区",
"en": "Primary Zone"
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"SecondaryZoneId": {
"Type": "String",
"Label": {
"zh-cn": "备可用区",
"en": "Secondary Zone"
},
"Description": {
"zh-cn": "备可用区ID,用于跨可用区容灾。建议选择与主可用区不同的可用区。",
"en": "Secondary zone ID for cross-zone disaster recovery."
},
"AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
},
"VpcId": {
"Type": "String",
"Label": {
"zh-cn": "VPC ID",
"en": "VPC ID"
},
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
},
"VSwitchId": {
"Type": "String",
"Label": {
"zh-cn": "交换机ID",
"en": "VSwitch ID"
},
"AssociationProperty": "ALIYUN::VPC::VSwitch::VSwitchId",
"AssociationPropertyMetadata": {
"VpcId": "${VpcId}",
"ZoneId": "${ZoneId}"
}
},
"InstanceName": {
"Type": "String",
"Label": {
"zh-cn": "实例名称",
"en": "Instance Name"
},
"Default": "prod-redis-cluster"
},
"InstanceClass": {
"Type": "String",
"Label": {
"zh-cn": "实例规格",
"en": "Instance Class"
},
"Description": {
"zh-cn": "Redis集群版实例规格。例如:redis.shard.small.ce(1GB集群版),redis.shard.mid.ce(2GB集群版)。",
"en": "Redis cluster instance class, e.g. redis.shard.small.ce (1GB), redis.shard.mid.ce (2GB)."
},
"Default": "redis.shard.small.ce"
},
"Password": {
"Type": "String",
"Label": {
"zh-cn": "实例密码",
"en": "Instance Password"
},
"NoEcho": true,
"MinLength": 8,
"MaxLength": 32
},
"ShardCount": {
"Type": "Number",
"Label": {
"zh-cn": "分片数",
"en": "Shard Count"
},
"Description": {
"zh-cn": "集群版分片数量,取值范围2~32。",
"en": "Number of shards for the cluster, range 2-32."
},
"Default": 4,
"MinValue": 2,
"MaxValue": 32
},
"ReadOnlyCount": {
"Type": "Number",
"Label": {
"zh-cn": "只读节点数",
"en": "Read-Only Node Count"
},
"Description": {
"zh-cn": "每个分片的只读节点数量,用于读写分离。设为0则不启用。",
"en": "Number of read-only nodes per shard for read-write splitting. Set to 0 to disable."
},
"Default": 1,
"MinValue": 0,
"MaxValue": 5
},
"EvictionPolicy": {
"Type": "String",
"Label": {
"zh-cn": "数据逐出策略",
"en": "Eviction Policy"
},
"Description": {
"zh-cn": "内存不足时的数据逐出策略。noeviction:不删除,写操作返回错误。allkeys-lru:优先删除最近最少使用的key。volatile-lru:仅对设置了过期时间的key执行LRU淘汰。volatile-ttl:仅删除过期时间最短的key。",
"en": "Data eviction policy when memory is full."
},
"Default": "volatile-lru",
"AllowedValues": [
"noeviction",
"allkeys-lru",
"volatile-lru",
"allkeys-random",
"volatile-random",
"volatile-ttl"
]
},
"ResourceGroupId": {
"Type": "String",
"Label": {
"zh-cn": "资源组ID",
"en": "Resource Group ID"
},
"Description": {
"zh-cn": "实例所属的资源组ID。",
"en": "The resource group ID."
},
"AssociationProperty": "ALIYUN::ResourceManager::ResourceGroup",
"Default": ""
},
"Period": {
"Type": "Number",
"Label": {
"zh-cn": "购买时长(月)",
"en": "Period (Months)"
},
"Default": 6,
"AllowedValues": [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36]
}
},
"Resources": {
"RedisCluster": {
"Type": "ALIYUN::REDIS::PrepayInstance",
"Properties": {
"InstanceName": {
"Ref": "InstanceName"
},
"InstanceClass": {
"Ref": "InstanceClass"
},
"EngineVersion": "5.0",
"NodeType": "MASTER_SLAVE",
"ProductType": "OnECS",
"Password": {
"Ref": "Password"
},
"VpcId": {
"Ref": "VpcId"
},
"VSwitchId": {
"Ref": "VSwitchId"
},
"ZoneId": {
"Ref": "ZoneId"
},
"SecondaryZoneId": {
"Ref": "SecondaryZoneId"
},
"ShardCount": {
"Ref": "ShardCount"
},
"ReadOnlyCount": {
"Ref": "ReadOnlyCount"
},
"EvictionPolicy": {
"Ref": "EvictionPolicy"
},
"ResourceGroupId": {
"Ref": "ResourceGroupId"
},
"Period": {
"Ref": "Period"
},
"AutoPay": true,
"AutoRenewDuration": 1,
"DeletionProtection": true,
"DeletionForce": false,
"BackupPolicy": {
"PreferredBackupPeriod": "Monday,Wednesday,Friday,Sunday",
"PreferredBackupTime": "18:00Z-19:00Z",
"EnableBackupLog": 1
},
"Tags": [
{
"Key": "Environment",
"Value": "Production"
},
{
"Key": "Architecture",
"Value": "Cluster"
}
]
}
}
},
"Outputs": {
"InstanceId": {
"Label": {
"zh-cn": "实例ID",
"en": "Instance ID"
},
"Value": {
"Fn::GetAtt": [
"RedisCluster",
"InstanceId"
]
}
},
"ConnectionDomain": {
"Label": {
"zh-cn": "连接域名",
"en": "Connection Domain"
},
"Value": {
"Fn::GetAtt": [
"RedisCluster",
"ConnectionDomain"
]
}
},
"Port": {
"Label": {
"zh-cn": "连接端口",
"en": "Connection Port"
},
"Value": {
"Fn::GetAtt": [
"RedisCluster",
"Port"
]
}
},
"Capacity": {
"Label": {
"zh-cn": "存储容量",
"en": "Storage Capacity"
},
"Description": {
"zh-cn": "Redis实例的存储容量。",
"en": "The storage capacity of the Redis instance."
},
"Value": {
"Fn::GetAtt": [
"RedisCluster",
"Capacity"
]
}
},
"OrderId": {
"Label": {
"zh-cn": "订单ID",
"en": "Order ID"
},
"Description": {
"zh-cn": "预付费订单ID。",
"en": "The prepaid order ID."
},
"Value": {
"Fn::GetAtt": [
"RedisCluster",
"OrderId"
]
}
}
}
}