ALIYUN::ECS::VSwitch

ALIYUN::ECS::VSwitch类型用于创建交换机。

语法

{
  "Type": "ALIYUN::ECS::VSwitch",
  "Properties": {
    "VSwitchName": String,
    "VpcId": String,
    "Description": String,
    "Tags": List,
    "Ipv6CidrBlock": Integer,
    "ZoneId": String,
    "CidrBlock": String,
    "VpcIpv6CidrBlock": String,
    "ZoneType": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

VpcId

String

要创建交换机的专有网络ID。

ZoneId

String

可用区ID。

VSwitchName

String

交换机名称。

长度为2~128个字符。必须以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、下划线(_)和短划线(-)。

CidrBlock

String

交换机网段。

必须是所属专有网络的子网段,并且没有被其他交换机占用。

Description

String

交换机描述。

长度为2~256个字符。不能以http://https://开头。

Ipv6CidrBlock

Integer

交换机的IPv6网段。

取值范围:0~255(十进制)。

交换机的IPv6网段掩码默认为64位。

支持自定义VPC IPv6网段的最后8位。

Tags

List

标签。

最多支持20个标签。

更多信息,请参见Tags属性

VpcIpv6CidrBlock

String

专有网络的IPv6网段。

ZoneType

String

要查询的分区类型。

默认值:AvailabilityZone

Tags语法

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

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键。

长度为1~128个字符,不能以aliyunacs:开头,不能包含http://https://

Value

String

标签值。

长度为0~128个字符,不能以aliyunacs:开头,不能包含http://https://

返回值

Fn::GetAtt

  • CidrBlock:交换机的IPv4网段。

  • Ipv6CidrBlock:交换机的IPv6网段。

  • VSwitchId:交换机ID。

  • VSwitchName:交换机名称。

示例

场景 1 :创建VPC专有网络和交换机。

Outputs:
  VSwitch1Name:
    Description: Name of created VSwitch.
    Value:
      Fn::GetAtt:
        - VSwitch
        - VSwitchName
  VpcName:
    Description: Name of created VPC.
    Value:
      Fn::GetAtt:
        - Vpc
        - VpcName
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: VSwitch可用区id,</font><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b> 查看可用区信息</b><font color='blue'></a>。
      en: VSwitch available area id, <a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>.
    Label:
      zh-cn: 交换机1可用区ID
      en: VSwitch 1 ZoneId
  VpcCidrBlock:
    Default: 192.168.0.0/16
    Type: String
    Description:
      zh-cn: VPC的ip地址段范围,<br>您可以使用以下的ip地址段或其子网:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
      en: 'The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
    Label:
      zh-cn: 专有网络网段
      en: VPC CIDR Block
  VSwitchCidrBlock:
    Default: 192.168.1.0/24
    Type: String
    Description:
      zh-cn: 必须属于VPC的子网段。
      en: Must belong to the subnet segment of VPC.
    Label:
      zh-cn: 交换机1子网网段
      en: VSwitch 1 CIDR Block
Resources:
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VSwitchName:
        Fn::Join:
          - '-'
          - - VSwitch
            - StackId
            - Ref: ALIYUN::StackId
      VpcId:
        Ref: Vpc
      CidrBlock:
        Ref: VSwitchCidrBlock
      ZoneId:
        Ref: ZoneId
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      VpcName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
      CidrBlock:
        Ref: VpcCidrBlock
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcCidrBlock
          - ZoneId
          - VSwitchCidrBlock
        Label:
          default: 基础网络配置
{
  "Outputs": {
    "VSwitch1Name": {
      "Description": "Name of created VSwitch.",
      "Value": {
        "Fn::GetAtt": [
          "VSwitch",
          "VSwitchName"
        ]
      }
    },
    "VpcName": {
      "Description": "Name of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VpcName"
        ]
      }
    }
  },
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "VSwitch可用区id,</font><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b> 查看可用区信息</b><font color='blue'></a>。",
        "en": "VSwitch available area id, <a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>."
      },
      "Label": {
        "zh-cn": "交换机1可用区ID",
        "en": "VSwitch 1 ZoneId"
      }
    },
    "VpcCidrBlock": {
      "Default": "192.168.0.0/16",
      "Type": "String",
      "Description": {
        "zh-cn": "VPC的ip地址段范围,<br>您可以使用以下的ip地址段或其子网:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>",
        "en": "The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
      },
      "Label": {
        "zh-cn": "专有网络网段",
        "en": "VPC CIDR Block"
      }
    },
    "VSwitchCidrBlock": {
      "Default": "192.168.1.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "必须属于VPC的子网段。",
        "en": "Must belong to the subnet segment of VPC."
      },
      "Label": {
        "zh-cn": "交换机1子网网段",
        "en": "VSwitch 1 CIDR Block"
      }
    }
  },
  "Resources": {
    "VSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "VSwitch",
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": {
          "Ref": "VSwitchCidrBlock"
        },
        "ZoneId": {
          "Ref": "ZoneId"
        }
      }
    },
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "VpcName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        }
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcCidrBlock",
            "ZoneId",
            "VSwitchCidrBlock"
          ],
          "Label": {
            "default": "基础网络配置"
          }
        }
      ]
    }
  }
}

场景 2 :创建双可用区VPC专有网络和交换机。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建双可用区VPC网络,含安全组,自动配置子网CIDR,支持自定义IP范围。
  en: Create a dual-Availability Zone VPC network, inclusive of security groups, with automatic subnet CIDR configuration and support for custom IP ranges.
Parameters:
  VSwitch1ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    AssociationPropertyMetadata:
      ExclusiveTo:
        - VSwitch2ZoneId
      AutoSelectFirst: true
    Type: String
    Description:
      zh-cn: VSwitch可用区id,</font><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b> 查看可用区信息</b><font color='blue'></a>。
      en: VSwitch available area id, <a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>.
    Label:
      zh-cn: 交换机1可用区ID
      en: VSwitch 1 ZoneId
  VSwitch2CidrBlock:
    Default: 192.168.2.0/24
    Type: String
    Description:
      zh-cn: 必须属于VPC的子网段。
      en: Must belong to the subnet segment of VPC.
    Label:
      zh-cn: 交换机2子网网段
      en: VSwitch 2 CIDR Block
  VSwitch1CidrBlock:
    Default: 192.168.1.0/24
    Type: String
    Description:
      zh-cn: 必须属于VPC的子网段。
      en: Must belong to the subnet segment of VPC.
    Label:
      zh-cn: 交换机1子网网段
      en: VSwitch 1 CIDR Block
  VpcCidrBlock:
    Default: 192.168.0.0/16
    Type: String
    Description:
      zh-cn: VPC的ip地址段范围,<br>您可以使用以下的ip地址段或其子网:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>
      en: 'The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color=''green''>[10.0.0.0/8]</font><br><font color=''green''>[172.16.0.0/12]</font><br><font color=''green''>[192.168.0.0/16]</font>'
    Label:
      zh-cn: 专有网络网段
      en: VPC CIDR Block
  VSwitch2ZoneId:
    AssociationPropertyMetadata:
      ExclusiveTo:
        - VSwitch1ZoneId
      AutoSelectFirst: true
    Description:
      zh-cn: VSwitch可用区id,不同其他虚拟交换机的可用区Id;</font><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b> 查看可用区信息</b><font color='blue'></a>。
      en: VSwitch available area id, VSwitch available area id, Different from the available area of another virtual switch; <a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>.
    Default: cn-hangzhou-h
    Label:
      zh-cn: 交换机2可用区ID
      en: VSwitch 2 ZoneId
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
Outputs:
  VSwitch1Name:
    Description: Name of created VSwitch1.
    Value:
      Fn::GetAtt:
        - VSwitch1
        - VSwitchName
  VpcName:
    Description: Name of created VPC.
    Value:
      Fn::GetAtt:
        - Vpc
        - VpcName
  VSwitch2Name:
    Description: Name of created VSwitch2.
    Value:
      Fn::GetAtt:
        - VSwitch2
        - VSwitchName
Resources:
  VSwitch2:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VSwitchName:
        Fn::Join:
          - '-'
          - - VSwitch1
            - StackId
            - Ref: ALIYUN::StackId
      VpcId:
        Ref: Vpc
      CidrBlock:
        Ref: VSwitch2CidrBlock
      ZoneId:
        Ref: VSwitch2ZoneId
  VSwitch1:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VSwitchName:
        Fn::Join:
          - '-'
          - - VSwitch1
            - StackId
            - Ref: ALIYUN::StackId
      VpcId:
        Ref: Vpc
      CidrBlock:
        Ref: VSwitch1CidrBlock
      ZoneId:
        Ref: VSwitch1ZoneId
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      VpcName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
      CidrBlock:
        Ref: VpcCidrBlock
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      SecurityGroupIngress:
        - Priority: 1
          IpProtocol: all
          NicType: intranet
          SourceCidrIp: 0.0.0.0/0
          PortRange: '-1/-1'
      VpcId:
        Ref: Vpc
      SecurityGroupEgress:
        - Priority: 1
          IpProtocol: all
          DestCidrIp: 0.0.0.0/0
          NicType: intranet
          PortRange: '-1/-1'
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcCidrBlock
          - VSwitch1ZoneId
          - VSwitch1CidrBlock
          - VSwitch2ZoneId
          - VSwitch2CidrBlock
        Label:
          default: 基础网络配置
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建双可用区VPC网络,含安全组,自动配置子网CIDR,支持自定义IP范围。",
    "en": "Create a dual-Availability Zone VPC network, inclusive of security groups, with automatic subnet CIDR configuration and support for custom IP ranges."
  },
  "Parameters": {
    "VSwitch1ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "VSwitch2ZoneId"
        ],
        "AutoSelectFirst": true
      },
      "Type": "String",
      "Description": {
        "zh-cn": "VSwitch可用区id,</font><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b> 查看可用区信息</b><font color='blue'></a>。",
        "en": "VSwitch available area id, <a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>."
      },
      "Label": {
        "zh-cn": "交换机1可用区ID",
        "en": "VSwitch 1 ZoneId"
      }
    },
    "VSwitch2CidrBlock": {
      "Default": "192.168.2.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "必须属于VPC的子网段。",
        "en": "Must belong to the subnet segment of VPC."
      },
      "Label": {
        "zh-cn": "交换机2子网网段",
        "en": "VSwitch 2 CIDR Block"
      }
    },
    "VSwitch1CidrBlock": {
      "Default": "192.168.1.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "必须属于VPC的子网段。",
        "en": "Must belong to the subnet segment of VPC."
      },
      "Label": {
        "zh-cn": "交换机1子网网段",
        "en": "VSwitch 1 CIDR Block"
      }
    },
    "VpcCidrBlock": {
      "Default": "192.168.0.0/16",
      "Type": "String",
      "Description": {
        "zh-cn": "VPC的ip地址段范围,<br>您可以使用以下的ip地址段或其子网:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>",
        "en": "The ip address range of the VPC in the CidrBlock form; <br>You can use the following ip address ranges and their subnets: <br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
      },
      "Label": {
        "zh-cn": "专有网络网段",
        "en": "VPC CIDR Block"
      }
    },
    "VSwitch2ZoneId": {
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "VSwitch1ZoneId"
        ],
        "AutoSelectFirst": true
      },
      "Description": {
        "zh-cn": "VSwitch可用区id,不同其他虚拟交换机的可用区Id;</font><a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b> 查看可用区信息</b><font color='blue'></a>。",
        "en": "VSwitch available area id, VSwitch available area id, Different from the available area of another virtual switch; <a href='https://help.aliyun.com/document_detail/123712.html' target='_blank'><b><font color='blue'>View region and zone info</font></b></a>."
      },
      "Default": "cn-hangzhou-h",
      "Label": {
        "zh-cn": "交换机2可用区ID",
        "en": "VSwitch 2 ZoneId"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String"
    }
  },
  "Outputs": {
    "VSwitch1Name": {
      "Description": "Name of created VSwitch1.",
      "Value": {
        "Fn::GetAtt": [
          "VSwitch1",
          "VSwitchName"
        ]
      }
    },
    "VpcName": {
      "Description": "Name of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VpcName"
        ]
      }
    },
    "VSwitch2Name": {
      "Description": "Name of created VSwitch2.",
      "Value": {
        "Fn::GetAtt": [
          "VSwitch2",
          "VSwitchName"
        ]
      }
    }
  },
  "Resources": {
    "VSwitch2": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "VSwitch1",
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": {
          "Ref": "VSwitch2CidrBlock"
        },
        "ZoneId": {
          "Ref": "VSwitch2ZoneId"
        }
      }
    },
    "VSwitch1": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "VSwitch1",
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": {
          "Ref": "VSwitch1CidrBlock"
        },
        "ZoneId": {
          "Ref": "VSwitch1ZoneId"
        }
      }
    },
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "VpcName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        }
      }
    },
    "SecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "SecurityGroupIngress": [
          {
            "Priority": 1,
            "IpProtocol": "all",
            "NicType": "intranet",
            "SourceCidrIp": "0.0.0.0/0",
            "PortRange": "-1/-1"
          }
        ],
        "VpcId": {
          "Ref": "Vpc"
        },
        "SecurityGroupEgress": [
          {
            "Priority": 1,
            "IpProtocol": "all",
            "DestCidrIp": "0.0.0.0/0",
            "NicType": "intranet",
            "PortRange": "-1/-1"
          }
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcCidrBlock",
            "VSwitch1ZoneId",
            "VSwitch1CidrBlock",
            "VSwitch2ZoneId",
            "VSwitch2CidrBlock"
          ],
          "Label": {
            "default": "基础网络配置"
          }
        }
      ]
    }
  }
}

场景 3 :创建支持多可用区绑定多交换机的高可用RDS实例。

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 创建支持多可用区高可用的RDS实例。
  en: Create an RDS instance supporting multi-zone high availability.
Parameters:
  ZoneId1:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId2
    Label:
      en: Primary Availability Zone
      zh-cn: 主可用区
  ZoneId2:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId1
    Label:
      en: Standby Availability Zone
      zh-cn: 备可用区
  DBInstanceClass:
    Type: String
    Label:
      en: Instance Class
      zh-cn: 实例规格
    AssociationProperty: ALIYUN::RDS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: ${ZoneId1}
      EngineVersion: '8.0'
      Engine: MySQL
      Category: HighAvailability
      InstanceChargeType: PostPaid
      DBInstanceStorageType: cloud_essd
      CommodityCode: bards
    Default: mysql.n2.medium.2c
  DBUserName:
    Type: String
    Label:
      en: Database Account
      zh-cn: 数据库账号
    Description:
      en: The value can contain a maximum of 32 letters, including lowercase letters, uppercase letters, digits, and underscores (_). It must start with a letter and end with a letter or digit.
      zh-cn: 由小写字母、大写字母、数字、下划线(_)组成,以字母开头,以字母或数字结尾,最多32个字符。
    Default: testuser
  DBPassword:
    Type: String
    Label:
      en: Password
      zh-cn: 密码
    Description:
      en: 'The password must be 8 to 32 characters in length and must contain at least three of the following types: uppercase letters, lowercase letter, digits, and special characters. Special characters include <span style="background:#E7E9EB;"><b>!@#$%^&*()_+-=</b></span>'
      zh-cn: 必须包含三种及以上类型:大写字母、小写字母、数字、特殊符号。长度为8~32位。特殊字符包括<span style="background:#E7E9EB;"><b>!@#$%^&*()_+-=</b></span>
    AssociationProperty: ALIYUN::RDS::Instance::AccountPassword
    NoEcho: true
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 192.168.0.0/16
      VpcName: rds-database-agent-vpc
  VSwitch1:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.1.0/24
      ZoneId:
        Ref: ZoneId1
      VSwitchName: rds-database-vsw-001
  VSwitch2:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: Vpc
      CidrBlock: 192.168.2.0/24
      ZoneId:
        Ref: ZoneId2
      VSwitchName: rds-database-vsw-002
  Database:
    Type: ALIYUN::RDS::DBInstance
    Properties:
      DBInstanceClass:
        Ref: DBInstanceClass
      ZoneId:
        Ref: ZoneId1
      SlaveZoneIds:
        - Ref: ZoneId2
      DBInstanceStorage: 20
      Category: HighAvailability
      DBInstanceStorageType: cloud_essd
      VSwitchId:
        Fn::Join:
          - ','
          - - Ref: VSwitch1
            - Ref: VSwitch2
      Engine: MySQL
      PayType: Postpaid
      VpcId:
        Ref: Vpc
      EngineVersion: '8.0'
      SecurityIPList: 192.168.0.0/16
      MasterUsername:
        Ref: DBUserName
      MasterUserPassword:
        Ref: DBPassword
      MasterUserType: Normal
Outputs: {}
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - ZoneId1
          - ZoneId2
          - DBInstanceClass
          - DBUserName
          - DBPassword
        Label:
          default:
            en: RDS Configuration
            zh-cn: RDS配置
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "创建支持多可用区高可用的RDS实例。",
    "en": "Create an RDS instance supporting multi-zone high availability."
  },
  "Parameters": {
    "ZoneId1": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId2"
        ]
      },
      "Label": {
        "en": "Primary Availability Zone",
        "zh-cn": "主可用区"
      }
    },
    "ZoneId2": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId1"
        ]
      },
      "Label": {
        "en": "Standby Availability Zone",
        "zh-cn": "备可用区"
      }
    },
    "DBInstanceClass": {
      "Type": "String",
      "Label": {
        "en": "Instance Class",
        "zh-cn": "实例规格"
      },
      "AssociationProperty": "ALIYUN::RDS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "${ZoneId1}",
        "EngineVersion": "8.0",
        "Engine": "MySQL",
        "Category": "HighAvailability",
        "InstanceChargeType": "PostPaid",
        "DBInstanceStorageType": "cloud_essd",
        "CommodityCode": "bards"
      },
      "Default": "mysql.n2.medium.2c"
    },
    "DBUserName": {
      "Type": "String",
      "Label": {
        "en": "Database Account",
        "zh-cn": "数据库账号"
      },
      "Description": {
        "en": "The value can contain a maximum of 32 letters, including lowercase letters, uppercase letters, digits, and underscores (_). It must start with a letter and end with a letter or digit.",
        "zh-cn": "由小写字母、大写字母、数字、下划线(_)组成,以字母开头,以字母或数字结尾,最多32个字符。"
      },
      "Default": "testuser"
    },
    "DBPassword": {
      "Type": "String",
      "Label": {
        "en": "Password",
        "zh-cn": "密码"
      },
      "Description": {
        "en": "The password must be 8 to 32 characters in length and must contain at least three of the following types: uppercase letters, lowercase letter, digits, and special characters. Special characters include <span style=\"background:#E7E9EB;\"><b>!@#$%^&*()_+-=</b></span>",
        "zh-cn": "必须包含三种及以上类型:大写字母、小写字母、数字、特殊符号。长度为8~32位。特殊字符包括<span style=\"background:#E7E9EB;\"><b>!@#$%^&*()_+-=</b></span>"
      },
      "AssociationProperty": "ALIYUN::RDS::Instance::AccountPassword",
      "NoEcho": true
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": "192.168.0.0/16",
        "VpcName": "rds-database-agent-vpc"
      }
    },
    "VSwitch1": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.1.0/24",
        "ZoneId": {
          "Ref": "ZoneId1"
        },
        "VSwitchName": "rds-database-vsw-001"
      }
    },
    "VSwitch2": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "VpcId": {
          "Ref": "Vpc"
        },
        "CidrBlock": "192.168.2.0/24",
        "ZoneId": {
          "Ref": "ZoneId2"
        },
        "VSwitchName": "rds-database-vsw-002"
      }
    },
    "Database": {
      "Type": "ALIYUN::RDS::DBInstance",
      "Properties": {
        "DBInstanceClass": {
          "Ref": "DBInstanceClass"
        },
        "ZoneId": {
          "Ref": "ZoneId1"
        },
        "SlaveZoneIds": [
          {
            "Ref": "ZoneId2"
          }
        ],
        "DBInstanceStorage": 20,
        "Category": "HighAvailability",
        "DBInstanceStorageType": "cloud_essd",
        "VSwitchId": {
          "Fn::Join": [
            ",",
            [
              {
                "Ref": "VSwitch1"
              },
              {
                "Ref": "VSwitch2"
              }
            ]
          ]
        },
        "Engine": "MySQL",
        "PayType": "Postpaid",
        "VpcId": {
          "Ref": "Vpc"
        },
        "EngineVersion": "8.0",
        "SecurityIPList": "192.168.0.0/16",
        "MasterUsername": {
          "Ref": "DBUserName"
        },
        "MasterUserPassword": {
          "Ref": "DBPassword"
        },
        "MasterUserType": "Normal"
      }
    }
  },
  "Outputs": {
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "ZoneId1",
            "ZoneId2",
            "DBInstanceClass",
            "DBUserName",
            "DBPassword"
          ],
          "Label": {
            "default": {
              "en": "RDS Configuration",
              "zh-cn": "RDS配置"
            }
          }
        }
      ]
    }
  }
}