全部产品
Search
文档中心

资源编排:ALIYUN::VPC::NatIpCidr

更新时间:Mar 26, 2024

ALIYUN::VPC::NatIpCidr类型用于创建NAT IP地址段。

语法

{
  "Type": "ALIYUN::VPC::NatIpCidr",
  "Properties": {
    "NatIpCidr": String,
    "NatIpCidrDescription": String,
    "NatIpCidrName": String,
    "NatGatewayId": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

NatIpCidr

String

创建的NAT IP地址段。

新建的地址段必须满足以下条件:

  • 属于10.0.0.0/8、172.16.0.0/12或192.168.0.0/16网段及其子网。

  • 支持的子网掩码位数范围为16至32位。

  • 不能与VPC NAT网关所属VPC的私网网段重叠。如果您需要将私网地址转换为VPC私网网段内的其他地址,请在对应的VPC私网网段内创建交换机,然后在该交换机中创建新的VPC NAT网关提供私网地址转换服务。

  • 如需使用公网地址段作为NAT IP地址段,则该地址段必须属于VPC NAT网关所属VPC的用户网段。关于用户网段的更多信息,请参见专有网络FAQ

NatIpCidrDescription

String

NAT IP地址段的描述信息。

长度为2~256个字符,必须以字母或中文开头,但不能以http://https://开头。

NatIpCidrName

String

NAT IP地址段的名称。

长度为2~128个字符,必须以字母或中文开头,可包含数字、半角句号(.)、下划线(_)和短划线(-)。但不能以http://https://开头。

NatGatewayId

String

创建NAT IP地址段所属的VPC NAT网关实例ID。

返回值

Fn::GetAtt

NatIpCidrId:创建的NAT IP地址段的实例ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      NatGatewayId:
        Description:
          en: The ID of the Virtual Private Cloud (VPC) NAT gateway with which you want
            to associate the CIDR block.
        Required: true
        Type: String
      NatIpCidr:
        Description:
          en: 'The NAT CIDR block that you want to associate with the NAT gateway.
    
            The new CIDR block must meet the following conditions:
    
            The NAT CIDR block must fall within 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16,
            or their subnets.
    
            The subnet mask must be 16 to 32 bits in length.
    
            The NAT CIDR block cannot overlap with the private CIDR block of the VPC to
            which the NAT gateway belongs. If you want to use other IP addresses from
            the private CIDR block of the VPC to provide NAT services, create a vSwitch
            and attach the vSwitch to another VPC NAT gateway.
    
            If you want to use public IP addresses to provide NAT services, make sure
            that the public IP addresses fall within a customer CIDR block of the VPC
            to which the VPC NAT gateway belongs. For more information, see What is customer
            CIDR block?.'
        Required: true
        Type: String
      NatIpCidrDescription:
        Description:
          en: 'The description of the NAT CIDR block.
    
            The description must be 2 to 256 characters in length and start with a letter.
            The description cannot start with http:// or https://.'
        Required: true
        Type: String
      NatIpCidrName:
        Description:
          en: 'The name of the CIDR block.
    
            The name must be 2 to 128 characters in length, and can contain letters, digits,
            periods (.), underscores (_), and hyphens (-). It must start with a letter.
            The name must start with a letter and cannot start with http:// or https://.'
        Required: true
        Type: String
    Resources:
      VPCNatIpCidr:
        Properties:
          NatGatewayId:
            Ref: NatGatewayId
          NatIpCidr:
            Ref: NatIpCidr
          NatIpCidrDescription:
            Ref: NatIpCidrDescription
          NatIpCidrName:
            Ref: NatIpCidrName
        Type: ALIYUN::VPC::NatIpCidr
    Outputs:
      NatIpCidrId:
        Description: The ID of the NAT CIDR block.
        Value:
          Fn::GetAtt:
          - VPCNatIpCidr
          - NatIpCidrId
                            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "NatIpCidr": {
          "Type": "String",
          "Description": {
            "en": "The NAT CIDR block that you want to associate with the NAT gateway.\nThe new CIDR block must meet the following conditions:\nThe NAT CIDR block must fall within 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, or their subnets.\nThe subnet mask must be 16 to 32 bits in length.\nThe NAT CIDR block cannot overlap with the private CIDR block of the VPC to which the NAT gateway belongs. If you want to use other IP addresses from the private CIDR block of the VPC to provide NAT services, create a vSwitch and attach the vSwitch to another VPC NAT gateway.\nIf you want to use public IP addresses to provide NAT services, make sure that the public IP addresses fall within a customer CIDR block of the VPC to which the VPC NAT gateway belongs. For more information, see What is customer CIDR block?."
          },
          "Required": true
        },
        "NatIpCidrDescription": {
          "Type": "String",
          "Description": {
            "en": "The description of the NAT CIDR block.\nThe description must be 2 to 256 characters in length and start with a letter. The description cannot start with http:// or https://."
          },
          "Required": true
        },
        "NatIpCidrName": {
          "Type": "String",
          "Description": {
            "en": "The name of the CIDR block.\nThe name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). It must start with a letter. The name must start with a letter and cannot start with http:// or https://."
          },
          "Required": true
        },
        "NatGatewayId": {
          "Type": "String",
          "Description": {
            "en": "The ID of the Virtual Private Cloud (VPC) NAT gateway with which you want to associate the CIDR block."
          },
          "Required": true
        }
      },
      "Resources": {
        "VPCNatIpCidr": {
          "Type": "ALIYUN::VPC::NatIpCidr",
          "Properties": {
            "NatIpCidr": {
              "Ref": "NatIpCidr"
            },
            "NatIpCidrDescription": {
              "Ref": "NatIpCidrDescription"
            },
            "NatIpCidrName": {
              "Ref": "NatIpCidrName"
            },
            "NatGatewayId": {
              "Ref": "NatGatewayId"
            }
          }
        }
      },
      "Outputs": {
        "NatIpCidrId": {
          "Description": "The ID of the NAT CIDR block.",
          "Value": {
            "Fn::GetAtt": [
              "VPCNatIpCidr",
              "NatIpCidrId"
            ]
          }
        }
      }
    }