All Products
Search
Document Center

ENS:CreateSnatEntry

Last Updated:Mar 12, 2024

Adds a source network address translation (SNAT) entry to a specified SNAT table.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
NatGatewayIdstringYes

The ID of the Network Address Translation (NAT) gateway.

nat-5tawjw5j7sgd2deujxuk0****
SnatIpstringYes

The elastic IP address (EIP) in the SNAT entry. Separate multiple EIPs with commas (,).

120.XXX.XXX.71
SourceVSwitchIdstringNo

The ID of the vSwitch that you need to access over the Internet. This parameter specifies that Edge Node Service (ENS) instances in the vSwitch can use the SNAT entry to access the Internet.

Note If you specify SourceVSwitchId and SourceCIDR, SourceVSwitchId does not take effect. The value that you specified for SourceCIDR takes precedence.
vsw-bp1hwx7gi495q260p****
SourceCIDRstringNo

The CIDR block. You can specify the CIDR block of a network, a vSwitch, or an instance. You can also specify a custom CIDR block. All instances within the CIDR block can access the Internet or external networks by using SNAT.

Note If you specify SourceVSwitchId and SourceCIDR, SourceVSwitchId does not take effect. The value that you specified for SourceCIDR takes precedence.
10.0.0.0/24
SnatEntryNamestringNo

The name of the SNAT entry. The name must be 1 to 128 characters in length. The name cannot start with http:// or https://.

test0
SourceNetworkIdstringNo

The ID of the network. This parameter specifies that all ENS instances in the network can use the SNAT entry to access the Internet.

Note If you specify SourceNetworkId and SourceVSwitchId or SourceCIDR, SourceNetworkId does not take effect. The value that you specified for SourceCIDR takes precedence. Priority: SourceCIDR > SourceVSwitchId > SourceNetworkId.
n-2zeuphj08tt7q3brd****
StandbySnatIpstringNo

The secondary EIP in the SNAT entry. Separate multiple secondary EIPs with commas (,).

101.XXX.XXX.7

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

018EED6A-69CA-58C8-A345-498927D5D34E
SnatEntryIdstring

The ID of the SNAT entry.

snat-5tc08qfj5ecblfdn2rqr9****

Examples

Sample success responses

JSONformat

{
  "RequestId": "018EED6A-69CA-58C8-A345-498927D5D34E",
  "SnatEntryId": "snat-5tc08qfj5ecblfdn2rqr9****"
}

Error codes

HTTP status codeError codeError message
400Invalid%sThe specified parameter %s is invalid.
400Missing%sYou must specify the parameter %s.
400ens.interface.error An error occurred while call the API.
400Forbidden.SnatIpUsedInDnatForbidden.SnatIpUsedInDnat
400InvalidParameter.VSwitchNotFoundThe specified VSwitch is not found.
400InvalidParameter.SourceCIDRThe specified parameter SourceCIDR is invalid.
400Forbidden.SourceCIDR.NotSupportSourceCIDR support intranet cidr only.
400Forbidden.SourceCIDR.DuplicatedThe specified sourceCIDR is duplicated.
400InvalidParameter.NatNotFoundThe specified Nat is not found.
400InvalidParameter.SnatIpThe specified SnatIp is not found.
400SnatEntryLimitExceedThe limit of snat entry in the network reaches.
400SnatIpLimitExceedThe Snat pool ip too many.
400InvalidParameter.SourceNetworkIdThe specified parameter SourceNetworkId is invalid.
400NoPermissionPermission denied.
400InvalidParameter.%sThe specified field %s invalid. Please check it again.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-07-18The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: StandbySnatIp