ALIYUN::ECS::SNatEntry

更新时间:
复制 MD 格式

Creates an SNAT entry in a NAT Gateway SNAT table.

Syntax

{
  "Type": "ALIYUN::ECS::SNatEntry",
  "Properties": {
    "SNatTableId": String,
    "SNatIp": String,
    "SnatEntryName": String,
    "SourceCIDR": String,
    "SourceVSwitchId": String
  }
}

Properties

Property name Type Required Update allowed Description Constraints
SNatTableId String Yes Yes The SNAT table ID. None
SNatIp String Yes Yes The public IP address for SNAT. Must be from the NAT Gateway bandwidth plan. A public IP address cannot exist in both the forwarding table and the SNAT table.
SnatEntryName String No Yes The name of the SNAT entry. The name must be 2 to 128 characters in length. It must start with a letter or a Chinese character and cannot start with http:// or https://.
SourceCIDR String No No The CIDR block of the vSwitch or ECS instance.
  • vSwitch granularity: Specify a vSwitch CIDR block, such as 192.168.1.0/24, to enable SNAT for all ECS instances in the vSwitch. With one SnatIp address, all instances use that address. With multiple addresses, instances randomly select one.
  • ECS instance granularity: Specify an ECS instance IP address, such as 192.168.1.1/32, to enable SNAT for that instance. With one SnatIp address, the instance uses that address. With multiple addresses, the instance randomly selects one.
Specify either SourceCIDR or SourceVSwitchId.
SourceVSwitchId String No Yes The vSwitch ID. ECS instances in this vSwitch use the SNAT entry to access the Internet. Specify either SourceCIDR or SourceVSwitchId.

Return values

Fn::GetAtt

SNatEntryId: The ID of the SNAT entry.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      SourceVSwitchId:
        Type: String
        AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
        Description: The vSwitch that is allowed to access the Internet.
      SNatTableId:
        Type: String
        Description: The SNAT table in which to create the SNAT entry.
    Resources:
      SNatTableEntry:
        Type: ALIYUN::ECS::SNatEntry
        Properties:
          SourceVSwitchId:
            Ref: SourceVSwitchId
          SnatEntryName: test_entry_name
          SNatTableId:
            Ref: SNatTableId
          SNatIp: 100.100.100.1
    Outputs:
      SNatEntryId:
        Description: The ID of the created SNAT entry.
        Value:
          Fn::GetAtt:
            - SNatTableEntry
            - SNatEntryId
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "SourceVSwitchId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
          "Description": "The vSwitch that is allowed to access the Internet."
        },
        "SNatTableId": {
          "Type": "String",
          "Description": "The SNAT table in which to create the SNAT entry."
        }
      },
      "Resources": {
        "SNatTableEntry": {
          "Type": "ALIYUN::ECS::SNatEntry",
          "Properties": {
            "SourceVSwitchId": {
              "Ref": "SourceVSwitchId"
            },
            "SnatEntryName": "test_entry_name",
            "SNatTableId": {
              "Ref": "SNatTableId"
            },
            "SNatIp": "100.100.100.1"
          }
        }
      },
      "Outputs": {
        "SNatEntryId": {
          "Description": "The ID of the created SNAT entry.",
          "Value": {
            "Fn::GetAtt": [
              "SNatTableEntry",
              "SNatEntryId"
            ]
          }
        }
      }
    }