全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::REDIS::Whitelist

更新時間:Feb 06, 2026

ALIYUN::REDIS::Whitelist 類型用於設定Redis執行個體的IP白名單。

文法

{
  "Type": "ALIYUN::REDIS::Whitelist",
  "Properties": {
    "InstanceId": String,
    "SecurityIpGroupName": String,
    "SecurityIpGroupAttribute": String,
    "SecurityIps": String
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

InstanceId

String

Redis執行個體ID (全域唯一)

SecurityIpGroupName

String

白名單分組名稱,預設值:default。

SecurityIpGroupAttribute

String

白名單分組的屬性值。預設為空白,控制台將不顯示該值為hidden的白名單分組。

SecurityIps

String

IP白名單分組下的IP列表。IP之間以英文逗號隔開,格式如下:0.0.0.0/0,10.23.12.24,或者10.23.12.24/24(CIDR模式,無類域間路由,/24表示地址中首碼的長度,範圍1-32)。

最多1000個

傳回值

Fn::GetAtt

  • SecurityIpGroupName:白名單分組名稱

  • SecurityIpGroupAttribute:白名單分組屬性值

  • SecurityIps:IP地址白名單

樣本

情境 1 :為Redis添加 IP白名單

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  InstanceId:
    Type: String
    Description: Redis執行個體ID(全域唯一)
    AssociationProperty: ALIYUN::Redis::Instance::InstanceId
Resources:
  Whitelist:
    Type: ALIYUN::REDIS::Whitelist
    Properties:
      InstanceId:
        Ref: InstanceId
      SecurityIpGroupName: ros
      SecurityIpGroupAttribute: show
      SecurityIps: 0.0.0.0/0
Outputs:
  SecurityIpGroupName:
    Description: 白名單分組名稱
    Value:
      Fn::GetAtt:
        - Whitelist
        - SecurityIpGroupName
  SecurityIpGroupAttribute:
    Description: 白名單分組屬性值
    Value:
      Fn::GetAtt:
        - Whitelist
        - SecurityIpGroupAttribute
  SecurityIps:
    Description: IP地址白名單
    Value:
      Fn::GetAtt:
        - Whitelist
        - SecurityIps
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "InstanceId": {
      "Type": "String",
      "Description": "Redis執行個體ID(全域唯一)",
      "AssociationProperty": "ALIYUN::Redis::Instance::InstanceId"
    }
  },
  "Resources": {
    "Whitelist": {
      "Type": "ALIYUN::REDIS::Whitelist",
      "Properties": {
        "InstanceId": {
          "Ref": "InstanceId"
        },
        "SecurityIpGroupName": "ros",
        "SecurityIpGroupAttribute": "show",
        "SecurityIps": "0.0.0.0/0"
      }
    }
  },
  "Outputs": {
    "SecurityIpGroupName": {
      "Description": "白名單分組名稱",
      "Value": {
        "Fn::GetAtt": [
          "Whitelist",
          "SecurityIpGroupName"
        ]
      }
    },
    "SecurityIpGroupAttribute": {
      "Description": "白名單分組屬性值",
      "Value": {
        "Fn::GetAtt": [
          "Whitelist",
          "SecurityIpGroupAttribute"
        ]
      }
    },
    "SecurityIps": {
      "Description": "IP地址白名單",
      "Value": {
        "Fn::GetAtt": [
          "Whitelist",
          "SecurityIps"
        ]
      }
    }
  }
}

情境 2 :建立Redis,並添加 IP白名單

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description: {}
Parameters:
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  ZoneId:
    Type: String
    Description:
      zh-cn: 建立執行個體前,請確認可用性區域是否支援Redis資源的規格。
      en: Before you create an instance, confirm that the Availability Zone supports the specifications of Redis resources.
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Label:
      en: Zone ID
      zh-cn: 可用性區域
  VSwitchId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    AssociationPropertyMetadata:
      VpcId: ${VpcId}
      ZoneId: ${ZoneId}
Resources:
  RedisInstance:
    Type: ALIYUN::REDIS::Instance
    Properties:
      VpcId:
        Ref: VpcId
      VSwitchId:
        Ref: VSwitchId
      InstanceClass: redis.master.small.default
      EvictionPolicy: noeviction
      ZoneId:
        Ref: ZoneId
      InstanceName: DefaultRedis
      Password: Admin@123!
  REDISWhitelist:
    Type: ALIYUN::REDIS::Whitelist
    Properties:
      InstanceId:
        Ref: RedisInstance
      SecurityIps: 192.168.0.0/16
Outputs:
  InstanceId:
    Value:
      Fn::GetAtt:
        - RedisInstance
        - InstanceId                     
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {},
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "ZoneId": {
      "Type": "String",
      "Description": {
        "zh-cn": "建立執行個體前,請確認可用性區域是否支援Redis資源的規格。",
        "en": "Before you create an instance, confirm that the Availability Zone supports the specifications of Redis resources."
      },
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Label": {
        "en": "Zone ID",
        "zh-cn": "可用性區域"
      }
    },
    "VSwitchId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "AssociationPropertyMetadata": {
        "VpcId": "${VpcId}",
        "ZoneId": "${ZoneId}"
      }
    }
  },
  "Resources": {
    "RedisInstance": {
      "Type": "ALIYUN::REDIS::Instance",
      "Properties": {
        "VpcId": {
          "Ref": "VpcId"
        },
        "VSwitchId": {
          "Ref": "VSwitchId"
        },
        "InstanceClass": "redis.master.small.default",
        "EvictionPolicy": "noeviction",
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "InstanceName": "DefaultRedis",
        "Password": "Admin@123!"
      }
    },
    "REDISWhitelist": {
      "Type": "ALIYUN::REDIS::Whitelist",
      "Properties": {
        "InstanceId": {
          "Ref": "RedisInstance"
        },
        "SecurityIps": "192.168.0.0/16"
      }
    }
  },
  "Outputs": {
    "InstanceId": {
      "Value": {
        "Fn::GetAtt": [
          "RedisInstance",
          "InstanceId"
        ]
      }
    }
  }
}

情境 3 :通過DTS實現MySQL與Redis的緩衝同步

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 該模板通過DTS實現MySQL與Redis的緩衝同步,包括VPC、ECS、RDS、Redis執行個體建立及安全配置,同時設定消費組確保資料一致性。
  en: This template achieves cache synchronization between MySQL and Redis via DTS,
    encompassing the creation and security configuration of VPC, ECS, RDS, and Redis
    instances, alongside the establishment of consumer groups to ensure data consistency.
Parameters:
  ZoneId:
    Type: String
    Label:
      en: VSwitch Availability Zone
      zh-cn: 交換器可用性區域
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
  RDSDBUser:
    Type: String
    Label:
      en: RDS DB Username
      zh-cn: RDS資料庫帳號
    Description:
      en: Username of database.
      zh-cn: RDS資料庫帳號。
    ConstraintDescription:
      en: Consist of 2 to 16 characters of lowercase letters, underline. Must begin
        with a letter and be end with an alphanumeric character.
      zh-cn: 由 2 到 16 個小寫字母組成,底線。必須以字母開頭,以字母數字字元結尾。
    Default: demouser123
    MinLength: 2
    MaxLength: 16
  DbName:
    Type: String
    Label:
      en: RDS DB Name
      zh-cn: RDS資料庫名稱
    ConstraintDescription:
      en: Consist of 2 to 16 characters of lowercase letters, underline. Must begin with a letter and be end with an alphanumeric character.
      zh-cn: 由 2 到 16 個小寫字母組成,底線。必須以字母開頭,以字母數字字元結尾。
    Default: demodb
    Required: true
    MinLength: 2
    MaxLength: 16
  RDSDBPassword:
    Type: String
    Label:
      en: RDS DB Password
      zh-cn: RDS資料庫密碼
    Description:
      en: RDS database password, consisting of letters, numbers, and underline(_),
        is 8 to 32 characters long,Must contain three different types of characters.
      zh-cn: RDS資料庫密碼,由字母、數字、底線(_)組成,長度為8~32個字元,必須包含3種不同類型的字元。
    ConstraintDescription:
      en: Consisting of letters, numbers, and underline(_),
        is 8 to 32 characters long.
      zh-cn: 由字母、數字、底線(_)組成,長度為8~32個字元。
    AssociationProperty: ALIYUN::RDS::Instance::AccountPassword
    MinLength: 8
    MaxLength: 32
    NoEcho: true
  DBInstanceClass:
    Type: String
    Label:
      en: Instance Class
      zh-cn: 執行個體規格
    AssociationProperty: ALIYUN::RDS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: ${ZoneId}
      EngineVersion: "8.0"
      Engine: MySQL
      Category: HighAvailability
      DBInstanceStorageType: cloud_essd
      CommodityCode: bards
    Default: mysql.x4.medium.2c
  DtsJobName:
    Type: String
    Label:
      en: Dts Job Name
      zh-cn: 同步任務名稱
    Description:
      en: You are advised to configure a name with service significance (without unique requirement) for easy identification.
      zh-cn: 建議配置具有業務意義的名稱(無唯一性要求),便於後續識別。
    Default: mysql2redis_dts
  RedisInstanceClass:
    Type: String
    Label:
      en: Tair Specifications
      zh-cn: Tair 規格
    Description:
      en: <font color='blue'><b>Before selecting a model, please confirm whether the model is in stock in the current availability zone. To save testing costs, it is recommended to use a model with 2G memory, for example:tair.rdb.2g</b></font>, see detail:<a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><b><font color='red'>Specification inquiry</font></b></a>.
      zh-cn: <font color='blue'><b>選擇機型前請先確認當前可用性區域下該機型是否有庫存,為節省測試成本,推薦使用2GB的規格,例如:tair.rdb.2g</b></font>,<a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><b><font color='red'>規格查詢</font></b></a>。
    AssociationProperty: ALIYUN::REDIS::Instance::InstanceClass
    AssociationPropertyMetadata:
      Engine: Redis
      ProductType: Tair_rdb
      InstanceChargeType: PostPaid
      ZoneId: ${ZoneId1}
      OrderType: BUY
    Default: tair.rdb.2g
  RedisPassword:
    Type: String
    Label:
      en: Instance Password
      zh-cn: 執行個體密碼
    Description:
      en: 'Length 8-32 characters, can contain size letters, Numbers and special symbols,
        including:! @ # $ % ^ & * ( ) _ + - ='
      zh-cn: 長度8-32個字元,可包含大小字母、數字及特殊符號(包含:!@#$%^&*()_+-=)
    ConstraintDescription:
      en: '8-32 characters, can contain size letters, Numbers and special symbols,
        including:! @ # $ % ^ & * ( ) _ + - ='
      zh-cn: 8-32個字元,可包含大小字母、數字及特殊符號(包含:!@#$%^&*()_+-=)
    MinLength: '8'
    MaxLength: '32'
    NoEcho: true
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: Vpc
      VSwitchName:
        Fn::Join:
          - '-'
          - - VSwitch
            - StackId
            - Ref: ALIYUN::StackId
      CidrBlock: 192.168.0.0/24
  RdsDBInstance:
    Type: ALIYUN::RDS::DBInstance
    Properties:
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: Vpc
      VSwitchId:
        Ref: VSwitch
      DBInstanceClass:
        Ref: DBInstanceClass
      DBInstanceStorage: 100
      Engine: MySQL
      EngineVersion: "8.0"
      MasterUserPassword:
        Ref: RDSDBPassword
      MasterUserType: Super
      MasterUsername:
        Ref: RDSDBUser
      DBMappings:
        - CharacterSetName: utf8mb4
          DBName:
            Ref: DbName
      Category: HighAvailability
      DBInstanceStorageType: cloud_essd
      SecurityIPList: 192.168.0.0/16
      SlaveZoneIds:
        - Ref: ZoneId
  RedisInstance:
    Type: ALIYUN::REDIS::Instance
    Properties:
      ZoneId:
        Ref: ZoneId
      VpcId:
        Ref: Vpc
      VSwitchId:
        Ref: VSwitch
      InstanceClass:
        Ref: RedisInstanceClass
      InstanceName: rds_mysql2redis_redis
      EvictionPolicy: noeviction
      EngineVersion: '6.0'
      Password:
        Ref: RedisPassword
  Whitelist:
    Type: ALIYUN::REDIS::Whitelist
    Properties:
      InstanceId:
        Ref: RedisInstance
      SecurityIps: 192.168.0.0/16
  MigrationJob:
    Type: ALIYUN::DTS::SynchronizationJob2
    Properties:
      DtsJobName:
        Ref: DtsJobName
      SourceEndpoint:
        InstanceType: RDS
        InstanceID:
          Ref: RdsDBInstance
        EngineName: MYSQL
        Region:
          Ref: ALIYUN::Region
        UserName:
          Ref: RDSDBUser
        Password:
          Ref: RDSDBPassword
      DestinationEndpoint:
        InstanceType: Redis
        InstanceID:
          Ref: RedisInstance
        EngineName: Redis
        Region:
          Ref: ALIYUN::Region
        Password:
          Ref: RedisPassword
      StructureInitialization: false
      DelayNotice: true
      ErrorNotice: true
      DelayRuleTime: 60
      DataInitialization: true
      DataSynchronization: true
      DbList:
        Fn::GetJsonValue:
          - DbList
          - Fn::Sub: '{ "DbList": { "${DbName}": {   "name": "0",   "all": true,   "customAttachedColumn": {     "__DTS_TP_TO_REDIS_KEY__": {       "name": "__DTS_TP_TO_REDIS_KEY__",       "syntacticType": "ADD",       "value": "__DB__+''.''+__TB__+''.''+pk_str_with_name_value(''.'',''.'')",       "type": "STRING",       "length": ""     },     "__DTS_TP_TO_REDIS_VALUE__": {       "name": "__DTS_TP_TO_REDIS_VALUE__",       "syntacticType": "ADD",       "value": "tp2redis_json_value()",       "type": "STRING",       "length": ""     }   } }}}'
  DtsInstance:
    Type: ALIYUN::DTS::Instance
    Properties:
      JobId:
        Fn::GetAtt:
          - MigrationJob
          - DtsJobId
      InstanceClass: small
      PayType: PostPaid
      AutoStart: true
      Type: SYNC
      SourceRegion:
        Ref: ALIYUN::Region
      DestinationRegion:
        Ref: ALIYUN::Region
      SourceEndpointEngineName: MySQL
      DestinationEndpointEngineName: Redis
Outputs:
  RdsInstanceAddress:
    Description:
      en: RDS Instance Address.
      zh-cn: RDS執行個體地址。
    Value:
      'Fn::Sub':
        - 'https://rds.console.alibabacloud.com/detail/${InstanceID}/basicInfo?region=${Region}'
        - InstanceID:
            Ref: RdsDBInstance
          Region:
            Ref: ALIYUN::Region
  TairInstanceAddress:
    Description:
      en: Tair Instance Address.
      zh-cn: Tair執行個體地址。
    Value:
      'Fn::Sub':
        - 'https://kvstore.console.alibabacloud.com/Redis/instance/${Region}/${InstanceID}'
        - InstanceID:
            Ref: RedisInstance
          Region:
            Ref: ALIYUN::Region
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - ZoneId
        Label:
          default:
            en: Infrastructure Configuration
            zh-cn: 基礎資源配置(必填)
      - Parameters:
          - DBInstanceClass
          - DbName
          - RDSDBUser
          - RDSDBPassword
        Label:
          default: RDS
      - Parameters:
          - RedisInstanceClass
          - RedisPassword
        Label:
          default: Tair
      - Parameters:
          - DtsJobName
        Label:
          default: DTS
    TemplateTags:
      - acs:technical-solution:database:即時同步RDS與Redis構建緩衝一致性-tech_solu_21
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "該模板通過DTS實現MySQL與Redis的緩衝同步,包括VPC、ECS、RDS、Redis執行個體建立及安全配置,同時設定消費組確保資料一致性。",
    "en": "This template achieves cache synchronization between MySQL and Redis via DTS, encompassing the creation and security configuration of VPC, ECS, RDS, and Redis instances, alongside the establishment of consumer groups to ensure data consistency."
  },
  "Parameters": {
    "ZoneId": {
      "Type": "String",
      "Label": {
        "en": "VSwitch Availability Zone",
        "zh-cn": "交換器可用性區域"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
    },
    "RDSDBUser": {
      "Type": "String",
      "Label": {
        "en": "RDS DB Username",
        "zh-cn": "RDS資料庫帳號"
      },
      "Description": {
        "en": "Username of database.",
        "zh-cn": "RDS資料庫帳號。"
      },
      "ConstraintDescription": {
        "en": "Consist of 2 to 16 characters of lowercase letters, underline. Must begin with a letter and be end with an alphanumeric character.",
        "zh-cn": "由 2 到 16 個小寫字母組成,底線。必須以字母開頭,以字母數字字元結尾。"
      },
      "Default": "demouser123",
      "MinLength": 2,
      "MaxLength": 16
    },
    "DbName": {
      "Type": "String",
      "Label": {
        "en": "RDS DB Name",
        "zh-cn": "RDS資料庫名稱"
      },
      "ConstraintDescription": {
        "en": "Consist of 2 to 16 characters of lowercase letters, underline. Must begin with a letter and be end with an alphanumeric character.",
        "zh-cn": "由 2 到 16 個小寫字母組成,底線。必須以字母開頭,以字母數字字元結尾。"
      },
      "Default": "demodb",
      "Required": true,
      "MinLength": 2,
      "MaxLength": 16
    },
    "RDSDBPassword": {
      "Type": "String",
      "Label": {
        "en": "RDS DB Password",
        "zh-cn": "RDS資料庫密碼"
      },
      "Description": {
        "en": "RDS database password, consisting of letters, numbers, and underline(_), is 8 to 32 characters long,Must contain three different types of characters.",
        "zh-cn": "RDS資料庫密碼,由字母、數字、底線(_)組成,長度為8~32個字元,必須包含3種不同類型的字元。"
      },
      "ConstraintDescription": {
        "en": "Consisting of letters, numbers, and underline(_), is 8 to 32 characters long.",
        "zh-cn": "由字母、數字、底線(_)組成,長度為8~32個字元。"
      },
      "AssociationProperty": "ALIYUN::RDS::Instance::AccountPassword",
      "MinLength": 8,
      "MaxLength": 32,
      "NoEcho": true
    },
    "DBInstanceClass": {
      "Type": "String",
      "Label": {
        "en": "Instance Class",
        "zh-cn": "執行個體規格"
      },
      "AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "${ZoneId}",
        "EngineVersion": "8.0",
        "Engine": "MySQL",
        "Category": "HighAvailability",
        "DBInstanceStorageType": "cloud_essd",
        "CommodityCode": "bards"
      },
      "Default": "mysql.x4.medium.2c"
    },
    "DtsJobName": {
      "Type": "String",
      "Label": {
        "en": "Dts Job Name",
        "zh-cn": "同步任務名稱"
      },
      "Description": {
        "en": "You are advised to configure a name with service significance (without unique requirement) for easy identification.",
        "zh-cn": "建議配置具有業務意義的名稱(無唯一性要求),便於後續識別。"
      },
      "Default": "mysql2redis_dts"
    },
    "RedisInstanceClass": {
      "Type": "String",
      "Label": {
        "en": "Tair Specifications",
        "zh-cn": "Tair 規格"
      },
      "Description": {
        "en": "<font color='blue'><b>Before selecting a model, please confirm whether the model is in stock in the current availability zone. To save testing costs, it is recommended to use a model with 2G memory, for example:tair.rdb.2g</b></font>, see detail:<a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><b><font color='red'>Specification inquiry</font></b></a>.",
        "zh-cn": "<font color='blue'><b>選擇機型前請先確認當前可用性區域下該機型是否有庫存,為節省測試成本,推薦使用2GB的規格,例如:tair.rdb.2g</b></font>,<a href='https://www.alibabacloud.com/help/zh/redis/product-overview/enhanced-performance' target='_blank'><b><font color='red'>規格查詢</font></b></a>。"
      },
      "AssociationProperty": "ALIYUN::REDIS::Instance::InstanceClass",
      "AssociationPropertyMetadata": {
        "Engine": "Redis",
        "ProductType": "Tair_rdb",
        "InstanceChargeType": "PostPaid",
        "ZoneId": "${ZoneId1}",
        "OrderType": "BUY"
      },
      "Default": "tair.rdb.2g"
    },
    "RedisPassword": {
      "Type": "String",
      "Label": {
        "en": "Instance Password",
        "zh-cn": "執行個體密碼"
      },
      "Description": {
        "en": "Length 8-32 characters, can contain size letters, Numbers and special symbols, including:! @ # $ % ^ & * ( ) _ + - =",
        "zh-cn": "長度8-32個字元,可包含大小字母、數字及特殊符號(包含:!@#$%^&*()_+-=)"
      },
      "ConstraintDescription": {
        "en": "8-32 characters, can contain size letters, Numbers and special symbols, including:! @ # $ % ^ & * ( ) _ + - =",
        "zh-cn": "8-32個字元,可包含大小字母、數字及特殊符號(包含:!@#$%^&*()_+-=)"
      },
      "MinLength": "8",
      "MaxLength": "32",
      "NoEcho": true
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16"
      }
    },
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "VSwitch",
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "CidrBlock": "192.168.0.0/24"
      }
    },
    "RdsDBInstance": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "DBInstanceStorage": 100,
        "Engine": "MySQL",
        "EngineVersion": "8.0",
        "MasterUserPassword": {
          "Ref": "RDSDBPassword"
        },
        "MasterUserType": "Super",
        "MasterUsername": {
          "Ref": "RDSDBUser"
        },
        "DBMappings": [
          {
            "CharacterSetName": "utf8mb4",
            "DBName": {
              "Ref": "DbName"
            }
          }
        ],
        "Category": "HighAvailability",
        "DBInstanceStorageType": "cloud_essd",
        "SecurityIPList": "192.168.0.0/16",
        "SlaveZoneIds": [
          {
            "Ref": "ZoneId"
          }
        ]
      }
    },
    "RedisInstance": {
      "Type": "ALIYUN::REDIS::Instance",
      "Properties": {
        "ZoneId": {
          "Ref": "ZoneId"
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "VSwitchId": {
          "Ref": "VSwitch"
        },
        "InstanceClass": {
          "Ref": "RedisInstanceClass"
        },
        "InstanceName": "rds_mysql2redis_redis",
        "EvictionPolicy": "noeviction",
        "EngineVersion": "6.0",
        "Password": {
          "Ref": "RedisPassword"
        }
      }
    },
    "Whitelist": {
      "Type": "ALIYUN::REDIS::Whitelist",
      "Properties": {
        "InstanceId": {
          "Ref": "RedisInstance"
        },
        "SecurityIps": "192.168.0.0/16"
      }
    },
    "MigrationJob": {
      "Type": "ALIYUN::DTS::SynchronizationJob2",
      "Properties": {
        "DtsJobName": {
          "Ref": "DtsJobName"
        },
        "SourceEndpoint": {
          "InstanceType": "RDS",
          "InstanceID": {
            "Ref": "RdsDBInstance"
          },
          "EngineName": "MYSQL",
          "Region": {
            "Ref": "ALIYUN::Region"
          },
          "UserName": {
            "Ref": "RDSDBUser"
          },
          "Password": {
            "Ref": "RDSDBPassword"
          }
        },
        "DestinationEndpoint": {
          "InstanceType": "Redis",
          "InstanceID": {
            "Ref": "RedisInstance"
          },
          "EngineName": "Redis",
          "Region": {
            "Ref": "ALIYUN::Region"
          },
          "Password": {
            "Ref": "RedisPassword"
          }
        },
        "StructureInitialization": false,
        "DelayNotice": true,
        "ErrorNotice": true,
        "DelayRuleTime": 60,
        "DataInitialization": true,
        "DataSynchronization": true,
        "DbList": {
          "Fn::GetJsonValue": [
            "DbList",
            {
              "Fn::Sub": "{ \"DbList\": { \"${DbName}\": {   \"name\": \"0\",   \"all\": true,   \"customAttachedColumn\": {     \"__DTS_TP_TO_REDIS_KEY__\": {       \"name\": \"__DTS_TP_TO_REDIS_KEY__\",       \"syntacticType\": \"ADD\",       \"value\": \"__DB__+'.'+__TB__+'.'+pk_str_with_name_value('.','.')\",       \"type\": \"STRING\",       \"length\": \"\"     },     \"__DTS_TP_TO_REDIS_VALUE__\": {       \"name\": \"__DTS_TP_TO_REDIS_VALUE__\",       \"syntacticType\": \"ADD\",       \"value\": \"tp2redis_json_value()\",       \"type\": \"STRING\",       \"length\": \"\"     }   } }}}"
            }
          ]
        }
      }
    },
    "DtsInstance": {
      "Type": "ALIYUN::DTS::Instance",
      "Properties": {
        "JobId": {
          "Fn::GetAtt": [
            "MigrationJob",
            "DtsJobId"
          ]
        },
        "InstanceClass": "small",
        "PayType": "PostPaid",
        "AutoStart": true,
        "Type": "SYNC",
        "SourceRegion": {
          "Ref": "ALIYUN::Region"
        },
        "DestinationRegion": {
          "Ref": "ALIYUN::Region"
        },
        "SourceEndpointEngineName": "MySQL",
        "DestinationEndpointEngineName": "Redis"
      }
    }
  },
  "Outputs": {
    "RdsInstanceAddress": {
      "Description": {
        "en": "RDS Instance Address.",
        "zh-cn": "RDS執行個體地址。"
      },
      "Value": {
        "Fn::Sub": [
          "https://rds.console.alibabacloud.com/detail/${InstanceID}/basicInfo?region=${Region}",
          {
            "InstanceID": {
              "Ref": "RdsDBInstance"
            },
            "Region": {
              "Ref": "ALIYUN::Region"
            }
          }
        ]
      }
    },
    "TairInstanceAddress": {
      "Description": {
        "en": "Tair Instance Address.",
        "zh-cn": "Tair執行個體地址。"
      },
      "Value": {
        "Fn::Sub": [
          "https://kvstore.console.alibabacloud.com/Redis/instance/${Region}/${InstanceID}",
          {
            "InstanceID": {
              "Ref": "RedisInstance"
            },
            "Region": {
              "Ref": "ALIYUN::Region"
            }
          }
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId"
          ],
          "Label": {
            "default": {
              "en": "Infrastructure Configuration",
              "zh-cn": "基礎資源配置(必填)"
            }
          }
        },
        {
          "Parameters": [
            "DBInstanceClass",
            "DbName",
            "RDSDBUser",
            "RDSDBPassword"
          ],
          "Label": {
            "default": "RDS"
          }
        },
        {
          "Parameters": [
            "RedisInstanceClass",
            "RedisPassword"
          ],
          "Label": {
            "default": "Tair"
          }
        },
        {
          "Parameters": [
            "DtsJobName"
          ],
          "Label": {
            "default": "DTS"
          }
        }
      ],
      "TemplateTags": [
        "acs:technical-solution:database:即時同步RDS與Redis構建緩衝一致性-tech_solu_21"
      ]
    }
  }
}

更多樣本,請參考包含此資源的公用模板