All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ECS::VSwitch

最終更新日:Sep 14, 2024

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 zone ID.

None.

VSwitchName

String

No

Yes

The vSwitch name.

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

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. It cannot start with http:// or https://.

Ipv6CidrBlock

Integer

No

No

The IPv6 CIDR block of the vSwitch.

Valid values: 0 to 255. The value must be a decimal integer.

By default, the mask of the IPv6 CIDR block of the vSwitch is 64 bits in length.

You can specify a custom value for the last eight bits of the mask of the IPv6 CIDR block of 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 of the VPC.

None.

ZoneType

String

No

No

The zone type.

Default value: AvailabilityZone.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

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

Value

String

No

No

The tag value.

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

Return values

Fn::GetAtt

  • CidrBlock: the IPv4 CIDR block of the vSwitch.

  • Ipv6CidrBlock: the IPv6 CIDR block of the vSwitch.

  • VSwitchId: the vSwitch ID.

  • VSwitchName: the vSwitch name.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      VSwitchZoneId:
        AssociationProperty: ALIYUN::ECS::Instance:ZoneId
        Type: String
         
        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",
           
          "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": {
      }
    }