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个字符,必须以英文字母或汉字开头,但不能以 | 
| SourceVSwitchIds | List | 否 | 是 | 需要公网访问的交换机的ID。 | 无 | 
| SourceCIDR | String | 否 | 否 | 交换机或ECS实例的网段。 | 不能同时指定SourceCIDR和SourceVSwitchIds。 | 
| SnatIp | String | 是 | 是 | 公网IP地址。 | 多个IP之间用半角逗号(,)间隔。 | 
| EipAffinity | Integer | 否 | 否 | 是否打开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"
        ]
      }
    }
  }
}该文章对您有帮助吗?