All Products
Search
Document Center

ENS:CreateForwardEntry

Last Updated:Jul 26, 2024

Adds a Destination Network Address Translation (DNAT) entry to a DNAT table.

Debugging

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

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ens:CreateForwardEntrycreate
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
NatGatewayIdstringYes

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

nat-5t7nh1cfm6kxiszlttr383xpo
ExternalIpstringYes

The elastic IP address (EIP) that is used to access the Internet.

121.11.36.28
ExternalPortstringYes

The external port or port range that is used for port forwarding.

  • Valid values: 1 to 65535.
  • To specify a port range, separate the first port and the last port with a forward slash (/), such as 10/20.
  • If you set ExternalPort to a port range, you must also set InternalPort to a port range, and the number of ports specified must be the same for both parameters. For example, if you set ExternalPort to 10/20, you can set InternalPort to 80/90.
22
InternalIpstringYes

The private IP address of the instance that uses the DNAT entry for Internet communication.

10.0.0.13
InternalPortstringYes

The internal port or port range that is used for port forwarding.

  • Valid values: 1 to 65535.
  • To specify a port range, separate the first port and the last port with a forward slash (/), such as 10/20.
22
ForwardEntryNamestringNo

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

test0
IpProtocolstringNo

The protocol. Valid values:

  • TCP: forwards TCP packets.
  • UDP: forwards UDP packets.
  • Any (default): forwards all packets.
Any
HealthCheckPortintegerNo

The probe port. The port must be within the internal port range. By default, this parameter is left empty.

80
StandbyExternalIpstringNo

The secondary EIP that is used to access the Internet. You need to select a secondary EIP that is bound to NAT. After the DNAT entry is created, the secondary EIP takes effect.

101.XXX.XXX.4

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The ID of the request.

EF6D6FA4-DACA-5822-A981-81006271D263
ForwardEntryIdstring

The ID of the DNAT entry.

fwd-5tc07cw14metghn3siv4ak8do

Examples

Sample success responses

JSONformat

{
  "RequestId": "EF6D6FA4-DACA-5822-A981-81006271D263",
  "ForwardEntryId": "fwd-5tc07cw14metghn3siv4ak8do"
}

Error codes

HTTP status codeError codeError messageDescription
400ens.interface.error An error occurred while call the API. -
400Invalid%sThe specified parameter %s is invalid.-
400Missing%sYou must specify the parameter %s.-
400InvalidParameter.NatNotFoundThe specified Nat is not found.The specified parameter Nat does not exist.
400InvalidParameter.ExternalIpThe specified externalIp is not found.-
400Forbidden.ExternalIpUsedInSnatForbidden.ExternalIpUsedInSnat-
400InvalidParameter.InternalIpThe specified parameter internalIp is invalid.The parameter internal IP is incorrect.
400InvalidParameter.InternalIpNotFoundThe input parameter internalIp that is not found.-
400InvalidPort.MalformedThe specified port is not a valid port. -
400Forbidden.ExternalPort.DuplicatedThe specified ExternalPort is duplicated.A DNAT rule has been configured for the external port. Do not repeat the configuration.
400ForwardEntryLimitExceedThe limit of forward entry in the nat reaches.-
400InvalidParameter.HealthCheckPortHealthCheckPort is not in the range of InternalPort-
400IncorrectInstanceStatusThe current status of the instance does not support this operation.The instance is in a state that does not support the current operation.
400SystemBusySystem is busy, please try again later.The system is currently busy, please try again later.
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
2024-06-28The Error code has changedView Change Details
2024-01-23The Error code has changedView Change Details
2023-11-16The Error code has changedView Change Details
2023-07-18The Error code has changed. The request parameters of the API has changedView Change Details