Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::ECS::SNatEntry

Última atualização: Jun 27, 2026

Cria uma entrada SNAT em uma tabela SNAT do NAT Gateway.

Sintaxe

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

Propriedades

Nome da propriedade Tipo Obrigatório Atualização permitida Descrição Restrições
SNatTableId String Sim Sim ID da tabela SNAT. Nenhuma
SNatIp String Sim Sim Endereço IP público para SNAT. O endereço deve pertencer ao plano de largura de banda do NAT Gateway. Não é possível usar o mesmo endereço IP público na tabela de encaminhamento e na tabela SNAT simultaneamente.
SnatEntryName String Não Sim Nome da entrada SNAT. O nome deve ter de 2 a 128 caracteres. Deve começar com uma letra ou caractere chinês e não pode iniciar com http:// ou https://.
SourceCIDR String Não Não Bloco CIDR do vSwitch ou da instância ECS.
  • Granularidade de vSwitch: especifique um bloco CIDR de vSwitch, como 192.168.1.0/24, para ativar o SNAT em todas as instâncias ECS desse vSwitch. Se houver apenas um endereço SnatIp, todas as instâncias o utilizarão. Caso existam vários endereços, as instâncias selecionarão um aleatoriamente.
  • Granularidade de instância ECS: especifique o endereço IP de uma instância ECS, como 192.168.1.1/32, para ativar o SNAT nessa instância específica. Se houver apenas um endereço SnatIp, a instância o utilizará. Caso existam vários, a instância escolherá um de forma aleatória.
Especifique SourceCIDR ou SourceVSwitchId.
SourceVSwitchId String Não Sim ID do vSwitch. As instâncias ECS neste vSwitch usam a entrada SNAT para acessar a Internet. Especifique SourceCIDR ou SourceVSwitchId.

Valores de retorno

Fn::GetAtt

SNatEntryId: ID da entrada SNAT.

Exemplos

  • Formato YAML

    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
  • Formato JSON

    {
      "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"
            ]
          }
        }
      }
    }