全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ECS::VPC

更新時間:Feb 06, 2026

ALIYUN::ECS::VPC類型用於建立專用網路。

文法

{
  "Type": "ALIYUN::ECS::VPC",
  "Properties": {
    "Description": String,
    "Tags": List,
    "Ipv6CidrBlock": String,
    "EnableIpv6": Boolean,
    "ResourceGroupId": String,
    "VpcName": String,
    "CidrBlock": String,
    "Ipv6Isp": String,
    "UserCidr": String,
    "SecondaryCidrBlocks": List
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

ResourceGroupId

String

資源群組ID。

VpcName

String

專用網路名稱。

長度為2~128個字元。必須以英文字母或漢字開頭,不能以http://https://開頭。可包含英文字母、漢字、數字、底線(_)和短劃線(-)。

CidrBlock

String

專用網路網段。

取值:

  • 10.0.0.0/8

  • 172.16.0.0/12

  • 192.168.0.0/16及所包含的子網

Description

String

專用網路描述。

長度為2~256個字元。不能以http://https://開頭。

Ipv6CidrBlock

String

專用網路的IPv6網段。

EnableIpv6

Boolean

是否開啟IPv6網段。

取值:

  • true:開啟。

  • false(預設值):關閉。

Tags

List

標籤。

最多支援20個標籤。

更多資訊,請參見Tags屬性

Ipv6Isp

String

專用網路的IPv6位址區段類型。

取值:

  • BGP(預設值):阿里雲BGP IPv6。

UserCidr

String

使用者網段。

如需定義多個網段,請使用半形逗號(,)分隔。最多支援3個網段。

說明

關於使用者網段的更多資訊,請參見網段常見問題

SecondaryCidrBlocks

List

SecondaryCidrBlocks。

Tags文法

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

Tags屬性

屬性名稱

類型

必須

允許更新

描述

約束

Key

String

標籤鍵。

長度為1~128個字元,不能以aliyunacs:開頭,不能包含http://https://

Value

String

標籤值。

長度為0~128個字元,不能以aliyunacs:開頭,不能包含http://https://

傳回值

Fn::GetAtt

  • VpcId:專用網路ID。

  • VRouterId:路由器ID。

  • RouteTableId:路由表ID。

  • VpcName:專用網路名稱。

樣本

情境 1 :建立VPC專用網路。

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcCidrBlock:
    Type: String
    Label:
      en: VPC CIDR IPv4 Block
      zh-cn: 專用網路IPv4網段
    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>'
    Default: 192.168.0.0/16
    AssociationProperty: ALIYUN::VPC::VPC::CidrBlock
  VpcName:
    Type: String
    Label:
      en: VPC Name
      zh-cn: Virtual Private Cloud絡名稱
    Description:
      en: VPC name, 2 to 128 characters in length, beginning with size letters or Chinese characters, including Numbers, '_' or '-'.
      zh-cn: VPC名稱,長度為2-128個字元,以大小字母或中文開頭,可包含數字、“_”或“-”。
    ConstraintDescription:
      en: '[2, 128] English or Chinese characters'
      zh-cn: '[2, 128] 英文或中文字元'
    Default: MyVpc
    MinLength: 2
    MaxLength: 128
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Ref: VpcName
Outputs:
  VRouterId:
    Description: Router id of created VPC.
    Value:
      Fn::GetAtt:
        - Vpc
        - VRouterId
  RouteTableId:
    Description: The router table id of created VPC.
    Value:
      Fn::GetAtt:
        - Vpc
        - RouteTableId
  VpcId:
    Description: Id of created VPC.
    Value:
      Fn::GetAtt:
        - Vpc
        - VpcId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "VPC CIDR IPv4 Block",
        "zh-cn": "專用網路IPv4網段"
      },
      "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>"
      },
      "Default": "192.168.0.0/16",
      "AssociationProperty": "ALIYUN::VPC::VPC::CidrBlock"
    },
    "VpcName": {
      "Type": "String",
      "Label": {
        "en": "VPC Name",
        "zh-cn": "Virtual Private Cloud絡名稱"
      },
      "Description": {
        "en": "VPC name, 2 to 128 characters in length, beginning with size letters or Chinese characters, including Numbers, '_' or '-'.",
        "zh-cn": "VPC名稱,長度為2-128個字元,以大小字母或中文開頭,可包含數字、“_”或“-”。"
      },
      "ConstraintDescription": {
        "en": "[2, 128] English or Chinese characters",
        "zh-cn": "[2, 128] 英文或中文字元"
      },
      "Default": "MyVpc",
      "MinLength": 2,
      "MaxLength": 128
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        },
        "VpcName": {
          "Ref": "VpcName"
        }
      }
    }
  },
  "Outputs": {
    "VRouterId": {
      "Description": "Router id of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VRouterId"
        ]
      }
    },
    "RouteTableId": {
      "Description": "The router table id of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "RouteTableId"
        ]
      }
    },
    "VpcId": {
      "Description": "Id of created VPC.",
      "Value": {
        "Fn::GetAtt": [
          "Vpc",
          "VpcId"
        ]
      }
    }
  }
}

情境 2 :建立一台IPv4&IPv6雙棧的ECS執行個體,並配置IPv6網關及頻寬

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 建立雙棧Elastic Compute Service,自動設定IPv6公網IP,含VPC、安全性群組、IPv6網關及頻寬設定。
  en: Create a dual-stack cloud server (ECS) and automatically configure IPv6 public IP, including VPC, security group, IPv6 gateway and bandwidth settings.
Parameters:
  InstanceImageId:
    AssociationPropertyMetadata:
      InstanceType: ${InstanceType}
      SupportedImageOwnerAlias:
        - system
        - self
        - others
    Description:
      zh-cn: 鏡像ID, <br>Linux系統請選擇:<font color='red'><b>centos_7</b></font> <br>Windows系統請選擇:<font color='red'><b>win2008r2;win2012r2;win2016</b></font>
      en: Image ID,<br>Linux System Select:<font color='red'><b>centos_7</b></font> <br>Windows System Select:<font color='red'><b>win2008r2;win2012r2;win2016</b></font>
    Default: centos_7_04_64_20G_alibase_201701015.vhd
    Label:
      zh-cn: 鏡像
      en: Image
    AssociationProperty: ALIYUN::ECS::Image::ImageId
    Type: String
  SystemDiskCategory:
    AssociationProperty: ALIYUN::ECS::Disk::SystemDiskCategory
    AssociationPropertyMetadata:
      LocaleKey: DiskCategory
      InstanceType: ${InstanceType}
    Type: String
    Description:
      zh-cn: '<font color=''blue''><b>可選值:</b></font><br>[cloud_efficiency: <font color=''green''>高效雲端硬碟</font>]<br>[cloud_ssd: <font color=''green''>SSD雲端硬碟</font>]<br>[cloud_essd: <font color=''green''>ESSD雲端硬碟</font>]<br>[cloud: <font color=''green''>普通雲端硬碟</font>]<br>[ephemeral_ssd: <font color=''green''>本地SSD盤</font>]'
      en: '<font color=''blue''><b>Optional values:</b></font><br>[cloud_efficiency: <font color=''green''>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color=''green''>SSD Cloud Disk</font>]<br>[cloud_essd: <font color=''green''>ESSD Cloud Disk</font>]<br>[cloud: <font color=''green''>Cloud Disk</font>]<br>[ephemeral_ssd: <font color=''green''>Local SSD Cloud Disk</font>]'
    Label:
      zh-cn: 系統硬碟類型
      en: System Disk Type
  SystemDiskSize:
    Default: 40
    Type: Number
    Description:
      zh-cn: 系統硬碟大小, 取值範圍:[20, 500], 單位:GB。
      en: 'System disk size, range of values: 20-500, units: GB.'
    Label:
      zh-cn: 系統硬碟空間
      en: System Disk Space
  VpcCidrBlock:
    Default: 192.168.0.0/16
    Label:
      zh-cn: 專用網路IPV4網段
      en: VPC IPV4 CIDR Block
    Type: String
    Description:
      zh-cn: 建立專用網路IP位址區段範圍,推薦使用以下的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: New proprietary network IP address segment range, recommended use of the following IP address segments<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>
    AllowedValues:
      - 192.168.0.0/16
      - 172.16.0.0/12
      - 10.0.0.0/8
  InstanceType:
    AssociationProperty: ALIYUN::ECS::Instance::InstanceType
    AssociationPropertyMetadata:
      ZoneId: VSwitchZoneId
    Type: String
    Description:
      zh-cn: 填寫VSwitch可用性區域下可使用的規格;<br>通用規格:<font color='red'><b>ecs.c5.large</b></font><br>註:可用性區域可能不支援通用規格<br>規格詳見:<a href='https://www.alibabacloud.com/help/document_detail/25378.html' target='_blank'><b><font color='blue'>執行個體規格類型系列</font></a></b>
      en: 'Fill in the specifications that can be used under the VSwitch availability zone;</b></font><br>general specifications:<font color=''red''><b>ecs.c5.large</b></font><br>note: a few zones do not support general specifications<br>see detail: <a href=''https://www.alibabacloud.com/help/en/doc-detail/25378.html'' target=''_blank''><b><font color=''blue''>Instance Specification Family</font></a></b>'
    Label:
      zh-cn: 執行個體規格
      en: Instance Type
  InstancePassword:
    Description:
      zh-cn: 伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。
      en: Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
    Type: String
    Label:
      zh-cn: 執行個體密碼
      en: Instance Password
    NoEcho: true
    AssociationProperty: ALIYUN::ECS::Instance::Password
    ConstraintDescription:
      zh-cn: 長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。
      en: Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).
  VSwitchCidrBlock:
    Default: 192.168.0.0/24
    Type: String
    Description:
      zh-cn: 建立交換器的網段,所屬Virtual Private Cloud絡的子網
      en: Network segments of new switches, subnets of virtual proprietary networks
    Label:
      zh-cn: 交換器IPV4網段
      en: VSwitch IPV4 CIDR Block
  InternetChargeType:
    Default: PayByBandwidth
    AssociationPropertyMetadata:
      LocaleKey: InternetChargeType
    Label:
      zh-cn: IPv6公網頻寬的計費方式
      en: IPv6 Metric Bandwidth Metering Method.
    Type: String
    AllowedValues:
      - PayByTraffic
      - PayByBandwidth
  IPV6Bandwidth:
    Default: 10
    Type: Number
    Description:
      zh-cn: IPv6網關公網頻寬, 取值範圍:[1, 5000], 單位:Mbps。當公網頻寬計費方式為按使用流量計費時取值範圍為1~2000Mbps,當公網頻寬計費方式為按頻寬計費時取值範圍為1~5000Mbps。
      en: 'IPv6 network Gateway public network bandwidth, value range: s1, 5000, in Mbps. When the public network bandwidth billing method is based on the use of traffic billing value range of 1 to 2000Mbps, when the public network bandwidth billing method is metered by bandwidth when the value range is 1 to 5000Mbps.'
    Label:
      zh-cn: IPv6網關公網頻寬
      en: IPv6 Network Gateway Public Network Bandwidth
  VSwitchZoneId:
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
    Type: String
    Description:
      zh-cn: 可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b>
      en: Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>
    Label:
      zh-cn: 交換器可用性區域
      en: VSwitch Availability Zone
  InstancePublicIP:
    Default: false
    Type: Boolean
    Description:
      zh-cn: 是否分配IPV4公用IP。
      en: Whether to assign a IPV4 common IP.
    Label:
      zh-cn: 分配IPV4公網IP
      en: Allocate IPV4 Public IP
  IPV6GateWaySpec:
    AssociationPropertyMetadata:
      LocaleKey: NatGatewaySpec
    Description:
      zh-cn: IPv6網關的規格,可選值:Small(免費版),Medium(企業版),Large(企業增強版)
      en: 'IPv6 gateway specifications, optional values: Small (free version), Medium (enterprise version), Large (enterprise enhancement version)'
    Default: Small
    Label:
      zh-cn: IPv6網關的規格
      en: Specifications for the IPv6 Gateway
    AllowedValues:
      - Small
      - Medium
      - Large
    Type: String
Outputs:
  EcsInstanceId:
    Description: EcsInstance InstanceId
    Value:
      Fn::GetAtt:
        - EcsInstance
        - InstanceId
  EcsInstancePrivateIp:
    Description: EcsInstance PrivateIp
    Value:
      Fn::GetAtt:
        - EcsInstance
        - PrivateIp
  EcsInstanceIpv6Address:
    Description: EcsInstance Ipv6Address
    Value:
      Fn::Select:
        - '0'
        - Fn::GetAtt:
            - EcsAssignIpv6Addresses
            - Ipv6Addresses
Conditions: {}
Resources:
  EcsSecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      SecurityGroupIngress:
        - Priority: 1
          IpProtocol: tcp
          NicType: intranet
          SourceCidrIp: 0.0.0.0/0
          PortRange: 3389/3389
        - Priority: 1
          IpProtocol: all
          NicType: intranet
          Ipv6SourceCidrIp: '::/0'
          PortRange: '-1/-1'
      VpcId:
        Ref: EcsVpc
      SecurityGroupEgress:
        - Priority: 1
          IpProtocol: tcp
          DestCidrIp: 0.0.0.0/0
          NicType: intranet
          PortRange: 3389/3389
        - Ipv6DestCidrIp: '::/0'
          IpProtocol: all
          Priority: 1
          NicType: intranet
          PortRange: '-1/-1'
  WaitConditionHandle:
    Type: ALIYUN::ROS::WaitConditionHandle
    Properties: {}
  VpcIpv6InternetBandwidth:
    Type: ALIYUN::VPC::Ipv6InternetBandwidth
    Properties:
      InternetChargeType:
        Ref: InternetChargeType
      Bandwidth:
        Ref: IPV6Bandwidth
      Ipv6AddressId:
        Fn::Select:
          - 0
          - Fn::GetAtt:
              - EcsAssignIpv6Addresses
              - Ipv6AddressIds
      Ipv6GatewayId:
        Ref: VpcIpv6Gateway
    DependsOn:
      - EcsAssignIpv6Addresses
      - VpcIpv6Gateway
  VpcIpv6Gateway:
    Type: ALIYUN::VPC::Ipv6Gateway
    Properties:
      VpcId:
        Ref: EcsVpc
      Name: MyIpv6Gateway
      Spec:
        Ref: IPV6GateWaySpec
  EcsAssignIpv6Addresses:
    Type: ALIYUN::ECS::AssignIpv6Addresses
    Properties:
      NetworkInterfaceId:
        Fn::GetAtt:
          - EcsInstance
          - PrimaryNetworkInterfaceId
      Ipv6AddressCount: 1
    DependsOn:
      - EcsInstance
  EcsVSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      Ipv6CidrBlock: 0
      VpcId:
        Ref: EcsVpc
      CidrBlock:
        Ref: VSwitchCidrBlock
      ZoneId:
        Ref: VSwitchZoneId
  WaitCondition:
    Type: ALIYUN::ROS::WaitCondition
    Properties:
      Count: 1
      Handle:
        Ref: WaitConditionHandle
      Timeout: 900
  EcsInstance:
    Type: ALIYUN::ECS::Instance
    Properties:
      UserData:
        Fn::Replace:
          - ros-notify:
              Fn::GetAtt:
                - WaitConditionHandle
                - CurlCli
          - Fn::Join:
              - ''
              - - '#!/bin/sh'
                - |2
                   
                - |
                  cd /opt 
                - |
                  wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6 
                - |
                  chmod +x ./ecs-utils-ipv6 
                - |
                  ./ecs-utils-ipv6 
                - |
                  ros-notify -d "{\"Data\" : \"SUCCESS\", \"Status\" : \"SUCCESS\"}" 
      SystemDiskCategory:
        Ref: SystemDiskCategory
      VpcId:
        Ref: EcsVpc
      SecurityGroupId:
        Ref: EcsSecurityGroup
      SystemDiskSize:
        Ref: SystemDiskSize
      ImageId:
        Ref: InstanceImageId
      AllocatePublicIP:
        Ref: InstancePublicIP
      VSwitchId:
        Ref: EcsVSwitch
      IoOptimized: optimized
      Password:
        Ref: InstancePassword
      InstanceType:
        Ref: InstanceType
    DependsOn:
      - EcsSecurityGroup
      - EcsVSwitch
      - EcsVpc
  EcsVpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
      EnableIpv6: true
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcCidrBlock
          - VSwitchCidrBlock
          - VSwitchZoneId
          - InstanceType
          - InstanceImageId
          - SystemDiskSize
          - InstancePublicIP
          - InternetChargeType
          - IPV6Bandwidth
          - IPV6GateWaySpec
          - SystemDiskCategory
          - InstancePassword
        Label:
          default: ECS
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "建立雙棧Elastic Compute Service,自動設定IPv6公網IP,含VPC、安全性群組、IPv6網關及頻寬設定。",
    "en": "Create a dual-stack cloud server (ECS) and automatically configure IPv6 public IP, including VPC, security group, IPv6 gateway and bandwidth settings."
  },
  "Parameters": {
    "InstanceImageId": {
      "AssociationPropertyMetadata": {
        "InstanceType": "${InstanceType}",
        "SupportedImageOwnerAlias": [
          "system",
          "self",
          "others"
        ]
      },
      "Description": {
        "zh-cn": "鏡像ID, <br>Linux系統請選擇:<font color='red'><b>centos_7</b></font> <br>Windows系統請選擇:<font color='red'><b>win2008r2;win2012r2;win2016</b></font>",
        "en": "Image ID,<br>Linux System Select:<font color='red'><b>centos_7</b></font> <br>Windows System Select:<font color='red'><b>win2008r2;win2012r2;win2016</b></font>"
      },
      "Default": "centos_7_04_64_20G_alibase_201701015.vhd",
      "Label": {
        "zh-cn": "鏡像",
        "en": "Image"
      },
      "AssociationProperty": "ALIYUN::ECS::Image::ImageId",
      "Type": "String"
    },
    "SystemDiskCategory": {
      "AssociationProperty": "ALIYUN::ECS::Disk::SystemDiskCategory",
      "AssociationPropertyMetadata": {
        "LocaleKey": "DiskCategory",
        "InstanceType": "${InstanceType}"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "<font color='blue'><b>可選值:</b></font><br>[cloud_efficiency: <font color='green'>高效雲端硬碟</font>]<br>[cloud_ssd: <font color='green'>SSD雲端硬碟</font>]<br>[cloud_essd: <font color='green'>ESSD雲端硬碟</font>]<br>[cloud: <font color='green'>普通雲端硬碟</font>]<br>[ephemeral_ssd: <font color='green'>本地SSD盤</font>]",
        "en": "<font color='blue'><b>Optional values:</b></font><br>[cloud_efficiency: <font color='green'>Efficient Cloud Disk</font>]<br>[cloud_ssd: <font color='green'>SSD Cloud Disk</font>]<br>[cloud_essd: <font color='green'>ESSD Cloud Disk</font>]<br>[cloud: <font color='green'>Cloud Disk</font>]<br>[ephemeral_ssd: <font color='green'>Local SSD Cloud Disk</font>]"
      },
      "Label": {
        "zh-cn": "系統硬碟類型",
        "en": "System Disk Type"
      }
    },
    "SystemDiskSize": {
      "Default": 40,
      "Type": "Number",
      "Description": {
        "zh-cn": "系統硬碟大小, 取值範圍:[20, 500], 單位:GB。",
        "en": "System disk size, range of values: 20-500, units: GB."
      },
      "Label": {
        "zh-cn": "系統硬碟空間",
        "en": "System Disk Space"
      }
    },
    "VpcCidrBlock": {
      "Default": "192.168.0.0/16",
      "Label": {
        "zh-cn": "專用網路IPV4網段",
        "en": "VPC IPV4 CIDR Block"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "建立專用網路IP位址區段範圍,推薦使用以下的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": "New proprietary network IP address segment range, recommended use of the following IP address segments<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>"
      },
      "AllowedValues": [
        "192.168.0.0/16",
        "172.16.0.0/12",
        "10.0.0.0/8"
      ]
    },
    "InstanceType": {
      "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
      "AssociationPropertyMetadata": {
        "ZoneId": "VSwitchZoneId"
      },
      "Type": "String",
      "Description": {
        "zh-cn": "填寫VSwitch可用性區域下可使用的規格;<br>通用規格:<font color='red'><b>ecs.c5.large</b></font><br>註:可用性區域可能不支援通用規格<br>規格詳見:<a href='https://www.alibabacloud.com/help/document_detail/25378.html' target='_blank'><b><font color='blue'>執行個體規格類型系列</font></a></b>",
        "en": "Fill in the specifications that can be used under the VSwitch availability zone;</b></font><br>general specifications:<font color='red'><b>ecs.c5.large</b></font><br>note: a few zones do not support general specifications<br>see detail: <a href='https://www.alibabacloud.com/help/en/doc-detail/25378.html' target='_blank'><b><font color='blue'>Instance Specification Family</font></a></b>"
      },
      "Label": {
        "zh-cn": "執行個體規格",
        "en": "Instance Type"
      }
    },
    "InstancePassword": {
      "Description": {
        "zh-cn": "伺服器登入密碼,長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。",
        "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      },
      "Type": "String",
      "Label": {
        "zh-cn": "執行個體密碼",
        "en": "Instance Password"
      },
      "NoEcho": true,
      "AssociationProperty": "ALIYUN::ECS::Instance::Password",
      "ConstraintDescription": {
        "zh-cn": "長度8-30,必須包含三項(大寫字母、小寫字母、數字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符號)。",
        "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in)."
      }
    },
    "VSwitchCidrBlock": {
      "Default": "192.168.0.0/24",
      "Type": "String",
      "Description": {
        "zh-cn": "建立交換器的網段,所屬Virtual Private Cloud絡的子網",
        "en": "Network segments of new switches, subnets of virtual proprietary networks"
      },
      "Label": {
        "zh-cn": "交換器IPV4網段",
        "en": "VSwitch IPV4 CIDR Block"
      }
    },
    "InternetChargeType": {
      "Default": "PayByBandwidth",
      "AssociationPropertyMetadata": {
        "LocaleKey": "InternetChargeType"
      },
      "Label": {
        "zh-cn": "IPv6公網頻寬的計費方式",
        "en": "IPv6 Metric Bandwidth Metering Method."
      },
      "Type": "String",
      "AllowedValues": [
        "PayByTraffic",
        "PayByBandwidth"
      ]
    },
    "IPV6Bandwidth": {
      "Default": 10,
      "Type": "Number",
      "Description": {
        "zh-cn": "IPv6網關公網頻寬, 取值範圍:[1, 5000], 單位:Mbps。當公網頻寬計費方式為按使用流量計費時取值範圍為1~2000Mbps,當公網頻寬計費方式為按頻寬計費時取值範圍為1~5000Mbps。",
        "en": "IPv6 network Gateway public network bandwidth, value range: s1, 5000, in Mbps. When the public network bandwidth billing method is based on the use of traffic billing value range of 1 to 2000Mbps, when the public network bandwidth billing method is metered by bandwidth when the value range is 1 to 5000Mbps."
      },
      "Label": {
        "zh-cn": "IPv6網關公網頻寬",
        "en": "IPv6 Network Gateway Public Network Bandwidth"
      }
    },
    "VSwitchZoneId": {
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
      "Type": "String",
      "Description": {
        "zh-cn": "可用性區域ID。<br><b>註: <font color='blue'>選擇前請確認該可用性區域是否支援建立ECS資源的規格,建議與其他交換器可用性區域不同</font></b>",
        "en": "Availability Zone ID.<br><b>note:<font color='blue'>before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources,which is recommended to be different from other VSwitch Availability Zone</font></b>"
      },
      "Label": {
        "zh-cn": "交換器可用性區域",
        "en": "VSwitch Availability Zone"
      }
    },
    "InstancePublicIP": {
      "Default": false,
      "Type": "Boolean",
      "Description": {
        "zh-cn": "是否分配IPV4公用IP。",
        "en": "Whether to assign a IPV4 common IP."
      },
      "Label": {
        "zh-cn": "分配IPV4公網IP",
        "en": "Allocate IPV4 Public IP"
      }
    },
    "IPV6GateWaySpec": {
      "AssociationPropertyMetadata": {
        "LocaleKey": "NatGatewaySpec"
      },
      "Description": {
        "zh-cn": "IPv6網關的規格,可選值:Small(免費版),Medium(企業版),Large(企業增強版)",
        "en": "IPv6 gateway specifications, optional values: Small (free version), Medium (enterprise version), Large (enterprise enhancement version)"
      },
      "Default": "Small",
      "Label": {
        "zh-cn": "IPv6網關的規格",
        "en": "Specifications for the IPv6 Gateway"
      },
      "AllowedValues": [
        "Small",
        "Medium",
        "Large"
      ],
      "Type": "String"
    }
  },
  "Outputs": {
    "EcsInstanceId": {
      "Description": "EcsInstance InstanceId",
      "Value": {
        "Fn::GetAtt": [
          "EcsInstance",
          "InstanceId"
        ]
      }
    },
    "EcsInstancePrivateIp": {
      "Description": "EcsInstance PrivateIp",
      "Value": {
        "Fn::GetAtt": [
          "EcsInstance",
          "PrivateIp"
        ]
      }
    },
    "EcsInstanceIpv6Address": {
      "Description": "EcsInstance Ipv6Address",
      "Value": {
        "Fn::Select": [
          "0",
          {
            "Fn::GetAtt": [
              "EcsAssignIpv6Addresses",
              "Ipv6Addresses"
            ]
          }
        ]
      }
    }
  },
  "Conditions": {},
  "Resources": {
    "EcsSecurityGroup": {
      "Type": "ALIYUN::ECS::SecurityGroup",
      "Properties": {
        "SecurityGroupIngress": [
          {
            "Priority": 1,
            "IpProtocol": "tcp",
            "NicType": "intranet",
            "SourceCidrIp": "0.0.0.0/0",
            "PortRange": "3389/3389"
          },
          {
            "Priority": 1,
            "IpProtocol": "all",
            "NicType": "intranet",
            "Ipv6SourceCidrIp": "::/0",
            "PortRange": "-1/-1"
          }
        ],
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "SecurityGroupEgress": [
          {
            "Priority": 1,
            "IpProtocol": "tcp",
            "DestCidrIp": "0.0.0.0/0",
            "NicType": "intranet",
            "PortRange": "3389/3389"
          },
          {
            "Ipv6DestCidrIp": "::/0",
            "IpProtocol": "all",
            "Priority": 1,
            "NicType": "intranet",
            "PortRange": "-1/-1"
          }
        ]
      }
    },
    "WaitConditionHandle": {
      "Type": "ALIYUN::ROS::WaitConditionHandle",
      "Properties": {}
    },
    "VpcIpv6InternetBandwidth": {
      "Type": "ALIYUN::VPC::Ipv6InternetBandwidth",
      "Properties": {
        "InternetChargeType": {
          "Ref": "InternetChargeType"
        },
        "Bandwidth": {
          "Ref": "IPV6Bandwidth"
        },
        "Ipv6AddressId": {
          "Fn::Select": [
            0,
            {
              "Fn::GetAtt": [
                "EcsAssignIpv6Addresses",
                "Ipv6AddressIds"
              ]
            }
          ]
        },
        "Ipv6GatewayId": {
          "Ref": "VpcIpv6Gateway"
        }
      },
      "DependsOn": [
        "EcsAssignIpv6Addresses",
        "VpcIpv6Gateway"
      ]
    },
    "VpcIpv6Gateway": {
      "Type": "ALIYUN::VPC::Ipv6Gateway",
      "Properties": {
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "Name": "MyIpv6Gateway",
        "Spec": {
          "Ref": "IPV6GateWaySpec"
        }
      }
    },
    "EcsAssignIpv6Addresses": {
      "Type": "ALIYUN::ECS::AssignIpv6Addresses",
      "Properties": {
        "NetworkInterfaceId": {
          "Fn::GetAtt": [
            "EcsInstance",
            "PrimaryNetworkInterfaceId"
          ]
        },
        "Ipv6AddressCount": 1
      },
      "DependsOn": [
        "EcsInstance"
      ]
    },
    "EcsVSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "Ipv6CidrBlock": 0,
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "CidrBlock": {
          "Ref": "VSwitchCidrBlock"
        },
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        }
      }
    },
    "WaitCondition": {
      "Type": "ALIYUN::ROS::WaitCondition",
      "Properties": {
        "Count": 1,
        "Handle": {
          "Ref": "WaitConditionHandle"
        },
        "Timeout": 900
      }
    },
    "EcsInstance": {
      "Type": "ALIYUN::ECS::Instance",
      "Properties": {
        "UserData": {
          "Fn::Replace": [
            {
              "ros-notify": {
                "Fn::GetAtt": [
                  "WaitConditionHandle",
                  "CurlCli"
                ]
              }
            },
            {
              "Fn::Join": [
                "",
                [
                  "#!/bin/sh",
                  " \n",
                  "cd /opt \n",
                  "wget http://ecs-image-utils.oss-cn-hangzhou.aliyuncs.com/ipv6/rhel/ecs-utils-ipv6 \n",
                  "chmod +x ./ecs-utils-ipv6 \n",
                  "./ecs-utils-ipv6 \n",
                  "ros-notify -d \"{\\\"Data\\\" : \\\"SUCCESS\\\", \\\"Status\\\" : \\\"SUCCESS\\\"}\" \n"
                ]
              ]
            }
          ]
        },
        "SystemDiskCategory": {
          "Ref": "SystemDiskCategory"
        },
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "SecurityGroupId": {
          "Ref": "EcsSecurityGroup"
        },
        "SystemDiskSize": {
          "Ref": "SystemDiskSize"
        },
        "ImageId": {
          "Ref": "InstanceImageId"
        },
        "AllocatePublicIP": {
          "Ref": "InstancePublicIP"
        },
        "VSwitchId": {
          "Ref": "EcsVSwitch"
        },
        "IoOptimized": "optimized",
        "Password": {
          "Ref": "InstancePassword"
        },
        "InstanceType": {
          "Ref": "InstanceType"
        }
      },
      "DependsOn": [
        "EcsSecurityGroup",
        "EcsVSwitch",
        "EcsVpc"
      ]
    },
    "EcsVpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        },
        "VpcName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "EnableIpv6": true
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcCidrBlock",
            "VSwitchCidrBlock",
            "VSwitchZoneId",
            "InstanceType",
            "InstanceImageId",
            "SystemDiskSize",
            "InstancePublicIP",
            "InternetChargeType",
            "IPV6Bandwidth",
            "IPV6GateWaySpec",
            "SystemDiskCategory",
            "InstancePassword"
          ],
          "Label": {
            "default": "ECS"
          }
        }
      ]
    }
  }
}

情境 3 :建立一個VPC類型的傳統型負載平衡(CLB)執行個體。

快速建立

ROSTemplateFormatVersion: '2015-09-01'
Description:
  zh-cn: 建立VPC與VSwitch,配置內網SLB,支援指定規格與地址類型。
  en: Create a Virtual Private Cloud (VPC) and Virtual Switch (VSwitch), configure an internal Load Balancer (SLB), with support for specifying instance types and address types.
Parameters:
  VpcCidrBlock:
    Type: String
    Label:
      en: VPC CIDR Block
      zh-cn: 專用網路網段
    Description:
      en: 'The IP address range of the VPC in the CIDR block form. You can use the following IP address ranges and their subnets: 10.0.0.0/8 172.16.0.0/12  192.168.0.0/16'
      zh-cn: 專用網路的網段,可選值:10.0.0.0/8,172.16.0.0/12,192.168.0.0/16。
    Default: 192.168.0.0/16
    AllowedValues:
      - 192.168.0.0/16
      - 172.16.0.0/12
      - 10.0.0.0/8
  VSwitchZoneId:
    Type: String
    Label:
      en: Zone ID
      zh-cn: 可用性區域ID
    Default: Null
    Description:
      en: The available zone ID, you should confirm the zone support SLB or not.
      zh-cn: 可用性區域ID,需確認所選可用性區域下是否支援SLB等資源。
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
  VSwitchCidrBlock:
    Type: String
    Label:
      en: VSwitch CIDR Block
      zh-cn: 交換器網段
    Description:
      en: Must be a sub-network segment of the proprietary network and is not occupied by other VSwitches.
      zh-cn: 必須是所屬專用網路的子網段,並且沒有被其他交換器佔用。
    Default: 192.168.0.0/24
  LoadBalancerSpec:
    Type: String
    Label:
      en: Specification
      zh-cn: 規格
    Description:
      en: Load balancing specification, <a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'><b>Slb spec detail</b></font>.</a>
      zh-cn: 負載平衡規格,<a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'><b>規格詳情</b></font></a>。
    Default: slb.s1.small
Conditions: {}
Resources:
  EcsVpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock:
        Ref: VpcCidrBlock
      VpcName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
  EcsVSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: VSwitchZoneId
      VpcId:
        Ref: EcsVpc
      CidrBlock:
        Ref: VSwitchCidrBlock
      VSwitchName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
  SlbLoadBalancer:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      VpcId:
        Ref: EcsVpc
      VSwitchId:
        Ref: EcsVSwitch
      AddressType: intranet
      LoadBalancerName:
        Fn::Join:
          - '-'
          - - StackId
            - Ref: ALIYUN::StackId
      LoadBalancerSpec:
        Ref: LoadBalancerSpec
      PayType: PayOnDemand
    DependsOn: EcsVSwitch
Outputs:
  SlbLoadBalancerId:
    Description:
      en: The ID of load balance created.
      zh-cn: 建立的負載平衡ID。
    Value:
      Fn::GetAtt:
        - SlbLoadBalancer
        - LoadBalancerId
Metadata:
  ALIYUN::ROS::Interface:
    ParameterGroups:
      - Parameters:
          - VpcCidrBlock
          - VSwitchZoneId
          - VSwitchCidrBlock
        Label:
          default:
            en: VPC
            zh-cn: 專用網路
      - Parameters:
          - LoadBalancerSpec
        Label:
          default:
            en: SLB
            zh-cn: 負載平衡
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": {
    "zh-cn": "建立VPC與VSwitch,配置內網SLB,支援指定規格與地址類型。",
    "en": "Create a Virtual Private Cloud (VPC) and Virtual Switch (VSwitch), configure an internal Load Balancer (SLB), with support for specifying instance types and address types."
  },
  "Parameters": {
    "VpcCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "VPC CIDR Block",
        "zh-cn": "專用網路網段"
      },
      "Description": {
        "en": "The IP address range of the VPC in the CIDR block form. You can use the following IP address ranges and their subnets: 10.0.0.0/8 172.16.0.0/12  192.168.0.0/16",
        "zh-cn": "專用網路的網段,可選值:10.0.0.0/8,172.16.0.0/12,192.168.0.0/16。"
      },
      "Default": "192.168.0.0/16",
      "AllowedValues": [
        "192.168.0.0/16",
        "172.16.0.0/12",
        "10.0.0.0/8"
      ]
    },
    "VSwitchZoneId": {
      "Type": "String",
      "Label": {
        "en": "Zone ID",
        "zh-cn": "可用性區域ID"
      },
      "Default": null,
      "Description": {
        "en": "The available zone ID, you should confirm the zone support SLB or not.",
        "zh-cn": "可用性區域ID,需確認所選可用性區域下是否支援SLB等資源。"
      },
      "AssociationProperty": "ALIYUN::ECS::Instance::ZoneId"
    },
    "VSwitchCidrBlock": {
      "Type": "String",
      "Label": {
        "en": "VSwitch CIDR Block",
        "zh-cn": "交換器網段"
      },
      "Description": {
        "en": "Must be a sub-network segment of the proprietary network and is not occupied by other VSwitches.",
        "zh-cn": "必須是所屬專用網路的子網段,並且沒有被其他交換器佔用。"
      },
      "Default": "192.168.0.0/24"
    },
    "LoadBalancerSpec": {
      "Type": "String",
      "Label": {
        "en": "Specification",
        "zh-cn": "規格"
      },
      "Description": {
        "en": "Load balancing specification, <a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'><b>Slb spec detail</b></font>.</a>",
        "zh-cn": "負載平衡規格,<a href='https://www.alibabacloud.com/help/document_detail/85939.html' target='_blank'><font color='blue'><b>規格詳情</b></font></a>。"
      },
      "Default": "slb.s1.small"
    }
  },
  "Conditions": {},
  "Resources": {
    "EcsVpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "CidrBlock": {
          "Ref": "VpcCidrBlock"
        },
        "VpcName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    },
    "EcsVSwitch": {
      "Type": "ALIYUN::ECS::VSwitch",
      "Properties": {
        "ZoneId": {
          "Ref": "VSwitchZoneId"
        },
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "CidrBlock": {
          "Ref": "VSwitchCidrBlock"
        },
        "VSwitchName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        }
      }
    },
    "SlbLoadBalancer": {
      "Type": "ALIYUN::SLB::LoadBalancer",
      "Properties": {
        "VpcId": {
          "Ref": "EcsVpc"
        },
        "VSwitchId": {
          "Ref": "EcsVSwitch"
        },
        "AddressType": "intranet",
        "LoadBalancerName": {
          "Fn::Join": [
            "-",
            [
              "StackId",
              {
                "Ref": "ALIYUN::StackId"
              }
            ]
          ]
        },
        "LoadBalancerSpec": {
          "Ref": "LoadBalancerSpec"
        },
        "PayType": "PayOnDemand"
      },
      "DependsOn": "EcsVSwitch"
    }
  },
  "Outputs": {
    "SlbLoadBalancerId": {
      "Description": {
        "en": "The ID of load balance created.",
        "zh-cn": "建立的負載平衡ID。"
      },
      "Value": {
        "Fn::GetAtt": [
          "SlbLoadBalancer",
          "LoadBalancerId"
        ]
      }
    }
  },
  "Metadata": {
    "ALIYUN::ROS::Interface": {
      "ParameterGroups": [
        {
          "Parameters": [
            "VpcCidrBlock",
            "VSwitchZoneId",
            "VSwitchCidrBlock"
          ],
          "Label": {
            "default": {
              "en": "VPC",
              "zh-cn": "專用網路"
            }
          }
        },
        {
          "Parameters": [
            "LoadBalancerSpec"
          ],
          "Label": {
            "default": {
              "en": "SLB",
              "zh-cn": "負載平衡"
            }
          }
        }
      ]
    }
  }
}

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