ALIYUN::ECS::VSwitch is used 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 Type Required Editable Description Constraint
VpcId String Yes No The ID of the virtual private cloud (VPC) in which 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, and can contain letters, digits, underscores (_), and hyphens (-). The name must start with a letter but cannot start with http:// or https://.
CidrBlock String Yes No The CIDR block of the vSwitch. The CIDR block of a vSwitch must be a subset of the CIDR block 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. The description cannot start with http:// or https://.
Ipv6CidrBlock Integer No No The last eight bits of the IPv6 CIDR block of the vSwitch. Valid values: 0 to 255. The value must be a decimal integer.

By default, the subnet mask of the IPv6 CIDR block of a vSwitch is /64.

You can specify a custom value to define the last eight bits of the IPv6 CIDR block of the vSwitch.

Tags List No Yes The tags of the vSwitch. You can specify up to 20 tags.

For more information, see Tags properties.

VpcIpv6CidrBlock String No No The IPv6 CIDR block of the VPC. None
ZoneType String No No The type of zone. Default value: AvailabilityZone.

Tags syntax

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

Tags properties

Property Type Required Editable Description Constraint
Key String Yes No The key of the tag. The key must be 1 to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.
Value String No No The value of the tag. The value must be 0 to 128 characters in length and cannot contain http:// or https://. The value cannot start with acs: or aliyun.

Response parameters

Fn::GetAtt

  • CidrBlock: the CIDR block of the vSwitch.
  • Ipv6CidrBlock: the last eight bits of the IPv6 CIDR block of the vSwitch.
  • VSwitchId: the ID of the vSwitch.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      VSwitchZoneId:
        AssociationProperty: ALIYUN::ECS::Instance:ZoneId
        Type: String
        Description: The ID of the zone
        Label:
          en: VSwitch Availability Zone
    Resources:
      EcsVSwitch:
        Type: ALIYUN::ECS::VSwitch
        Properties:
          VpcId:
            Ref: EcsVpc
          ZoneId:
            Ref: VSwitchZoneId
          CidrBlock: 192.168.0.0/24
      EcsVpc:
        Type: ALIYUN::ECS::VPC
        Properties:
          CidrBlock: 192.168.0.0/16
          VpcName:
            Fn::Join:
              - '-'
              - - StackId
                - Ref: ALIYUN::StackId
    Outputs: {}
    
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "VSwitchZoneId": {
          "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
          "Type": "String",
          "Description": "The ID of the zone",
          "Label": {
             
            "en": "VSwitch Availability Zone"
          }
        }
      },
      "Resources": {
        "EcsVSwitch": {
          "Type": "ALIYUN::ECS::VSwitch",
          "Properties": {
            "VpcId": {
              "Ref": "EcsVpc"
            },
            "ZoneId": {
              "Ref": "VSwitchZoneId"
            },
            "CidrBlock": "192.168.0.0/24"
          }
        },
        "EcsVpc": {
          "Type": "ALIYUN::ECS::VPC",
          "Properties": {
            "CidrBlock": "192.168.0.0/16",
            "VpcName": {
              "Fn::Join": [
                "-",
                [
                  "StackId",
                  {
                    "Ref": "ALIYUN::StackId"
                  }
                ]
              ]
            }
          }
        }
      },
      "Outputs": {
      }
    }

To view more examples, visit SnatEntry.json and SnatEntry.yml. In the examples, the ALIYUN::ECS::VPC, ALIYUN::ECS::VSwitch, ALIYUN::VPC::SnatEntry, ALIYUN::VPC::CommonBandwidthPackage, ALIYUN::VPC::CommonBandwidthPackageIp, ALIYUN::VPC::Ipv6Gateway, and ALIYUN::VPC::Ipv6InternetBandwidth resource types are used.