全部产品
Search
文档中心

资源编排:ALIYUN::VPC::VpcCidrBlockAssociation

更新时间:Sep 29, 2024

ALIYUN::VPC::VpcCidrBlockAssociation类型用于为VPC添加附加网段。

语法

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

属性

属性名称

类型

必须

允许更新

描述

约束

VpcId

String

需要添加附加网段的VPC的ID。

Ipv6Isp

String

VPC的IPv6地址段类型。

取值:

  • BGP(默认值):阿里云 BGP IPv6。

  • ChinaMobile:中国移动(单线)。

  • ChinaUnicom:中国联通(单线)。

  • ChinaTelecom:中国电信(单线)。

说明

如果是开通了单线带宽白名单的用户,该字段可以设置为ChinaTelecom(中国电信)、ChinaUnicom(中国联通)和ChinaMobile(中国移动)。

IpVersion

String

IP地址的版本类型。

取值:

  • IPV4:IPv4地址。

  • IPV6:IPv6地址,当IpVersion参数输入IPV6SecondaryCidrBlock参数不传值时可以为VPC添加附加IPv6网段。

IpamPoolId

String

IPv4类型的IPAM地址池实例ID。

IPv6CidrBlock

String

VPC的指定IPv6网段。

说明

参数SecondaryCidrBlock和参数Ipv6CidrBlock必须输入一个且不能都输入。

SecondaryCidrMask

Integer

通过输入掩码的方式从IPAM地址池为VPC添加附加网段。

说明

指定IPAM地址池为 VPC添加附加网段,参数 SecondaryCidrBlock 或 SecondaryCidrMask 至少输入一个。

SecondaryCidrBlock

String

需要添加的附加IPv4网段。

网段要求如下:

  • 使用192.168.0.0/16172.16.0.0/12 10.0.0.0/8 三个标准网段及其子网作为VPC的附加 IPv4网段。

  • 使用除100.64.0.0/10224.0.0.0/4127.0.0.0/8169.254.0.0/16及其子网外的自定义地址段作为专有网络的附加IPv4网段。

配置限制如下:

  • 不能以0开头,掩码长度有效范围为8~28位。

  • 附加网段不得与VPC主网段及已添加的附加网段重叠。

说明

不通过IPAM地址池为 VPC添加附加网段时,参数SecondaryCidrBlock和参数Ipv6CidrBlock必须输入一个且不能都输入。

返回值

Fn::GetAtt

VpcId:添加附加网段的VPC的ID。

示例

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SecondaryCidrBlock:
    Type: String
    Description:
      en: |-
        The IPv4 CIDR block to be added. Take note of the following requirements:
        You can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block of the VPC: 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 as the secondary IPv4 CIDR block of the VPC.
        The CIDR block must meet the following requirements:
        The CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.
        The CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block of the VPC.
        Note You must and can specify only one of SecondaryCidrBlock and 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 VPC to which you want to add a secondary CIDR block.
    Value:
      Fn::GetAtt:
        - VpcCidrBlockAssociation
        - VpcId

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SecondaryCidrBlock": {
      "Type": "String",
      "Description": {
        "en": "The IPv4 CIDR block to be added. Take note of the following requirements:\nYou can specify one of the following standard IPv4 CIDR blocks or their subnets as the secondary IPv4 CIDR block of the VPC: 192.168.0.0/16, 172.16.0.0/12, and 10.0.0.0/8.\nYou 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 as the secondary IPv4 CIDR block of the VPC.\nThe CIDR block must meet the following requirements:\nThe CIDR block cannot start with 0. The subnet mask must be 8 to 28 bits in length.\nThe CIDR block cannot overlap with the primary CIDR block or an existing secondary CIDR block of the VPC.\nNote You must and can specify only one of SecondaryCidrBlock and 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 VPC to which you want to add a secondary CIDR block.",
      "Value": {
        "Fn::GetAtt": [
          "VpcCidrBlockAssociation",
          "VpcId"
        ]
      }
    }
  }
}