全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::VPC::NatIp

更新時間:Mar 28, 2026

ALIYUN::VPC::NatIp類型用於建立NAT IP地址。

文法

{
  "Type": "ALIYUN::VPC::NatIp",
  "Properties": {
    "NatIp": String,
    "NatIpCidr": String,
    "NatIpCidrId": String,
    "NatIpDescription": String,
    "NatIpName": String,
    "NatGatewayId": String,
    "Ipv4Prefix": String,
    "Ipv4PrefixCount": Integer
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

NatIp

String

建立的NAT IP地址。

如果您不指定IP地址,系統會在您的NAT IP位址區段中隨機分配一個IP地址。

NatIpCidr

String

建立NAT IP地址的位址區段。

NatIpCidrId

String

建立NAT IP地址的位址區段執行個體ID。

NatIpDescription

String

建立的NAT IP地址的描述資訊。

長度為2~256個字元,必須以字母或中文開頭,但不能以http://https://開頭。

NatIpName

String

建立的NAT IP地址的名稱。

長度為2~128個字元,必須以字母或中文開頭,可包含數字、半形句號(.)、底線(_)和短劃線(-)。但不能以http://https://開頭。

NatGatewayId

String

NAT IP地址所屬的VPC NAT Gateway執行個體ID。

Ipv4Prefix

String

建立的 IP 首碼位址區段。

該 IP 首碼位址區段必須位於 NAT 所在交換器的預留網段內,且預留網段不能被佔用。IP 首碼掩碼必須為/28。

Ipv4PrefixCount

Integer

自動分配的 IP 首碼數量。

從 NAT 所在交換器的未分配預留網段內隨機分配。取值範圍:1~10。

傳回值

Fn::GetAtt

NatIpId:建立的NAT IP地址執行個體ID。

NatIp:建立的NAT IP地址。

樣本

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  NatIpCidr:
    Type: String
    Description: The CIDR block to which the NAT IP address belongs.
  NatIpDescription:
    Type: String
    Description: |-
      The description of the NAT IP address.
      The description must be 2 to 256 characters in length. It must start with a letter
      but cannot start with http:// or https://.
    MinLength: 2
    MaxLength: 256
  NatIpName:
    Type: String
    Description: |-
      The name of the NAT IP address.
      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. It cannot start
      with http:// or https://.
    MinLength: 2
    MaxLength: 128
  NatGatewayId:
    Type: String
    Description: |-
      The ID of the Virtual Private Cloud (VPC) NAT gateway for which you want to create
      the NAT IP address.
Resources:
  VPCNatIp:
    Type: ALIYUN::VPC::NatIp
    Properties:
      NatIpCidr:
        Ref: NatIpCidr
      NatIpDescription:
        Ref: NatIpDescription
      NatIpName:
        Ref: NatIpName
      NatGatewayId:
        Ref: NatGatewayId
Outputs:
  NatIpId:
    Description: The ID of the NAT IP address.
    Value:
      Fn::GetAtt:
        - VPCNatIp
        - NatIpId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "NatIpCidr": {
      "Type": "String",
      "Description": "The CIDR block to which the NAT IP address belongs."
    },
    "NatIpDescription": {
      "Type": "String",
      "Description": "The description of the NAT IP address.\nThe description must be 2 to 256 characters in length. It must start with a letter\nbut cannot start with http:// or https://.",
      "MinLength": 2,
      "MaxLength": 256
    },
    "NatIpName": {
      "Type": "String",
      "Description": "The name of the NAT IP address.\nThe name must be 2 to 128 characters in length, and can contain letters, digits, periods\n(.), underscores (_), and hyphens (-). It must start with a letter. It cannot start\nwith http:// or https://.",
      "MinLength": 2,
      "MaxLength": 128
    },
    "NatGatewayId": {
      "Type": "String",
      "Description": "The ID of the Virtual Private Cloud (VPC) NAT gateway for which you want to create\nthe NAT IP address."
    }
  },
  "Resources": {
    "VPCNatIp": {
      "Type": "ALIYUN::VPC::NatIp",
      "Properties": {
        "NatIpCidr": {
          "Ref": "NatIpCidr"
        },
        "NatIpDescription": {
          "Ref": "NatIpDescription"
        },
        "NatIpName": {
          "Ref": "NatIpName"
        },
        "NatGatewayId": {
          "Ref": "NatGatewayId"
        }
      }
    }
  },
  "Outputs": {
    "NatIpId": {
      "Description": "The ID of the NAT IP address.",
      "Value": {
        "Fn::GetAtt": [
          "VPCNatIp",
          "NatIpId"
        ]
      }
    }
  }
}