Private DNS

DNS

  • API Reference
    • API function release records
    • API Service Domain Name
    • Appendix
    • Common Headers and Error Responses
    • General Description
    • Interface Overview
    • Overview
    • Private DNS Related Interfaces
      • Add resolution record
      • Associate VPC
      • Create a PrivateZone
      • Delete PrivateZone
      • Delete resolution record
      • Disassociate VPC
      • Modify resolution record
      • Query details of a PrivateZone
      • Query PrivateZone list
      • Query resolution record list
      • Set Resolution Record Status
    • Public DNS Related Interfaces
      • Domain Name Related Interfaces
      • Line Group Related Interfaces
      • Resolution Records Related Interfaces
  • FAQs
    • General FAQs
  • Function Release Records
  • Operation guide
    • Identity and access management
    • Local DNS service
      • Add Private Zone
      • Add resolution record
      • Associate VPC
      • Delete Private Zone
      • Resolver
    • Public DNS service
      • Add domain name
      • Add resolution
      • Enable Resolution Service
      • Line Grouping Function
      • Manage Resolution
      • Resolution Line Selection
      • Upgrade Domain Name to Enterprise Edition Operation Guide
    • Resolution Logging Management
  • Product Description
    • Application scenarios
    • Product advantages
    • Product functions
    • Product overview
    • Usage restrictions
  • Product pricing
  • Quick Start
    • Activate Service
    • Use Resolution Service
  • SDK
    • Golang-SDK
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Version history
    • Java-SDK
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
    • Python-SDK
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
  • Service Level Agreement (SLA)
    • Internal DNS Service Level Agreement SLA
    • Public DNS Service Level Agreement SLA
  • Typical Practices
    • Implement URL Forwarding via Nginx
    • Local IDC Interconnection with Cloud DNS Service via Resolver
    • Quickly Set Up Private Domain Name Resolution Service Using Terraform
All documents
menu
No results found, please re-enter

DNS

  • API Reference
    • API function release records
    • API Service Domain Name
    • Appendix
    • Common Headers and Error Responses
    • General Description
    • Interface Overview
    • Overview
    • Private DNS Related Interfaces
      • Add resolution record
      • Associate VPC
      • Create a PrivateZone
      • Delete PrivateZone
      • Delete resolution record
      • Disassociate VPC
      • Modify resolution record
      • Query details of a PrivateZone
      • Query PrivateZone list
      • Query resolution record list
      • Set Resolution Record Status
    • Public DNS Related Interfaces
      • Domain Name Related Interfaces
      • Line Group Related Interfaces
      • Resolution Records Related Interfaces
  • FAQs
    • General FAQs
  • Function Release Records
  • Operation guide
    • Identity and access management
    • Local DNS service
      • Add Private Zone
      • Add resolution record
      • Associate VPC
      • Delete Private Zone
      • Resolver
    • Public DNS service
      • Add domain name
      • Add resolution
      • Enable Resolution Service
      • Line Grouping Function
      • Manage Resolution
      • Resolution Line Selection
      • Upgrade Domain Name to Enterprise Edition Operation Guide
    • Resolution Logging Management
  • Product Description
    • Application scenarios
    • Product advantages
    • Product functions
    • Product overview
    • Usage restrictions
  • Product pricing
  • Quick Start
    • Activate Service
    • Use Resolution Service
  • SDK
    • Golang-SDK
      • Exception handling
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Version history
    • Java-SDK
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
    • Python-SDK
      • Initialization
      • Install the SDK Package
      • Overview
      • Private DNS
      • Public DNS
      • Version history
  • Service Level Agreement (SLA)
    • Internal DNS Service Level Agreement SLA
    • Public DNS Service Level Agreement SLA
  • Typical Practices
    • Implement URL Forwarding via Nginx
    • Local IDC Interconnection with Cloud DNS Service via Resolver
    • Quickly Set Up Private Domain Name Resolution Service Using Terraform
  • Document center
  • arrow
  • DNS
  • arrow
  • SDK
  • arrow
  • Python-SDK
  • arrow
  • Private DNS
Table of contents on this page
  • Confirm Endpoint
  • Retrieve AK/SK
  • Create a new LocalDnsClient
  • Create a PrivateZone
  • Delete PrivateZone
  • Query PrivateZone list
  • Query details of a PrivateZone
  • Associate VPC
  • Disassociate VPC
  • Add resolution record
  • Modify resolution record
  • Delete resolution record
  • Query resolution record list
  • Enable resolution record
  • Disable the resolution record

Private DNS

Updated at:2025-11-11

Confirm Endpoint

Local DNS is a global product, and the service domain name for its API is: privatezone.baidubce.com

Retrieve AK/SK

To use the Baidu AI Cloud products, you need a Baidu AI Cloud account, a valid AK (Access Key ID) and SK (Secret Access Key) for signature certification. Your AK/SK information can be obtained and understood through the following steps: 1. Register a Baidu AI Cloud Account 2. Create AK/SK

This document primarily introduces the installation and usage of the BOS Python SDK.

Before reading this document, you need to activate the BOS service first and understand the basic knowledge of BOS. If you are not yet familiar with BOS, you can refer to Product Description and Beginner’s Guide

Create a new LocalDnsClient

When creating a LocalDnsClient, first configure a HaVipClientConfiguration-type config instance using Endpoint, AK and SK, and then use the config instance to configure the LocalDnsClient. The specific configuration method is as follows:

Plain Text
1ak = "Your Ak" # AK of the account
2 ak = "Your Sk" # SK of the account
3 endpoint = "bcc.bj.baidubce.com" # Region domain name corresponding to the service
4config = BceClientConfiguration(credentials=BceCredentials(access_key_id=ak, secret_access_key=sk), endpoint=endpoint)
5 ld_client = ld_client.LdClient(config)  # client initialization

Create a PrivateZone

Function declaration

Python
1def create_private_zone(self, create_private_zone_request=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/jkk6kkh7x

Response Value
Operation succeeded:

Python
1{
2   "zoneId":"zone-jkgdns3h"
3}

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_create_private_zone.py

Delete PrivateZone

Function declaration

Python
1def delete_private_zone(self, zone_id=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Kkk6kpur9

Response Value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_delete_private_zone.py

Query PrivateZone list

Function declaration

Python
1def list_private_zone(self, marker=None, max_keys=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Bkk6l42dl

Response Value
Operation succeeded:

Python
1{
2    "nextMarker": "zone-xktdeMSf",
3    "marker": "zone-IyWRnII7",
4    "maxKeys": 1,
5    "isTruncated": true,
6    "zones": [{
7        "zoneId": "zone-IyWRnII7",
8        "zoneName": "baidu.com",
9        "recordCount": 2,
10        "createTime": "2018-12-26 20:30:45",
11        "updateTime": "2018-12-28 21:35:40"
12    }]
13}

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_list_private_zone.py

Query details of a PrivateZone

Function declaration

Python
1def get_private_zone(self, zone_id=None):

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Jkk6lc8li

Response value
Operation succeeded:

Python
1{
2    "zoneId": "zone-xktdeMSf",
3    "zoneName": "baidu1.com",
4    "recordCount": 2,
5    "createTime": "2018-12-26 20:30:45",
6    "updateTime": "2018-12-28 21:35:40"
7    "bindVpcs": [{
8        "vpcId": "vpc-jikh8hds",
9        "vpcName": "vpcTest",
10        "vpcRegion": "bj"
11    }]
12}

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_get_private_zone.py

Associate VPC

Function declaration

Python
1def bind_vpc(self, zone_id=None, bind_vpc_request=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/qkk6lg1af

Response Value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_bind_vpc.py

Disassociate VPC

Function declaration

Python
1def unbind_vpc(self, zone_id=None, unbind_vpc_request=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Dkk6lkyy1

Response Value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_unbind_vpc.py

Add resolution record

Function declaration

Python
1def add_record(self, zone_id=None, add_record_request=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Pkk6lpe4e

Response Value
Operation succeeded:

Python
1{
2  "recordId":"rc-jih8hd5s"
3}

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_add_record.py

Modify resolution record

Function declaration

Python
1def update_record(self, record_id=None, update_record_request=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Dkk6lu5ds

Response Value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_update_record.py

Delete resolution record

Function declaration

Python
1def delete_record(self, record_id=None, delete_record_request=None, client_token=None):

Parameter meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Lkk6lx4f1

Response value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_delete_record.py

Query resolution record list

Function declaration

Python
1def list_record(self, zone_id=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Ckk6m3d7a

Response Value
Operation succeeded:

Python
1{
2    "nextMarker": "rc-Iy8p6arqenI7",
3    "marker": "rc-ik9p9zq6u5ry",
4    "maxKeys": 1,
5    "isTruncated": true,
6    "records": [{
7        "recordId": "rc-djkf8hf9",
8        "rr": "ip",
9        "value": "192.184.18.233",
10        "status": "enable",
11        "type": "A",
12        "ttl": 60,
13        "description": "desc"
14    }]
15}

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_list_record.py

Enable resolution record

Function declaration

Python
1def enable_record(self, record_id=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Bkk6m60y1

Response Value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_enable_record.py

Disable the resolution record

Function declaration

Python
1def disable_record(self, record_id=None, client_token=None):

Parameter Meaning
Refer to the OpenAPI documentation: https://cloud.baidu.com/doc/DNS/s/Bkk6m60y1

Response Value
Operation succeeded:

Python
1# No return body

Operation failed:

Throw an exception. For the exception list, refer to: Local DNS Exception List

Code example
For specific code examples, please refer to: example_disable_record.py

Previous
Overview
Next
Public DNS