All Products
Search
Document Center

Alibaba Cloud DNS:AddResolverRule

Last Updated:Dec 03, 2025

The AddResolverRule operation adds a forwarding rule.

Operation description

If the outbound VPC and the inbound VPC are the same, the IP address of the external DNS system in the forwarding rule for the outbound endpoint cannot be the same as the IP address of the inbound endpoint service. This is because if the IP addresses are the same, a request loopback occurs and DNS resolution fails.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

pvtz:AddResolverRule

create

*Endpoint

acs:pvtz:*:{#accountId}:endpoint/{#EndpointId}

*Rule

acs:pvtz:*:{#accountId}:rule/*

None None

Request parameters

Parameter

Type

Required

Description

Example

Name

string

Yes

The name of the forwarding rule. Name the rule as needed.

test

Type

string

No

The type of the forwarding rule. The only valid value is OUTBOUND. This value indicates that DNS queries are forwarded to an external IP address.

Note

You cannot change this value after the forwarding rule is created.

OUTBOUND

ZoneName

string

Yes

The domain name (zone) for which you want to forward DNS queries.

Note

You cannot change this value after the forwarding rule is created.

example.com

EndpointId

string

No

The ID of the outbound endpoint. The outbound endpoint forwards DNS queries to the specified destination IP addresses.

hr****

ForwardIp

array<object>

Yes

The IP addresses and ports of the destination servers in the external DNS system to which DNS queries are forwarded. You can specify up to 6 destination servers. Both private and public IP addresses are supported.

Note

If you specify public IP addresses for the external DNS servers, and the Elastic Compute Service (ECS) instances in the VPC of the outbound endpoint do not have public IP addresses, enable a NAT Gateway and configure SNAT entries.

object

No

The information about the destination server.

Ip

string

Yes

The IP address of the destination server.

Note

The IP addresses in the following ranges are reserved by the system and cannot be used as the IP addresses of external DNS systems: 100.100.2.136 to 100.100.2.138 and 100.100.2.116 to 100.100.2.118.

172.16.XX.XX

Port

integer

Yes

The port number of the destination server.

8080

Lang

string

No

The language of the response. Valid values:

  • zh: Chinese.

  • en: English.

Default value: en.

en

Vpcs

array<object>

No

object

No

VpcUserId

integer

No

VpcType

string

No

RegionId

string

No

VpcId

string

No

EdgeDnsClusters

array<object>

No

object

No

ClusterId

string

No

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

725B8BED-901F-480C-BBAC-FA59A18580C1

RuleId

string

The ID of the forwarding rule.

hr****

Examples

Success response

JSON format

{
  "RequestId": "725B8BED-901F-480C-BBAC-FA59A18580C1",
  "RuleId": "hr****\n"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.