ALIYUN::ECS::VPC is used to create a virtual private cloud (VPC).

Syntax

{
  "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
  }
}

Properties

Property Type Required Editable Description Constraint
ResourceGroupId String No Yes The ID of the resource group. None.
VpcName String No Yes The name of the VPC. 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 No Yes The CIDR block of the VPC. Valid values:
  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16 and its subnets
Description String No Yes The description of the VPC. The description must be 2 to 256 characters in length. The description cannot start with http:// or https://.
Ipv6CidrBlock String No No The IPv6 CIDR block of the VPC. None.
EnableIpv6 Boolean No Yes Specifies whether to enable IPv6 CIDR blocks. Default value: false. Valid values:
  • true: enables IPv6 CIDR blocks.
  • false: does not enable IPv6 CIDR blocks.
Tags List No Yes The tags of the VPC. You can specify up to 20 tags.

For more information, see Tags propertes.

Ipv6Isp String No No The type of the IPv6 CIDR block of the VPC.
  • Set the value to BGP, which specifies Alibaba Cloud Border Gateway Protocol (BGP) IPv6. This is the default value.
UserCidr String No No The user CIDR block. You can specify up to three CIDR blocks. Separate multiple CIDR blocks with commas (,).
Note For more information about user CIDR blocks, see FAQ about CIDR blocks.
SecondaryCidrBlock String No No The secondary IPv4 CIDR block. Valid values:
  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16 and its subnets

When you add a secondary IPv4 CIDR block, take note of the following items:

  • The CIDR block cannot start with 0.
  • The CIDR block cannot be the same as the value of the CidrBlock property.
  • The subnet mask must be 8 to 24 bits in length.

Tags syntax

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

Tags propertes

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 key cannot start with acs: or aliyun.
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.

Return values

Fn::GetAtt

  • VpcId: the ID of the VPC.
  • VRouterId: the ID of the VRouter.
  • RouteTableId: the ID of the route table.

Examples

JSON format

{
  "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 format

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

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 involved.