Creates a port forwarding rule.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateNetworkRules

The operation that you want to perform. Set the value to CreateNetworkRules.

NetworkRules String Yes [{"InstanceId":"ddoscoo-cn-mp91j1ao****","Protocol":"tcp","FrontendPort":8080,"BackendPort":8080,"RealServers":["1.1.1.1","2.2.2.2"]}]

Details about the port forwarding rule. This parameter is a JSON string. The fields in the value are described as follows:

  • InstanceId: the ID of the instance. This field is required and must be of the STRING type.
  • Protocol: the forwarding protocol. This field is required and must be of the STRING type. Valid values: tcp and udp.
  • FrontendPort: the forwarding port. This field is required and must be of the INTEGER type.
  • BackendPort: the port of the origin server. This field is required and must be of the INTEGER type.
  • RealServers: the IP addresses of the origin server. This field is required and must be a JSON array. It can contain up to 20 IP addresses.
RegionId String No cn-hangzhou

The region ID of the instance. Valid values:

  • cn-hangzhou: mainland China, which indicates an Anti-DDoS Pro instance
  • ap-southeast-1: outside mainland China, which indicates an Anti-DDoS Premium instance

Response parameters

Parameter Type Example Description
RequestId String ADCA45A5-D15C-4B7D-9F81-138B0B36D0BD

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateNetworkRules
&NetworkRules=[{"InstanceId":"ddoscoo-cn-mp91j1ao****","Protocol":"tcp","FrontendPort":8080,"BackendPort":8080,"RealServers":["1.1.1.1","2.2.2.2"]}]
&<Common request parameters>

Sample success responses

XML format

<CreateNetworkRulesResponse>
      <RequestId>ADCA45A5-D15C-4B7D-9F81-138B0B36D0BD</RequestId>
</CreateNetworkRulesResponse>

JSON format

{
    "RequestId": "ADCA45A5-D15C-4B7D-9F81-138B0B36D0BD"
}

Error codes

For a list of error codes, visit the API Error Center.