Adiciona uma entrada SNAT a uma tabela SNAT.
Descrição da operação
Você pode chamar esta operação para adicionar entradas SNAT a gateways NAT de Internet e gateways NAT de Virtual Private Cloud (VPC). Neste tópico, um gateway NAT refere-se a ambos os tipos de gateway.
Antes de chamar esta operação, observe os seguintes limites:
-
CreateSnatEntry é uma operação assíncrona. Após o envio de uma solicitação, o sistema retorna um ID de solicitação e executa a tarefa em segundo plano. Você pode chamar a operação DescribeSnatTableEntries para consultar o status da tarefa.
Se a entrada SNAT estiver no estado Pending, o sistema está adicionando a entrada SNAT. Você pode apenas consultar o status da entrada SNAT e não pode realizar outras operações.
Se a entrada SNAT estiver no estado Available, a entrada SNAT foi adicionada.
-
Você não pode chamar repetidamente a operação CreateSnatEntry para adicionar uma entrada SNAT a uma tabela SNAT dentro do período de tempo especificado.
-
O vSwitch e a instância Elastic Compute Service (ECS) especificados em uma entrada SNAT devem ser criados na VPC onde o gateway NAT está implantado.
-
Cada vSwitch ou instância ECS pode ser especificado em apenas uma entrada SNAT.
-
Se existir um endereço IP virtual de alta disponibilidade (HAVIP) em um vSwitch, você não poderá criar entradas SNAT.
Experimente agora
Testar
Autorização RAM
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| RegionId |
string |
Sim |
O ID da região do gateway NAT. Você pode chamar a operação DescribeRegions para consultar a lista de regiões mais recente. Valores válidos:
Valores válidos:
|
cn-hangzhou |
| SnatTableId |
string |
Sim |
O ID da tabela SNAT. |
stb-bp190wu8io1vgev**** |
| SourceVSwitchId |
string |
Não |
O ID do vSwitch.
|
vsw-bp1nhx2s9ui5o**** |
| SourceCIDR |
string |
Não |
Você pode especificar o bloco CIDR de uma VPC, um vSwitch ou uma instância ECS, ou inserir um bloco CIDR personalizado. Você pode especificar uma entrada SNAT das seguintes maneiras:
Ao adicionar uma entrada SNAT a um gateway NAT de Internet, se SnatIp estiver definido como um EIP, a instância ECS usa o EIP especificado para acessar a Internet. Se SnatIp estiver definido como vários EIPs, a instância ECS seleciona aleatoriamente um EIP especificado no parâmetro SnatIp para acessar a Internet. Você não pode especificar este parâmetro e SourceVSwtichId ao mesmo tempo. Se SourceVSwitchId for especificado, você não poderá especificar SourceCIDR. Se SourceCIDR for especificado, você não poderá especificar SourceVSwitchId. |
10.1.1.0/24 |
| SnatIp |
string |
Não |
Nota
Se você especificar vários EIPs no pool de endereços IP SNAT, a conexão de serviço será alocada a vários EIPs usando o algoritmo de hash. O tráfego de cada EIP pode ser diferente. Portanto, recomendamos que você associe os EIPs a uma instância de Internet Shared Bandwidth para evitar interrupções de serviço causadas pelo esgotamento da largura de banda.
|
47.98.XX.XX |
| SnatEntryName |
string |
Não |
O nome da entrada SNAT. O nome deve ter de 2 a 128 caracteres. Deve começar com uma letra e não pode começar com |
SnatEntry-1 |
| ClientToken |
string |
Não |
O token do cliente usado para garantir a idempotência da solicitação. Você pode usar o cliente para gerar o token, mas deve garantir que o token seja único entre diferentes solicitações. O ** Descrição Se você não especificar este parâmetro, o sistema usará automaticamente o ID da solicitação como o token do cliente. O ID da solicitação pode ser diferente para cada solicitação. |
02fb3da4-130e-11e9-8e44**** |
| EipAffinity |
integer |
Não |
Especifica se a afinidade de EIP deve ser ativada. Valores válidos:
** Descrição Após ativar a afinidade de EIP, se vários EIPs estiverem associados a uma entrada SNAT, cada cliente usa um EIP para acessar a Internet. Se a afinidade de EIP estiver desativada, cada cliente usa um EIP aleatório para acessar a Internet. |
1 |
| NetworkInterfaceId |
string |
Não |
O ID da interface de rede elástica. Nota
O conjunto de endereços IPv4 da interface de rede elástica será usado como endereço SNAT. |
eni-gw8g131ef2dnbu3k**** |
| DryRun |
boolean |
Não |
Especifica se deve apenas realizar uma pré-verificação desta solicitação. Valores válidos:
|
false |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
O ID da entrada SNAT. |
||
| SnatEntryId |
string |
O ID da entrada SNAT. |
snat-kmd6nv8fy**** |
| RequestId |
string |
O ID da solicitação. |
2315DEB7-5E92-423A-91F7-4C1EC9AD**** |
Exemplos
Resposta de sucesso
JSON formato
{
"SnatEntryId": "snat-kmd6nv8fy****",
"RequestId": "2315DEB7-5E92-423A-91F7-4C1EC9AD****"
}
Códigos de erro
|
Código de status HTTP |
Código de erro |
Mensagem de erro |
Descrição |
|---|---|---|---|
| 400 | UnsupportedFeature.PrivateLinkEnabled | The feature of PrivateLinkEnabled is not supported. | |
| 400 | InvalidSourceCIDR.Malformed | SourceCIDR is illegal. | |
| 400 | NOT_ALLOW_USE_SOURCECIDR_OUTSIDEVPC | The User not in sourcecidr_unlimited_outsidevpc white list. Cannot use SourceCidr outside VpcCidr. | |
| 400 | NOT_ALLOW_USE_SOURCECIDR_AUTODEFINE | The User not in sourcecidr_unlimited_insidevpc white list. Cannot use SourceCidr auto defined. | |
| 400 | NOT_ALLOW_USE_SOURCECIDR_CONTAINSZERO | The User not in sourcecidr_unlimited_outsidevpc_containszero white list. Cannot use SourceCidr outside VpcCidr. | |
| 400 | Forbidden.IpHasBeenUsedInDnat | The snat ip can't be used. Because it has been used in dnat | |
| 400 | Forbidden.SourceVSwitchId.IncludeHaVip | There is some HaVips under specified VSwitch | The specified vSwitch is associated with HAVIPs. |
| 400 | InvalidSnatIp.Malformed | The specified SnatIp is not a valid IP address. | |
| 400 | SNAT_IP_POOL_COUNT_TOO_MANY | The Snat pool ip too many. | |
| 400 | Forbidden.SnatEntryCountLimited | SNAT entry in the specified SNAT table reach its limit. | The number of SNAT entries has reached the upper limit. |
| 400 | NOT_ALLOW_USE_SOURCECIDR | The User not in nat_scope_unlimited white list. Cannot use SourceCidr param. | |
| 400 | INVALID_PARAMETER | The parameter invalid. | |
| 400 | Forbidden.SourceVSwitchId.Duplicated | The specified SourceCIDRis duplicated. | |
| 400 | Forbidden.IpUsedInForwardTable | The specified SnatIp already used in forward table | |
| 400 | Forbindden | The specified Instance already bind eip | |
| 400 | EIP_NOT_SUPPORT_SNAT_POOL | The Eip cannot support snat pool | |
| 400 | EIP_NOT_IN_GATEWAY | The Eip not in nat gateway | |
| 400 | OperationUnsupported.CidrConflict | The specified CIDR block conflicts with an existing SNAT entry. | The specified CIDR block conflicts with those in existing SNAT entries. |
| 400 | InvalidNatGatewayId.NotFound | The NatGateway instance not exist. | |
| 400 | InvalidParameter.Name.Malformed | The specified Name is not valid. | |
| 400 | InvalidParameter.SnatIp | Ip semgment must be subnet cidr. | |
| 400 | QuotaExceeded.SnatIp | Public ip number exceeds quota. | |
| 400 | OperationUnsupported.EipInBinding | Create snat entry with eip in associating status is unsupported. | You cannot use an associated EIP when you create an SNAT entry. |
| 400 | OperationFailed.VSwitchNotInVpc | The specified vswitch and natgateway are not in the same vpc. | |
| 400 | QuotaExceeded.SnatEntry | SNAT entry in the specified SNAT table reach it?s limit. | |
| 400 | IncorrectStatus.NATGW | NATGW status is invalid. | The NAT gateway is in an invalid state. |
| 400 | IncorrectStatus.VSwitch | The specified vSwitch status is invalid. | The virtual switch status is abnormal. |
| 400 | MissingParam.SnatIp | The input parameter SnatIp that is mandatory for processing this request is not supplied. | You need to specify the SnatIp parameter when creating a Snat rule for public network NAT or private network NAT. |
| 400 | MissingParam.NetworkInterfaceId | The input parameter NetworkInterfaceId that is mandatory for processing this request is not supplied. | You need to specify NetworkInterfaceId parameters when creating a Snat rule for NAT with the private network link service enabled. |
| 400 | ParamExclusive.SnatIpAndNetworkInterfaceId | SnatIp and NetworkInterfaceId is mutually exclusive when create a snat entry for nat. | When you create an SNAT rule for a NAT Gateway instance, you cannot specify the SnatIp parameter and the NetworkInterfaceId parameter at the same time. |
| 400 | IllegalParam.NetworkInterfaceId | The param of NetworkInterfaceId is illegal. | Invalid NetworkInterfaceId value. |
| 400 | OperationUnsupported.EipNatBWPCheck | The EIP is not associated with a NAT service plan. | The EIP is not associated with a NAT service plan. |
| 400 | OperationUnsupported.EipNatGWCheck | The operation failed because the EIP is not bound to this NAT Gateway. | The operation failed because the EIP is not bound to this NAT Gateway. |
| 400 | OperationFailed.SnatIpPoolCbwpRules | The operation failed because the SNAT rule IPs are added to multi bandwidth packages. | The operation failed because the SNAT rule IP address pool was added to multiple bandwidth packages. |
| 400 | IncorrectStatus.SnatEntry | The SNAT rule status is invalid. Please try again later. | The SNAT rule is in the intermediate state, or the status is abnormal. Please try again later. |
| 400 | IncorrectStatus.NatIp | NatIp status is invalid, please try again later. | NatIp is in intermediate state, please try again later. |
| 400 | OperationUnsupported.EipNatIpCheck | The operation failed because the EIP is not bound to this NAT gateway. | The operation failed because the EIP is not bound to this NAT gateway. |
| 400 | OperationFailed.SnatIpPoolBwpRules | The operation failed because the IP in Snat entryl was added to multiple NAT bandwidth packets. | The operation failed because the IP in the SNAT rule IP address pool was added to multiple NAT bandwidth packets. |
| 400 | OperationFailed.SnatIpsCheck | The operation fails because some IPs address in the SNAT entry are not added to common bandwidth packet. | The operation fails because the IP address in the Snat rule IP address pool is not added to the shared bandwidth packet. |
| 500 | DefaultValidate.Error | validte fail. | |
| 500 | OperationFailed.CrateSnatEntryTimeOut | Operation failed because create snatEntry timeout. | |
| 404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | |
| 404 | InvalidSnatTableId.NotFound | Specified SNAT table does not exist. | |
| 404 | InvalidVSwitchId.NotFound | The specified virtual switch does not exists. | |
| 404 | InvalidSnatIp.NotFound | Specified SnatIp does not found on the NAT Gateway | |
| 404 | ResourceNotFound.NatGateway | The NatGateway instance not exist. | The NAT gateway does not exist. |
| 404 | ResourceNotFound.NatIp | The NatIp instance not exist. | |
| 404 | ResourceNotFound.VSwitch | The specified resource of %s is not found. | The specified vSwitch does not exist, please check your input is correct |
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.