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。
  • ChinaMobile:中国移动(单线)。
  • ChinaUnicom:中国联通(单线)。
  • ChinaTelecom:中国电信(单线)。
说明 如果是开通了单线带宽白名单的用户,该参数可以设置为ChinaTelecom(中国电信)、ChinaUnicom(中国联通)和ChinaMobile(中国移动)。
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。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      Vpc:
        Type: ALIYUN::ECS::VPC
        Properties:
          CidrBlock: 192.168.0.0/24
          VpcName: TestVpc
    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
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "Vpc": {
          "Type": "ALIYUN::ECS::VPC",
          "Properties": {
            "CidrBlock": "192.168.0.0/24",
            "VpcName": "TestVpc"
          }
        }
      },
      "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"
            ]
          }
        }
      }
    }

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