Updated on 2026-02-10 GMT+08:00

Binding a Public Gateway

Function

This API is used to bind a public gateway to a node in a DB instance.

Constraints

  • This operation cannot be performed on frozen or abnormal instances.
  • Only the primary or secondary node of a replica set instance is supported.
  • Only the mongos node of a cluster instance is supported.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    dds:instance:bindPublicGateway

    write

    instance

    g:EnterpriseProjectId

    -

    • nat:dnatRules:create
    • nat:dnatRules:get
    • nat:dnatRules:list
    • nat:natGateways:get
    • nat:natGateways:list
    • nat:natGateways:listTags
    • nat:snatRules:list
    • eip:publicIps:associateInstance
    • eip:publicIps:disassociateInstance

URI

  • URI format

    POST /v3/{project_id}/instances/{instance_id}/nodes/{node_id}/public-gateway

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one.

Constraints

N/A

Range

N/A

Default Value

N/A

node_id

Yes

String

Definition

ID of the node to which the public gateway rule is to be bound.

Constraints

Select the mongos node for a cluster instance and the primary or secondary node for a replica set instance.

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token obtained from IAM. For details, see Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

nat_gateway_id

Yes

String

Definition

ID of the public NAT gateway. You can call the API for Querying Public NAT Gateways to obtain the value.

Constraints

N/A

Range

N/A

Default Value

N/A

public_ip_id

Yes

String

Definition

EIP ID. You can call the API for Querying EIPs to obtain the value.

Constraints

N/A

Range

N/A

Default Value

N/A

external_service_port

Yes

Integer

Definition

Port of the EIP for providing services for external systems.

Constraints

N/A

Range

1 to 65535

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

instance_id

String

Definition

Instance ID.

Range

N/A

instance_name

String

Definition

Instance name.

Range

N/A

node_id

String

Definition

Node ID.

Range

N/A

node_name

String

Definition

Node name.

Range

N/A

nat_gateway_id

String

Definition

ID of the public NAT gateway.

Range

N/A

public_ip_id

String

Definition

EIP ID.

Range

N/A

external_service_port

Integer

Definition

Port of the EIP for providing services for external systems.

Range

1 to 65535

Example Requests

POST https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/9136fd2a9fcd405ea4674276ce36dae8in02/nodes/52a4c096bb1f455d8d866956a959519eno02/public-gateway    
{    
  "nat_gateway_id" : "cda3a125-2406-456c-a11f-598e10578541",  
  "public_ip_id" : "45da4782-e0c8-4aa4-a290-b8740014f710",
  "external_service_port"  : 8335 
}

Example Responses

{ 
  "instance_id" : "9136fd2a9fcd405ea4674276ce36dae8in02", 
  "instance_name" : "dds-4352", 
  "node_id" : "52a4c096bb1f455d8d866956a959519eno02", 
  "node_name" : "dds-4352_replica_node_1",  
  "nat_gateway_id" : "cda3a125-2406-456c-a11f-598e10578541", 
  "public_ip_id" : "45da4782-e0c8-4aa4-a290-b8740014f710",
  "external_service_port"  : 8335 
}

SDK

Click Document Database Service DDS SDK to download the SDK or view the SDK document. To learn how to install and authenticate an SDK, read the Usage section.

Status Code

For more information, see Status Code.

Error Code

For more information, see Error Code.