If you use a domain name to connect to a database, you can bind the private domain name to an internal endpoint to retain the original database domain name after the database is migrated to the cloud.

Scenarios

You can bind a private domain name to each internal endpoint of an Apsara PolarDB cluster. Private domain names only apply to the VPC that you specify within the current region. Private domain names have a higher priority for resolution than domain names that are currently in use worldwide.

For example, assume that the domain name of a database is abc.test.com and the endpoint of an Apsara PolarDB cluster is a.polardb.aliyuncs.com. If you migrate the database to the Apsara PolarDB cluster, you can create a private domain name and bind abc.test.com, which is a CNAME record, to a.polardb.aliyuncs.com to keep the original domain name unchanged. After the domain name is bound to the endpoint, you can access abc.test.com in the specified VPC to reach the Apsara PolarDB cluster, as shown in the following figure.

Private domain name scenarios

Billing

You can map a private domain name managed by PrivateZone to an internal endpoint of an Apsara PolarDB cluster. A small fee is charged by PrivateZone. For more information, see Pricing.

Bind a private domain name

  1. Log on to the Apsara PolarDB console.
  2. In the upper-left corner of the page, select the region where the target cluster resides.
  3. Find the target cluster and click the target cluster ID.
  4. In the Connection Information section on the Overview page, click Bind Private Domain to the right of the target internal endpoint.
    Bind a private domain name
  5. In the Bind Private Domain dialog box, enter the prefix of the private domain name and the suffix of the private domain name .
    Prefix of a domain name and zone

    The format of private domain names is <prefix>. <suffix>. The following table describes formats of private domain names.

    No. Parameter Description
    1 Prefix of a private domain name The prefix of a private domain name must be 6 to 30 characters in length and can contain at least one of the following types of characters: lowercase letters, digits, and hyphens (-). It must start with a letter and end with a letter or digit.
    2 Suffix of a private domain name (zone) You can select an existing zone or enter a zone. For more information about zones, see PrivateZone.
    Note
    • If the VPC where your Apsara PolarDB cluster resides is not in the configured zone, the system automatically binds the VPC to the zone.
    • You can view and manage your zone in the PrivateZone console.
    Note When you bind a private domain name, the system automatically creates an AliyunServiceRoleForPolarDB role. For more information, see RAM role linked to Apsara PolarDB.
  6. Click OK.
  7. In the Bind Private Domain message that appears, confirm the domain name again and click OK.
    Confirm the private domain name again
    Note
    • After you bind the private domain name, the PrivateZone console automatically generates a record.
    • In the specified VPC, the private domain name is preferentially mapped to an internal endpoint of your Apsara PolarDB cluster. The binding takes effect immediately.
    • In the PrivateZone console, if you unbind the VPC where your Apsara PolarDB cluster resides from the zone, the private domain name becomes invalid. For more information about how to bind or unbind a VPC in the PrivateZone console, see PrivateZone documentation.

Related operations

Operation Description
ModifyDBEndpointAddress Modifies the endpoints of an Apsara PolarDB cluster. The endpoints include primary endpoint, default cluster endpoint, custom cluster endpoint, and private domain name.