AddZoneRecord

Updated at:

Calls AddZoneRecord to add a built-in authoritative DNS record. Within the effective scope of resolution, the internal network DNS records of the domain name overwrite its public network DNS records.

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:AddZoneRecord

create

*Zone

acs:pvtz::{#accountId}:zone/{#ZoneId}

None None

Request parameters

Parameter

Type

Required

Description

Example

ZoneId

string

Yes

The zone ID, which is the unique identifier of the zone.

df2d03865266bd9842306db586d3****

Lang

string

No

The language of the response. Valid values:

  • zh: Chinese.

  • en: English.

Default value: en.

en

Rr

string

Yes

The hostname record. The hostname record is the prefix of the domain name. Common values include www, @, * (wildcard DNS record), and mail (commonly used for email).

For example, to resolve @.example.com, set the hostname record to @ instead of leaving it empty.

www

Type

string

Yes

The type of the DNS record. Valid values:

  • A: Maps the domain name to an IPv4 address in dotted-decimal format.

  • AAAA: Maps the domain name to an IPv6 address.

  • CNAME: Maps the domain name to another domain name.

  • TXT: Specifies a text string up to 255 characters in length. It is typically used for Sender Policy Framework (SPF) records to prevent spam.

  • MX: Maps the domain name to the domain name of a mail server.

  • PTR: Maps an IP address to a domain name.

  • SRV: Records the server that provides a specific service. The format is priority weight port target address, with each item separated by a space.

Note

Before adding a PTR record, you must configure a reverse resolution zone. For more information, see Reverse resolution and PTR records.

A

Line

string

No

The source of the DNS query. Valid values:

  • default: The default DNS line, which is equivalent to a global line. We recommend that you configure the default line as a fallback to ensure that a DNS record is returned when no intelligent line is matched.

  • Alibaba Cloud line: Indicates that the DNS query originates from Alibaba Cloud, including the public cloud, Finance Cloud, and Gov Cloud.

  • Custom line: Allows you to customize internal domain name resolution to return specific IP addresses for DNS queries from a specific CIDR block.

Note
  • Only domain names in built-in authoritative accelerated zones support adding DNS query source lines.

  • To select the default resolution, enter default. For the Alibaba Cloud line and custom lines, you must enter the specified line code.

Example: aliyun_r_cn-beijing-a.

default

Weight

integer

No

The weight value. The value must be an integer from 1 to 100. Default value: 1. You can set different weight values for each address so that DNS queries return addresses based on the weight ratio.

1

Ttl

integer

No

The local cache time-to-live (TTL). Valid values: 5, 30, 60, 3600 (1 hour), 43200 (12 hours), and 86400 (24 hours). Unit: seconds. Default value: 60.

60

Priority

integer

No

The priority of the MX record. A smaller value indicates a higher priority. Valid values: [1,99].

5

Value

string

Yes

The record value. Specify the record value based on the DNS record type.

114.55.XX.XX

UserClientIp

string

No

The IP address of the user.

127.0.XX.XX

Remark

string

No

The remark.

en

ClientToken

string

No

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can contain a maximum of 64 ASCII characters.

6447728c8578e66aacf062d2df4446dc

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

0B7AD377-7E86-44A8-B9A8-53E8666E72FE

RecordId

integer

The DNS record ID.

429570****

Success

boolean

Indicates whether the request is successful.

true

Examples

Success response

JSON format

{
  "RequestId": "0B7AD377-7E86-44A8-B9A8-53E8666E72FE",
  "RecordId": 0,
  "Success": true
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.