All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::VPC::VpcCidrBlockAssociation

Last Updated:Mar 28, 2026

ALIYUN::VPC::VpcCidrBlockAssociation is used to add a secondary CIDR block to a virtual private cloud (VPC).

Syntax

{
  "Type": "ALIYUN::VPC::VpcCidrBlockAssociation",
  "Properties": {
    "VpcId": String,
    "Ipv6Isp": String,
    "IpVersion": String,
    "IpamPoolId": String,
    "IPv6CidrBlock": String,
    "SecondaryCidrMask": Integer,
    "SecondaryCidrBlock": String,
    "Ipv6CidrMask": Integer
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

VpcId

String

Yes

No

The ID of the VPC to which you want to add a secondary CIDR block.

None.

Ipv6Isp

String

No

No

The type of the IPv6 CIDR block that you want to add to the VPC.

Valid values:

  • BGP (default): Alibaba Cloud Border Gateway Protocol (BGP)

  • ChinaMobile: China Mobile (single ISP)

  • ChinaUnicom: China Unicom (single ISP)

  • ChinaTelecom: China Telecom (single ISP)

Note

If you have the permissions to use single-ISP bandwidth, the valid values of this property are ChinaTelecom, ChinaUnicom, and ChinaMobile.

IpVersion

String

No

No

The IP version of the IP address.

Valid values:

  • IPV4: IPv4.

  • IPV6: IPv6. If you set IpVersion to IPV6 and leave SecondaryCidrBlock empty, you can add a secondary IPv6 CIDR block to the VPC.

IpamPoolId

String

No

No

The ID of the IP Address Manager (IPAM) pool of the IPv4 type.

None.

IPv6CidrBlock

String

No

No

The IPv6 CIDR block that you want to add to the VPC.

Note

You must specify one of SecondaryCidrBlock and Ipv6CidrBlock.

Ipv6CidrMask

Integer

No

No

The subnet mask of the VPC's IPv6 CIDR block allocated from an IPAM pool.

None

SecondaryCidrMask

Integer

No

No

The subnet mask that you want to use to add a secondary CIDR block from the IPAM pool to the VPC.

Note

If you use an IPAM pool to add a secondary CIDR block to a VPC, you must specify at least one of SecondaryCidrBlock and SecondaryCidrMask.

SecondaryCidrBlock

String

No

No

The secondary IPv4 CIDR block that you want to add to the VPC.

Take note of the following requirements on CIDR blocks:

  • You can use one of the following standard CIDR blocks or their subnets: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.

  • You can also use a custom CIDR block other than 100.64.0.0/10, 224.0.0.0/4, 127.0.0.0/8, 169.254.0.0/16, or their subnets.

The following limits apply:

  • The secondary IPv4 CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.

  • The secondary IPv4 CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block of the VPC.

Note

If you do not use an IPAM pool to add a secondary CIDR block to a VPC, you must specify one of SecondaryCidrBlock and Ipv6CidrBlock.

Return values

Fn::GetAtt

VpcId: the ID of the VPC to which the secondary CIDR block is added.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SecondaryCidrBlock:
    Type: String
    Description:
      en: |-
        The secondary IPv4 CIDR block to add.
        Supported blocks include standard CIDR blocks (e.g., 10.0.0.0/8) and their subnets, or custom blocks outside of reserved ranges (e.g., 100.64.0.0/10).
        The subnet mask must be between 8 and 28 bits, and the CIDR block cannot overlap with the primary or any other secondary CIDR block.
        Note: You must specify either this parameter or Ipv6CidrBlock.
    Required: false
  VpcId:
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Type: String
    Description:
      en: The ID of the VPC to which you want to add a secondary CIDR block.
    Required: true
Resources:
  VpcCidrBlockAssociation:
    Type: ALIYUN::VPC::VpcCidrBlockAssociation
    Properties:
      SecondaryCidrBlock:
        Ref: SecondaryCidrBlock
      VpcId:
        Ref: VpcId
Outputs:
  VpcId:
    Description: The ID of the associated VPC.
    Value:
      Fn::GetAtt:
        - VpcCidrBlockAssociation
        - VpcId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SecondaryCidrBlock": {
      "Type": "String",
      "Description": {
        "en": "The secondary IPv4 CIDR block to add.\nSupported blocks include standard CIDR blocks (e.g., 10.0.0.0/8) and their subnets, or custom blocks outside of reserved ranges (e.g., 100.64.0.0/10). \nThe subnet mask must be between 8 and 28 bits, and the CIDR block cannot overlap with the primary or any other secondary CIDR block.\nNote: You must specify either this parameter or Ipv6CidrBlock."
      },
      "Required": false
    },
    "VpcId": {
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
      "Type": "String",
      "Description": {
        "en": "The ID of the VPC to which you want to add a secondary CIDR block."
      },
      "Required": true
    }
  },
  "Resources": {
    "VpcCidrBlockAssociation": {
      "Type": "ALIYUN::VPC::VpcCidrBlockAssociation",
      "Properties": {
        "SecondaryCidrBlock": {
          "Ref": "SecondaryCidrBlock"
        },
        "VpcId": {
          "Ref": "VpcId"
        }
      }
    }
  },
  "Outputs": {
    "VpcId": {
      "Description": "The ID of the associated VPC.",
      "Value": {
        "Fn::GetAtt": [
          "VpcCidrBlockAssociation",
          "VpcId"
        ]
      }
    }
  }
}