Assume that you use domain names to connect to databases and you want to retain the original domain names of the databases after the databases are migrated to the cloud. In this case, you can bind the private domain names by using the private domain name feature.
You can bind a private domain name to each VPC-facing endpoint of PolarDB . Private domain names take effect in only the VPC that you specify in the current region. Private domain names have a higher priority for resolution than the domain names that take effect in the globe.
For example, the original domain name of a database is abc.test.com, and the database is migrated to the PolarDB cluster. The endpoint of the PolarDB cluster is a.polardb.aliyuncs.com. To allow the original domain name to remain unchanged, you can create a private domain name to bind abc.test.com that is a CNAME record to a.polardb.aliyuncs.com. After the domain name is bound to the endpoint, you can access the PolarDB cluster by visiting abc.test.com in the specified VPC, as shown in the following figure.
The private domain name feature of PolarDB is realized by mapping the private domain names that are managed by PrivateZone to the VPC-facing endpoints of PolarDB . PrivateZone charges a small amount of fee. For more information about pricing, see Pricing.
Bind a private domain name
- Log on PolarDB console.
- On the top of the page, select the region where the target cluster is located.
- Find the target cluster and click the cluster ID to go to the Overview page.
- In the upper-right corner of the Endpoints section on the Overview page, click the icon to switch the view.
- On the right side of the VPC-facing endpoint, click Bind Private Domain.
- In the Bind Private Domain dialog box, enter the prefix of the private domain name and the suffix of the private domain name.
The format of private domain names is
<prefix>.<suffix>. The following table describes the format of the private domain names.
No. Configuration Description 1 Prefix of a private domain name The prefix of the 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 (-). The prefix must start with a letter and end with a digit or a letter. 2 Suffix of the private domain name (zone) You can select an existing zone from the drop-down list or enter a new zone. For more information about zones, see PrivateZone.Note
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.
- If the VPC where your PolarDB cluster resides is not in the configured zone, the system automatically binds the VPC to the zone.
- You canview and manage zones in the PrivateZone console.
- Click OK.
- In the Bind Private Domain dialog box, confirm the information about the domain name again and click OK.Note
- After you bind the private domain name, the relevant records are automatically generated in the PrivateZone console.
- In the specified VPC, the private domain name is preferentially mapped to the VPC-facing endpoint of PolarDB . After the private domain name is bound, the private domain name immediately takes effect.
- If you unbind the VPC where PolarDB resides from the zone in the PrivateZone console, the private domain name becomes invalid. For more information about how to bind or unbind a VPC in the PrivateZone console, see PrivateZone.
Related API operations
|ModifyDBEndpointAddress||Modifies the endpoints of a PolarDB cluster, including the primary endpoint, default cluster endpoint, custom cluster endpoint, and private domain name.|