All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::VSwitch

Last Updated:Jan 16, 2026

You can use ALIYUN::ECS::VSwitch to create a vSwitch.

Syntax

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

Properties

Property Name

Type

Required

Allow Updates

Description

Constraint

VpcId

String

Yes

No

The ID of the virtual private cloud (VPC) where you want to create the vSwitch.

None

ZoneId

String

Yes

No

The ID of the zone.

None

VSwitchName

String

No

Yes

The name of the vSwitch.

The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character and cannot start with http:// or https://. The name can contain letters, Chinese characters, digits, underscores (_), and hyphens (-).

CidrBlock

String

Yes

No

The vSwitch CIDR block.

The CIDR block must be a subnet of the VPC to which the vSwitch belongs and cannot be used by other vSwitches.

Description

String

No

Yes

The description of the vSwitch.

The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

Ipv6CidrBlock

Integer

No

No

The IPv6 CIDR block for the vSwitch.

The value must be a decimal integer from 0 to 255.

The subnet mask of the IPv6 CIDR block for the vSwitch is 64 bits in length by default.

You can specify the last 8 bits of the IPv6 CIDR block for the VPC.

Tags

List

No

Yes

The tags.

You can add up to 20 tags.

For more information, see Tags properties.

VpcIpv6CidrBlock

String

No

No

The IPv6 CIDR block for the VPC.

None

ZoneType

String

No

No

The type of partition to query.

Default value: AvailabilityZone.

Tags syntax

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

Tags properties

Property Name

Type

Required

Allow Updates

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://.

Value

String

No

No

The tag value.

The tag value must be 0 to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://.

Return values

Fn::GetAtt

  • CidrBlock: The IPv4 CIDR block of the vSwitch.

  • Ipv6CidrBlock: The IPv6 CIDR block of the vSwitch.

  • VSwitchId: The ID of the vSwitch.

  • VSwitchName: The name of the vSwitch.

Examples

Scenario 1: Create a VPC and a vSwitch.

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: The ID of the zone for the vSwitch. </font><a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'> View zone information<font color='blue'></a>.
      en: The ID of the zone for the vSwitch. <a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><font color='blue'>View region and zone info</font></a>.
    Label:
      zh-cn: Zone ID for vSwitch 1
      en: VSwitch 1 ZoneId
  VpcCidrBlock:
    Default: 192.168.0.0/16
    Type: String
    Description:
      zh-cn: The CIDR block of the VPC. <br>You can use the following CIDR blocks or 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>
      en: 'The IP address range of the VPC in CIDR block format. <br>You can use the following IP address ranges or 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: VPC CIDR Block
      en: VPC CIDR Block
  VSwitchCidrBlock:
    Default: 192.168.1.0/24
    Type: String
    Description:
      zh-cn: The CIDR block must be a subnet of the VPC.
      en: The CIDR block must be a subnet of the VPC.
    Label:
      zh-cn: CIDR Block for vSwitch 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: Basic Network Configuration
{
  "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": "The ID of the zone for the vSwitch. </font><a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'> View zone information<font color='blue'></a>.",
        "en": "The ID of the zone for the vSwitch. <a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><font color='blue'>View region and zone info</font></a>."
      },
      "Label": {
        "zh-cn": "Zone ID for vSwitch 1",
        "en": "VSwitch 1 ZoneId"
      }
    },
    "VpcCidrBlock": {
      "Default": "192.168.0.0/16",
      "Type": "String",
      "Description": {
        "zh-cn": "The CIDR block of the VPC. <br>You can use the following CIDR blocks or 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>",
        "en": "The IP address range of the VPC in CIDR block format. <br>You can use the following IP address ranges or 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": "VPC CIDR Block",
        "en": "VPC CIDR Block"
      }
    },
    "VSwitchCidrBlock": {
      "Default": "192.168.1.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "The CIDR block must be a subnet of the VPC.",
        "en": "The CIDR block must be a subnet of the VPC."
      },
      "Label": {
        "zh-cn": "CIDR Block for vSwitch 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": "Basic Network Configuration"
          }
        }
      ]
    }
  }
}

Scenario 2: Create a VPC and vSwitches in a dual-zone deployment.

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create a dual-zone VPC network that includes security groups. This template automatically configures subnet CIDR blocks and supports custom IP ranges.
  en: Create a dual-zone VPC network that includes security groups. This template automatically configures subnet CIDR blocks and supports custom IP ranges.
Parameters:
  VSwitch1ZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    AssociationPropertyMetadata:
      ExclusiveTo:
        - VSwitch2ZoneId
      AutoSelectFirst: true
    Type: String
    Description:
      zh-cn: The ID of the zone for the vSwitch. </font><a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'> View zone information<font color='blue'></a>.
      en: The ID of the zone for the vSwitch. <a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><font color='blue'>View region and zone info</font></a>.
    Label:
      zh-cn: Zone ID for vSwitch 1
      en: VSwitch 1 ZoneId
  VSwitch2CidrBlock:
    Default: 192.168.2.0/24
    Type: String
    Description:
      zh-cn: The CIDR block must be a subnet of the VPC.
      en: The CIDR block must be a subnet of the VPC.
    Label:
      zh-cn: CIDR Block for vSwitch 2
      en: VSwitch 2 CIDR Block
  VSwitch1CidrBlock:
    Default: 192.168.1.0/24
    Type: String
    Description:
      zh-cn: The CIDR block must be a subnet of the VPC.
      en: The CIDR block must be a subnet of the VPC.
    Label:
      zh-cn: CIDR Block for vSwitch 1
      en: VSwitch 1 CIDR Block
  VpcCidrBlock:
    Default: 192.168.0.0/16
    Type: String
    Description:
      zh-cn: The CIDR block of the VPC. 
You can use the following CIDR blocks or 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> en: 'The IP address range of the VPC in CIDR block format. <br>You can use the following IP address ranges or 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: VPC CIDR Block en: VPC CIDR Block VSwitch2ZoneId: AssociationPropertyMetadata: ExclusiveTo: - VSwitch1ZoneId AutoSelectFirst: true Description: zh-cn: The ID of the zone for the vSwitch. This zone must be different from the zone of the other vSwitch. </font><a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><b> View zone information<font color='blue'></a>. en: The ID of the zone for the vSwitch. This zone must be different from the zone of the other vSwitch. <a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><font color='blue'>View region and zone info</font></a>. Default: cn-hangzhou-h Label: zh-cn: Zone ID for vSwitch 2 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: Basic Network Configuration

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create a dual-zone VPC network that includes security groups. This template automatically configures subnet CIDR blocks and supports custom IP ranges.",
    "en": "Create a dual-zone VPC network that includes security groups. This template automatically configures subnet CIDR blocks and supports custom IP ranges."
  },
  "Parameters": {
    "VSwitch1ZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "VSwitch2ZoneId"
        ],
        "AutoSelectFirst": true
      },
      "Type": "String",
      "Description": {
        "zh-cn": "The ID of the zone for the vSwitch. </font><a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'> View zone information<font color='blue'></a>.",
        "en": "The ID of the zone for the vSwitch. <a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><font color='blue'>View region and zone info</font></a>."
      },
      "Label": {
        "zh-cn": "Zone ID for vSwitch 1",
        "en": "VSwitch 1 ZoneId"
      }
    },
    "VSwitch2CidrBlock": {
      "Default": "192.168.2.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "The CIDR block must be a subnet of the VPC.",
        "en": "The CIDR block must be a subnet of the VPC."
      },
      "Label": {
        "zh-cn": "CIDR Block for vSwitch 2",
        "en": "VSwitch 2 CIDR Block"
      }
    },
    "VSwitch1CidrBlock": {
      "Default": "192.168.1.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "The CIDR block must be a subnet of the VPC.",
        "en": "The CIDR block must be a subnet of the VPC."
      },
      "Label": {
        "zh-cn": "CIDR Block for vSwitch 1",
        "en": "VSwitch 1 CIDR Block"
      }
    },
    "VpcCidrBlock": {
      "Default": "192.168.0.0/16",
      "Type": "String",
      "Description": {
        "zh-cn": "The CIDR block of the VPC. 
You can use the following CIDR blocks or 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>", "en": "The IP address range of the VPC in CIDR block format. <br>You can use the following IP address ranges or 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": "VPC CIDR Block", "en": "VPC CIDR Block" } }, "VSwitch2ZoneId": { "AssociationPropertyMetadata": { "ExclusiveTo": [ "VSwitch1ZoneId" ], "AutoSelectFirst": true }, "Description": { "zh-cn": "The ID of the zone for the vSwitch. This zone must be different from the zone of the other vSwitch. </font><a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><b> View zone information<font color='blue'></a>.", "en": "The ID of the zone for the vSwitch. This zone must be different from the zone of the other vSwitch. <a href='https://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><font color='blue'>View region and zone info</font></a>." }, "Default": "cn-hangzhou-h", "Label": { "zh-cn": "Zone ID for vSwitch 2", "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": "Basic Network Configuration" } } ] } } }

Scenario 3: Create a high-availability ApsaraDB RDS instance that is attached to multiple vSwitches in a multi-zone deployment.

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: Create an ApsaraDB RDS instance that supports multi-zone high availability.
  en: Create an ApsaraDB RDS instance that supports multi-zone high availability.
Parameters:
  ZoneId1:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId2
    Label:
      en: Primary Zone
      zh-cn: Primary Zone
  ZoneId2:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      ExclusiveTo:
        - ZoneId1
    Label:
      en: Secondary Zone
      zh-cn: Secondary Zone
  DBInstanceClass:
    Type: String
    Label:
      en: Instance Type
      zh-cn: Instance Type
    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: Database Account
    Description:
      en: The username must be 1 to 32 characters in length, start with a letter, and end with a letter or a digit. The username can contain lowercase letters, uppercase letters, digits, and underscores (_).
      zh-cn: The username must be 1 to 32 characters in length, start with a letter, and end with a letter or a digit. The username can contain lowercase letters, uppercase letters, digits, and underscores (_).
    Default: testuser
  DBPassword:
    Type: String
    Label:
      en: Password
      zh-cn: Password
    Description:
      en: 'The password must be 8 to 32 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include !@#$%^&*()_+-='
      zh-cn: 'The password must be 8 to 32 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include !@#$%^&*()_+-='
    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 Configuration
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "Create an ApsaraDB RDS instance that supports multi-zone high availability.",
    "en": "Create an ApsaraDB RDS instance that supports multi-zone high availability."
  },
  "Parameters": {
    "ZoneId1": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId2"
        ]
      },
      "Label": {
        "en": "Primary Zone",
        "zh-cn": "Primary Zone"
      }
    },
    "ZoneId2": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId",
      "AssociationPropertyMetadata": {
        "ExclusiveTo": [
          "ZoneId1"
        ]
      },
      "Label": {
        "en": "Secondary Zone",
        "zh-cn": "Secondary Zone"
      }
    },
    "DBInstanceClass": {
      "Type": "String",
      "Label": {
        "en": "Instance Type",
        "zh-cn": "Instance Type"
      },
      "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": "Database Account"
      },
      "Description": {
        "en": "The username must be 1 to 32 characters in length, start with a letter, and end with a letter or a digit. The username can contain lowercase letters, uppercase letters, digits, and underscores (_).",
        "zh-cn": "The username must be 1 to 32 characters in length, start with a letter, and end with a letter or a digit. The username can contain lowercase letters, uppercase letters, digits, and underscores (_)."
      },
      "Default": "testuser"
    },
    "DBPassword": {
      "Type": "String",
      "Label": {
        "en": "Password",
        "zh-cn": "Password"
      },
      "Description": {
        "en": "The password must be 8 to 32 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include !@#$%^&*()_+-=",
        "zh-cn": "The password must be 8 to 32 characters in length and must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. Special characters include !@#$%^&*()_+-="
      },
      "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 Configuration"
            }
          }
        }
      ]
    }
  }
}