All Products
Search
Document Center

Alibaba Cloud DNS:Migrate databases for cloud adoption

Last Updated:Jun 04, 2026

Database migration is a major cloud adoption challenge. When database domain names or IPs are hardcoded in application clients, migrating to ApsaraDB RDS requires modifying client code—a complex, high-risk process.

Solution

Use Private Zone to create a database domain name matching your original on-premises domain name, then add a CNAME record pointing it to the internal endpoint of your ApsaraDB RDS instance. This eliminates client code changes during migration, reducing refactoring effort and risk.

image

Before you begin

  1. Activate Private Zone.

  2. Prepare the following resources.

    Resource

    Quantity

    Sample value

    On-premises database domain name

    1

    db.example.com

    ECS instance

    1 or more

    1.1.XX.XX, 2.2.XX.XX

    ApsaraDB RDS instance

    1

    rm-2ze44q293vs56l9po*****.mysql.rds.aliyuncs.com

Procedure

image

1. Get the RDS internal endpoint

  1. Log on to the ApsaraDB RDS Console. In the left-side navigation pane, click Instances. On the Instances page, click your target instance ID in the Instance ID/Name column.

  2. In the left-side navigation pane, click Database Connection and copy the domain name next to Internal Endpoint.image.png

2. Add a Private Zone and CNAME record

  1. Navigate to the Alibaba Cloud DNS - Private Zone console.

  2. On the Private Zone page, click the User Defined Zones tab.

  3. Click Add Zone. In the Add Private Zone Domain (Zone) dialog box, enter your domain name, such as db.example.com. For the zone type, we recommend Private Zone Acceleration. Click OK.

  4. On the User Defined Zones page, find the domain db.example.com and click Settings in the Actions column.

  5. On the Settings page, click Add DNS Record. Set Record Type to CNAME, Hostname to @, and DNS Request Source to Default. For Record Value, enter the internal endpoint of your ApsaraDB RDS instance, such as rm-2ze44q293vs56l9po*****.mysql.rds.aliyuncs.com. Use your actual endpoint. Click OK.

  6. Return to the User Defined Zones page. Find the domain db.example.com and click Effective Scope in the Actions column. On the Zone Settings page, set the Effective Scope by associating the zone with your database VPC.

3. Verify the configuration

  1. Log on to an ECS instance in the associated VPC and run the following command to test DNS resolution. A successful response is shown below. If resolution fails, verify your DNS record configuration.

    dig db.example.com

    Database migration - DNS resolution test

  2. Log on to an ECS instance in the same VPC and run the following command to test the RDS connection. A successful connection produces the following output.

    mysql -utest_dns -ptest_dns -hdb.example.com -P3306 -Dtest_dns

    Database migration - RDS connection test

Troubleshooting

  1. ERROR 2003 (HY000): Can’t connect to MySQL server on ‘db.example.com’ (110): Connection failure. Add the ECS instance IP address to the database whitelist.Database migration - connection error