ALIYUN::REDIS::PrepayInstance

更新时间:
复制 MD 格式

ALIYUN::REDIS::PrepayInstance creates a subscription Tair (Redis) instance.

Syntax

  {
  "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,
    "Connections": Map,
    "AutoRenewDuration": Integer,
    "ProductType": String,
    "SecondaryZoneId": String,
    "ResourceGroupId": String,
    "PeriodUnit": String,
    "TairConfig": Map,
    "ShardCount": Integer,
    "ReadOnlyCount": Integer,
    "SubscriptionDeletionForce": Boolean,
    "NodeType": String,
    "DeletionProtection": Boolean
  }
}

Properties

Property

Type

Required

Editable

Description

Constraints

AutoPay

Boolean

No

No

Whether to enable automatic payment.

Valid values:

  • true: Enables automatic payment.

  • false (default): Disables automatic payment.

AutoRenewDuration

Integer

No

Yes

The auto-renewal period.

Valid values: 1 to 12.

Unit: month.

The instance is automatically renewed for this duration before expiration.

BackupPolicy

Map

No

Yes

The backup policy.

For more information, see BackupPolicy properties.

Connections

Map

No

Yes

The endpoints of the instance.

For more information, see Connections properties.

DeletionForce

Boolean

No

Yes

Whether to delete the instance immediately instead of moving it to the recycle bin.

Valid values:

  • true: The instance is deleted immediately.

  • false (default): The instance is moved to the recycle bin.

DeletionProtection

Boolean

No

Yes

Whether to enable deletion protection.

Valid values:

  • true: Enabled

  • false: Disabled

EngineVersion

String

No

Yes

The database engine version.

Valid values:

  • 2.8

    Note

    This version is discontinued. Select another version.

  • 4.0

  • 5.0

EvictionPolicy

String

No

No

The eviction policy.

Valid values:

  • noeviction: Does not evict any keys, but returns an error for write operations.

  • allkeys-lru: Evicts the least recently used (LRU) keys first.

  • volatile-lru: Evicts the LRU keys only from keys that have an expiration time set.

  • allkeys-random: Evicts keys at random.

  • volatile-random: Removes random keys from among those with an expiration set.

  • volatile-ttl: Evicts keys with the shortest time to live (TTL) only from keys that have an expiration time set.

InstanceClass

String

No

Yes

The instance specification.

For more information, see Instance Specifications Overview.

InstanceMaintainTime

Map

No

Yes

The maintenance window of the instance.

For more information, see InstanceMaintainTime properties.

InstanceName

String

No

Yes

The instance name.

Must be 2 to 128 characters. Must start with a letter or Chinese character. Can contain letters, digits, Chinese characters, underscores (_), hyphens (-), and periods (.).

NodeType

String

No

No

The node type.

Valid values:

  • MASTER_SLAVE: high availability (master-replica).

  • STAND_ALONE: standalone.

  • double: master-replica.

  • single: standalone.

Note

For cloud-native edition instances, select MASTER_SLAVE or STAND_ALONE. For classic edition instances, select double or single.

Password

String

No

Yes

The instance password.

Must be 8 to 32 characters and include characters from at least three categories: uppercase letters, lowercase letters, digits, and special characters. Supported special characters: !@#$%^&*()_+-=.

Period

Integer

No

No

The subscription duration.

Valid values: 1 to 9, 12, 24, and 36.

Unit: month.

PeriodUnit

String

No

No

The unit of the subscription duration.

Valid values:

  • Year: year.

  • Month: month.

ProductType

String

No

No

The product type.

Valid values:

  • Local: Community Edition (local disk) or Performance-enhanced Edition (local disk) instances.

  • Tair_rdb: Performance-enhanced Edition (cloud disk) instances.

  • Tair_scm: Persistent Memory-optimized instances.

  • Tair_essd: Storage-optimized instances.

  • OnECS: Community Edition (cloud disk) instances.

ReadOnlyCount

Integer

No

No

The number of read replicas in the primary availability zone.

Note

The ReadOnlyCount parameter applies only to cloud-native edition instances for which the read/write splitting feature is enabled. If the instance uses the cluster architecture, this parameter specifies the number of read replicas per shard.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None

SecondaryZoneId

String

No

Yes

The ID of the secondary availability zone.

Call the DescribeZones operation to query supported availability zone IDs.

Note

Deploy primary and secondary nodes in different zones for cross-zone disaster recovery.

SecurityGroupId

String

No

Yes

The ID of the security group.

Up to 10 IDs, separated by commas (,).

ShardCount

Integer

No

No

The number of shards.

Valid values:

  • 1 (default): Standard architecture with a single shard.

  • 2 to 32: Cluster architecture with the specified number of shards.

SSLEnabled

String

No

Yes

The SSL encryption state.

Valid values:

  • Disable: SSL encryption is disabled.

  • Enable: SSL encryption is enabled.

  • Update: The SSL certificate is being updated.

SubscriptionDeletionForce

Boolean

No

No

Subscription instances only. Set to true to convert the instance to pay-as-you-go and delete it. Set to false to block deletion. This may incur fees.

None

Tags

List

No

Yes

The tags of the instance.

Maximum 20 tags per instance.

For more information, see Tags properties.

TairConfig

Map

No

No

The Tair configuration.

For more information, see TairConfig properties.

TLSProtocol

String

No

No

The TLS version of the instance.

Valid values:

  • TLSv1

  • TLSv1.1

  • TLSv1.2

  • TLSv1.3

VpcId

String

No

No

The ID of the VPC.

None

VpcPasswordFree

Boolean

No

No

Whether to enable password-free access within the VPC.

Valid values:

  • true: Enabled

  • false (default): Disabled

VSwitchId

String

No

No

The ID of the vSwitch.

None

ZoneId

String

No

No

The ID of the availability zone.

This parameter is required for instances in a VPC.

To deploy an instance across multiple availability zones, use the DescribeZones operation to find supported zone IDs.

BackupPolicy syntax

"BackupPolicy": {
  "PreferredBackupPeriod": "String",
  "PreferredBackupTime": "String",
  "EnableBackupLog": "Integer"
}

BackupPolicy properties

Property

Type

Required

Editable

Description

Constraints

PreferredBackupPeriod

String

Yes

Yes

The backup day of the week.

Valid values:

  • Monday

  • Tuesday

  • Wednesday

  • Thursday

  • Friday

  • Saturday

  • Sunday

PreferredBackupTime

String

Yes

Yes

The backup time window in UTC.

Format: HH:mmZ-HH:mmZ.

EnableBackupLog

Integer

No

Yes

Whether to enable incremental backup.

Valid values:

  • 1: Enables incremental backup.

  • 0 (default): Disables incremental backup.

InstanceMaintainTime syntax

"InstanceMaintainTime": {
  "MaintainStartTime": "String",
  "MaintainEndTime": "String"
}

InstanceMaintainTime properties

Property

Type

Required

Editable

Description

Constraints

MaintainEndTime

String

No

No

The end time of the maintenance window.

Format: HH:mmZ (UTC). For example, 23:00 (UTC+8) is specified as 15:00Z.

Note

The end time must be exactly one hour after the start time. For example, if MaintainStartTime is 17:00Z, MaintainEndTime must be 18:00Z.

MaintainStartTime

String

No

No

The start time of the maintenance window.

Format: HH:mmZ (UTC). For example, 22:00 (UTC+8) is specified as 14:00Z.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraints

Key

String

Yes

No

The tag key.

The tag key must be unique within an account and region.

Value

String

No

No

The tag value.

None

Connections syntax

"Connections": {
  "VpcPrivateConnection": "Map",
  "ClassicInnerConnection": "Map",
  "DirectConnection": "Map",
  "PublicConnection": "Map"
}

Connections properties

Property

Type

Required

Editable

Description

Constraints

ClassicInnerConnection

Map

No

Yes

The classic network endpoint.

For more information, see ClassicInnerConnection properties.

DirectConnection

Map

No

Yes

The direct connection endpoint.

For more information, see DirectConnection properties.

PublicConnection

Map

No

Yes

The public endpoint.

For more information, see PublicConnection properties.

VpcPrivateConnection

Map

No

Yes

The VPC endpoint.

For more information, see VpcPrivateConnection properties.

VpcPrivateConnection syntax

"VpcPrivateConnection": {
  "ConnectionPort": Integer,
  "ConnectionString": String
}

VpcPrivateConnection properties

Property

Type

Required

Editable

Description

Constraints

ConnectionPort

Integer

Yes

Yes

The port number for the ApsaraDB service on the instance.

Valid values: 1024 to 65535.

ConnectionString

String

No

Yes

The VPC endpoint prefix.

The prefix must be 8 to 64 characters long, start with a lowercase letter, and contain only lowercase letters and digits.

PublicConnection syntax

"PublicConnection": {
  "ConnectionPort": Integer,
  "ConnectionString": String
}

PublicConnection properties

Property

Type

Required

Editable

Description

Constraints

ConnectionPort

Integer

Yes

Yes

Service port of the ApsaraDB instance.

Valid values: 1024 to 65535.

ConnectionString

String

No

Yes

Public endpoint prefix.

Must be 8 to 64 characters long, start with a lowercase letter, and contain only lowercase letters and digits.

DirectConnection syntax

"DirectConnection": {
  "ConnectionPort": Integer,
  "ConnectionString": String
}

DirectConnection properties

Property

Type

Required

Editable

Description

Constraints

ConnectionPort

Integer

Yes

Yes

The service port of the ApsaraDB instance.

Valid values: 1024 to 65535.

ConnectionString

String

No

Yes

The prefix of the private endpoint.

The prefix must be 8 to 64 characters long, start with a lowercase letter, and contain only lowercase letters and digits.

ClassicInnerConnection syntax

"ClassicInnerConnection": {
  "ConnectionPort": Integer,
  "ConnectionString": String
}

ClassicInnerConnection properties

Property

Type

Required

Editable

Description

Constraints

ConnectionPort

Integer

Yes

Yes

The service port of the ApsaraDB instance.

Valid values: 1024 to 65535.

ConnectionString

String

No

Yes

The prefix of the classic network endpoint.

The prefix must be 8 to 64 characters long, start with a lowercase letter, and contain only lowercase letters and digits.

TairConfig syntax

"BackupPolicy": {
  "Storage": "Integer",
  "StorageType": "String",
  "ShardCount": "Integer"
}

TairConfig properties

Property

Type

Required

Editable

Description

Constraints

ShardCount

Integer

No

No

The number of data shards.

Valid values:

  • 1 (default): Creates a standard architecture instance.

  • 2 to 32: Creates a cluster architecture instance.

Storage

Integer

No

No

The storage capacity of the cloud disk.

Varies by instance specification. For more information, see ESSD/SSD-based instances.

StorageType

String

No

No

The storage type.

Valid values:

  • essd_pl0

  • essd_pl1

  • essd_pl2

  • essd_pl3

Return values

Fn::GetAtt

  • InstanceId: The ID of the instance.

  • OrderId: The ID of the order.

  • ConnectionDomain: The endpoint used to access the instance.

  • Port: The port used to connect to the instance.

  • InstanceName: The name of the instance.

  • InstanceClass: The instance specifications.

  • VpcId: The ID of the VPC.

  • Capacity: The storage capacity of the instance.

  • InstanceType: The engine type of the instance.

  • ChargeType: The billing method of the instance.

  • PackageType: The plan type.

  • Connections: The maximum number of connections the instance supports.

  • ArchitectureType: The architecture type of the instance.

  • NodeType: The node type of the instance.

  • HasRenewChangeOrder: Whether the account has a pending renewal or scaling order.

  • ResourceGroupId: The ID of the resource group.

  • QPS: The theoretical queries per second (QPS) of the instance.

  • ZoneId: The ID of the instance's zone.

  • Bandwidth: The bandwidth of the instance. Unit: Mbps.

  • EngineVersion: The engine version of the instance.

  • NetworkType: The network type of the instance.

  • VSwitchId: The ID of the vSwitch.

  • PrivateIp: The private IP address of the instance.

  • PublicConnectionString: The public connection string of the instance.

  • VpcPrivateConnectionPort: The port used for a private connection to the instance within a VPC.

  • ClassicInnerConnectionString: The internal connection string for the instance over the classic network.

  • VpcPrivateConnectionString: The VPC private connection string of the instance.

  • PublicConnectionPort: The port used for a public connection to the instance.

  • DirectConnectionString: The direct connection string of the instance.

  • DirectConnectionPort: The port used for a direct connection to the instance.

  • ClassicInnerConnectionPort: The port used for an internal connection to the instance over the classic network.

Examples

Scenario 1: Create a subscription Redis standard edition instance deployed in a VPC network.

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

Scenario 2: Create a subscription Redis instance with backup policy, maintenance window, SSL, and tags.

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

Scenario 3: Create a subscription Redis cluster edition instance with cross-zone disaster recovery, read/write splitting, and resource group.

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