All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::VPC::SnatEntry

Last Updated:Jul 03, 2023

ALIYUN::VPC::SnatEntry is used to add SNAT entries to an SNAT table.

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

SnatTableId

String

Yes

No

The ID of the SNAT table.

None.

SnatEntryName

String

No

Yes

The name of the SNAT entry.

The name must be 2 to 128 characters in length. The name must start with a letter, and cannot start with http:// or https://

SourceVSwitchIds

List

No

No

The IDs of the vSwitches that access the Internet.

None.

SourceCIDR

String

No

No

The CIDR block of the vSwitch or the Elastic Compute Service (ECS) instance.

You cannot specify both SourceCIDR and SourceVSwitchIds.

SnatIp

String

Yes

Yes

The public IP addresses.

Separate multiple IP addresses with commas (,).

EipAffinity

Integer

No

No

Specifies whether to enable elastic IP address (EIP) affinity.

Valid values:

  • 0: disables EIP affinity.

  • 1: enables EIP affinity.

Note

If EIP affinity is enabled and the SNAT entry is associated with multiple EIPs, a client uses the same EIP to access the Internet. Otherwise, the client uses an EIP selected from the associated EIPs to access the Internet.

Return values

Fn::GetAtt

SnatEntryIds: the IDs of the SNAT entries.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  SourceVSwitchId:
    AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
    Type: String
    Label:
       
      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

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "SourceVSwitchId": {
      "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
      "Type": "String",
      "Label": {
         
        "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"
        ]
      }
    }
  }
}