全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ECS::VSwitch

更新時間:Feb 06, 2026

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://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><b> 查看可用性區域資訊</b><font color='blue'></a>。
      en: VSwitch available area id, <a href='https://www.alibabacloud.com/help/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://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><b> 查看可用性區域資訊</b><font color='blue'></a>。",
        "en": "VSwitch available area id, <a href='https://www.alibabacloud.com/help/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://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><b> 查看可用性區域資訊</b><font color='blue'></a>。
      en: VSwitch available area id, <a href='https://www.alibabacloud.com/help/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://www.alibabacloud.com/help/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://www.alibabacloud.com/help/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://www.alibabacloud.com/help/document_detail/123712.html' target='_blank'><b> 查看可用性區域資訊</b><font color='blue'></a>。",
        "en": "VSwitch available area id, <a href='https://www.alibabacloud.com/help/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://www.alibabacloud.com/help/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://www.alibabacloud.com/help/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配置"
            }
          }
        }
      ]
    }
  }
}

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