全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::VPC::SnatEntry

更新時間:Sep 04, 2025

ALIYUN::VPC::SnatEntry類型用於在SNAT列表中添加SNAT條目。

文法

{
  "Type": "ALIYUN::VPC::SnatEntry",
  "Properties": {
    "SnatTableId": String,
    "SnatEntryName": String,
    "SourceVSwitchIds": List,
    "SourceCIDR": String,
    "SnatIp": String,
    "EipAffinity": Integer
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

SnatTableId

String

SNAT表ID。

SnatEntryName

String

SNAT規則的名稱。

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

SourceVSwitchIds

List

需要公網訪問的交換器的ID。

SourceCIDR

String

交換器或ECS執行個體的網段。

不能同時指定SourceCIDR和SourceVSwitchIds。

SnatIp

String

公網IP地址。

多個IP之間用半形逗號(,)間隔。

EipAffinity

Integer

是否開啟EIP親和性。

取值:

  • 0:關閉EIP親和性。

  • 1:開啟EIP親和性。

說明

開啟EIP親和性開關後,如果SNAT綁定多個EIP,同一個用戶端將使用相同的EIP訪問公網,否則用戶端將從綁定的EIP中隨機選取EIP訪問公網。

傳回值

Fn::GetAtt

SnatEntryIds:SNAT條目ID。

樣本

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SourceVSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    Type: String
    Label:
      zh-cn: 網路交換器ID
      en: VSwitch ID
  SnatIp:
    Type: String
    Description: The public IP address. Separate multiple EIPs with commas.
  SnatTableId:
    Type: String
    Description: The ID of the SNAT table.
Resources:
  SnatEntry:
    Type: ALIYUN::VPC::SnatEntry
    Properties:
      SourceVSwitchIds:
        - Ref: SourceVSwitchId
      SnatIp:
        Ref: SnatIp
      SnatTableId:
        Ref: SnatTableId
Outputs:
  SnatEntryIds:
    Description: The IDS of the SNAT entry.
    Value:
      Fn::GetAtt:
        - SnatEntry
        - SnatEntryIds
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SourceVSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "Type": "String",
      "Label": {
        "zh-cn": "網路交換器ID",
        "en": "VSwitch ID"
      }
    },
    "SnatIp": {
      "Type": "String",
      "Description": "The public IP address. Separate multiple EIPs with commas."
    },
    "SnatTableId": {
      "Type": "String",
      "Description": "The ID of the SNAT table."
    }
  },
  "Resources": {
    "SnatEntry": {
      "Type": "ALIYUN::VPC::SnatEntry",
      "Properties": {
        "SourceVSwitchIds": [
          {
            "Ref": "SourceVSwitchId"
          }
        ],
        "SnatIp": {
          "Ref": "SnatIp"
        },
        "SnatTableId": {
          "Ref": "SnatTableId"
        }
      }
    }
  },
  "Outputs": {
    "SnatEntryIds": {
      "Description": "The IDS of the SNAT entry.",
      "Value": {
        "Fn::GetAtt": [
          "SnatEntry",
          "SnatEntryIds"
        ]
      }
    }
  }
}