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,
    "SecondaryCidrBlock": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
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个网段。
说明 关于用户网段的更多信息,请参见网段常见问题
SecondaryCidrBlock String 辅助IPv4网段。 取值:
  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16及所包含的子网

添加辅助IPv4网段时,需要遵循以下规则:

  • 网段不能以0开头。
  • 辅助IPv4网段不能与原有网段(CidrBlock)相同。
  • 子网掩码的长度必须为8~24比特。

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。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "Ipv6Isp": {
      "Type": "String",
      "Description": "The Internet service provider (ISP) for IPv6 addresses of the VPC. Valid values:\nBGP(default): Alibaba Cloud BGP IPv6\nChinaMobile: China Mobile (single line)\nChinaUnicom: China Unicom (single line)\nChinaTelecom: China Telecom (single line)\nNote If your Alibaba Cloud account is allowed to activate single-ISP bandwidth, you can set the parameter to ChinaTelecom, ChinaUnicom, and ChinaMobile."
    },
    "Description": {
      "Type": "String",
      "Description": "Description of the vpc, [2, 256] characters. Do not fill or empty, the default is empty."
    },
    "SecondaryCidrBlock": {
      "Type": "String",
      "Description": "The secondary IPv4 CIDR block. \nYou can specify one of the following standard IPv4 CIDR blocks or their \nsubnets as the secondary IPv4 CIDR block: 192.168.0.0/16, 172.16.0.0/12, \nand 10.0.0.0/8.To use a public CIDR block as the secondary IPv4 CIDR block, \nsubmit a ticket. When you add a secondary IPv4 CIDR block, take note of \nthe following rules: \n1. The CIDR block cannot start with 0. \n2. The subnet mask must be 8 to 24 bits in length.\nThe secondary CIDR block cannot overlap with the primary \nCIDR block or an existing secondary CIDR block."
    },
    "ResourceGroupId": {
      "Type": "String",
      "Description": "Resource group id."
    },
    "CidrBlock": {
      "Type": "String",
      "Description": "The IP address range of the VPC in the CIDR block form. You can use the following IP address ranges and their subnets:\n10.0.0.0/8\n172.16.0.0/12 (Default)\n192.168.0.0/16"
    },
    "VpcName": {
      "Type": "String",
      "Description": "Display name of the vpc instance, [2, 128] English or Chinese characters, must start with a letter or Chinese in size, can contain numbers, '_' or '.', '-'"
    },
    "Ipv6CidrBlock": {
      "Type": "String",
      "Description": "IPv6 network cidr of the VPC.",
      "MinLength": 1
    },
    "Tags": {
      "Type": "Json",
      "Description": "Tags to attach to vpc. Max support 20 tags to add during create vpc. Each tag with two properties Key and Value, and Key is required.",
      "MaxLength": 20
    },
    "EnableIpv6": {
      "Type": "Boolean",
      "Description": "Whether to enable an IPv6 network cidr, the value is:False (default): not turned on.True: On.",
      "AllowedValues": [
        "True",
        "true",
        "False",
        "false"
      ],
      "Default": false
    },
    "UserCidr": {
      "Type": "String",
      "Description": "The user CIDR block. Separate multiple CIDR blocks with commas (,). At most three CIDR blocks are supported."
    }
  },
  "Resources": {
    "Vpc": {
      "Type": "ALIYUN::ECS::VPC",
      "Properties": {
        "Ipv6Isp": {
          "Ref": "Ipv6Isp"
        },
        "Description": {
          "Ref": "Description"
        },
        "SecondaryCidrBlock": {
          "Ref": "SecondaryCidrBlock"
        },
        "ResourceGroupId": {
          "Ref": "ResourceGroupId"
        },
        "CidrBlock": {
          "Ref": "CidrBlock"
        },
        "VpcName": {
          "Ref": "VpcName"
        },
        "Ipv6CidrBlock": {
          "Ref": "Ipv6CidrBlock"
        },
        "Tags": {
          "Ref": "Tags"
        },
        "EnableIpv6": {
          "Ref": "EnableIpv6"
        },
        "UserCidr": {
          "Ref": "UserCidr"
        }
      }
    }
  },
  "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"
        ]
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  CidrBlock:
    Description: '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 (Default)

      192.168.0.0/16'
    Type: String
  Description:
    Description: Description of the vpc, [2, 256] characters. Do not fill or empty,
      the default is empty.
    Type: String
  EnableIpv6:
    AllowedValues:
    - 'True'
    - 'true'
    - 'False'
    - 'false'
    Default: false
    Description: 'Whether to enable an IPv6 network cidr, the value is:False (default):
      not turned on.True: On.'
    Type: Boolean
  Ipv6CidrBlock:
    Description: IPv6 network cidr of the VPC.
    MinLength: 1
    Type: String
  Ipv6Isp:
    Description: 'The Internet service provider (ISP) for IPv6 addresses of the VPC.
      Valid values:

      BGP(default): Alibaba Cloud BGP IPv6

      ChinaMobile: China Mobile (single line)

      ChinaUnicom: China Unicom (single line)

      ChinaTelecom: China Telecom (single line)

      Note If your Alibaba Cloud account is allowed to activate single-ISP bandwidth,
      you can set the parameter to ChinaTelecom, ChinaUnicom, and ChinaMobile.'
    Type: String
  ResourceGroupId:
    Description: Resource group id.
    Type: String
  SecondaryCidrBlock:
    Description: "The secondary IPv4 CIDR block. \nYou can specify one of the following\
      \ standard IPv4 CIDR blocks or their \nsubnets as the secondary IPv4 CIDR block:\
      \ 192.168.0.0/16, 172.16.0.0/12, \nand 10.0.0.0/8.To use a public CIDR block\
      \ as the secondary IPv4 CIDR block, \nsubmit a ticket. When you add a secondary\
      \ IPv4 CIDR block, take note of \nthe following rules: \n1. The CIDR block cannot\
      \ start with 0. \n2. The subnet mask must be 8 to 24 bits in length.\nThe secondary\
      \ CIDR block cannot overlap with the primary \nCIDR block or an existing secondary\
      \ CIDR block."
    Type: String
  Tags:
    Description: Tags to attach to vpc. Max support 20 tags to add during create vpc.
      Each tag with two properties Key and Value, and Key is required.
    MaxLength: 20
    Type: Json
  UserCidr:
    Description: The user CIDR block. Separate multiple CIDR blocks with commas (,).
      At most three CIDR blocks are supported.
    Type: String
  VpcName:
    Description: Display name of the vpc instance, [2, 128] English or Chinese characters,
      must start with a letter or Chinese in size, can contain numbers, '_' or '.',
      '-'
    Type: String
Resources:
  Vpc:
    Properties:
      CidrBlock:
        Ref: CidrBlock
      Description:
        Ref: Description
      EnableIpv6:
        Ref: EnableIpv6
      Ipv6CidrBlock:
        Ref: Ipv6CidrBlock
      Ipv6Isp:
        Ref: Ipv6Isp
      ResourceGroupId:
        Ref: ResourceGroupId
      SecondaryCidrBlock:
        Ref: SecondaryCidrBlock
      Tags:
        Ref: Tags
      UserCidr:
        Ref: UserCidr
      VpcName:
        Ref: VpcName
    Type: ALIYUN::ECS::VPC
Outputs:
  RouteTableId:
    Description: The router table id of created VPC.
    Value:
      Fn::GetAtt:
      - Vpc
      - RouteTableId
  VRouterId:
    Description: Router id of created VPC.
    Value:
      Fn::GetAtt:
      - Vpc
      - VRouterId
  VpcId:
    Description: Id of created VPC.
    Value:
      Fn::GetAtt:
      - Vpc
      - VpcId

更多示例,请参见创建专有网络、创建专有网络中的交换机、在SNAT列表中添加SNAT条目、创建共享带宽实例、添加EIP到共享带宽中、创建IPv6网关和为IPv6地址购买公网带宽的组合示例:JSON示例YAML示例