Use Data Transmission Service (DTS) to set up continuous data synchronization between ApsaraDB RDS for MySQL instances that belong to different Alibaba Cloud accounts. This covers cross-account scenarios where the source and destination instances are owned by separate accounts. Serverless RDS instances are supported.
Prerequisites
Before you begin, make sure that:
-
Both the source and destination instances are ApsaraDB RDS for MySQL instances.
-
The destination instance has more available storage than the source instance.
Billing
| Synchronization type | Fee |
|---|---|
| Schema synchronization and full data synchronization | Free of charge |
| Incremental data synchronization | Charged. For more information, see Billing overview. |
Supported synchronization topologies
DTS supports the following one-way synchronization topologies for this scenario:
-
One-way one-to-one synchronization
-
One-way one-to-many synchronization
-
One-way cascade synchronization
-
One-way many-to-one synchronization
For all supported topologies, see Synchronization topologies.
SQL operations that can be synchronized
| Operation type | SQL statements |
|---|---|
| DML | INSERT, UPDATE, DELETE, REPLACE |
| DDL | ALTER TABLE, ALTER VIEW, CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, CREATE VIEW, DROP INDEX, DROP TABLE, RENAME TABLE, TRUNCATE TABLE |
Limitations
Trigger incompatibility
If the source database contains a trigger that updates a table and you select the entire database as the sync object, data inconsistency may occur. To resolve this, see Configure a data synchronization or migration task for a source database that contains a trigger.
RENAME TABLE operations
RENAME TABLE operations can cause data inconsistency between the source and destination databases. For example, if you select a table as the sync object and rename it during synchronization, DTS stops syncing that table to the destination. To prevent this, select the entire database as the sync object instead of individual tables, and make sure the database is included in the sync objects both before and after the rename.
Online schema change tools
Do not use gh-ost or pt-online-schema-change to perform DDL operations during synchronization. These tools can cause the synchronization task to fail.
Tables without primary keys
Source tables must have PRIMARY KEY or UNIQUE constraints, with all fields unique. Tables without these constraints may result in duplicate records in the destination database.
Considerations
Performance impact during initial full data synchronization
DTS uses read and write resources on both instances during initial full data synchronization, which may increase instance load. Database services may become unavailable if instance performance is limited, specifications are low, or data volume is large. Heavy resource usage is more likely when:
-
The source instance has a large number of slow queries
-
Source tables have no primary keys
-
Deadlocks occur in the destination instance
Schedule synchronization during off-peak hours when CPU utilization on both instances is below 30%.
Destination tablespace size
After initial full data synchronization, the destination tablespace is larger than the source. Concurrent INSERT operations during the initial sync cause table fragmentation in the destination.
Encryption availability
Currently, the Encryption can be set only in the Chinese mainland and China (Hong Kong) regions.
Connection retry
If DTS fails to connect to the source or destination database, it retries for up to 720 minutes (12 hours) by default. If the connection is restored within the retry window, the task resumes. If not, the task fails. DTS charges apply during the retry period.
Preparations
Grant the destination account access to the source account's cloud resources using RAM authorization.
-
Log on to the Resource Access Management (RAM) console using the source instance's Alibaba Cloud account.
-
Set the destination instance's Alibaba Cloud account as a trusted account.
For step-by-step instructions, see Configure RAM authorization for cross-account data migration or synchronization.
After completing RAM authorization, create and configure the synchronization task using the destination instance's Alibaba Cloud account.
Configure a cross-account data synchronization task
Step 1: Purchase a DTS instance
Create a data synchronization task using the destination account. See Purchase a DTS instance.
Select MySQL as the database engine and one-way synchronization as the topology.
Step 2: Configure the synchronization task
-
Log on to the DTS console using the destination account.
If redirected to the Data Management (DMS) console, hover over the
icon in the lower-right corner and click the
icon to return to the DTS console. -
In the left-side navigation pane, click Data Synchronization.
-
On the Data Synchronization Tasks page, select the region where the destination instance resides.
-
Find the synchronization task and click Configure Task in the Actions column.

-
Configure the source and destination instances.
Section Parameter Description N/A Synchronization Task Name Auto-generated by DTS. Specify a descriptive name to identify the task. The name does not need to be unique. Source Instance Details Instance Type Select RDS Instance. Instance Region The region selected when you created the task. Read-only. Apsara Stack Tenant Account ID of RDS Instance The Alibaba Cloud account ID of the source instance. Before entering this value, click RDS Instances of Other Alibaba Cloud Accounts in the Source Instance Details section. 
Role Name The name of the RAM role configured in the Preparations section. RDS Instance ID The ID of the source instance. Destination Instance Details Instance Type Select RDS Instance. Instance Region The region selected when you created the task. Read-only. Instance ID The ID of the destination instance. Database Account The username of the destination instance account. If the destination instance runs MySQL 5.5 or MySQL 5.6, skip this field. Database Password The password of the account. If the destination instance runs MySQL 5.5 or MySQL 5.6, skip this field. Encryption Select Non-encrypted or SSL-encrypted based on your requirements. If you select SSL-encrypted, enable SSL encryption for the destination instance before configuring this task. See Configure SSL encryption for an ApsaraDB RDS for MySQL instance. Available only in the Chinese mainland and China (Hong Kong) region. 
-
Click Set Whitelist and Next. DTS automatically adds its server CIDR blocks to the whitelist of Alibaba Cloud database instances (such as ApsaraDB RDS for MySQL or ApsaraDB for MongoDB) and to the security group rules of Elastic Compute Service (ECS) instances hosting self-managed databases. For self-managed databases in data centers or from other cloud providers, manually add the DTS server CIDR blocks. See Add the CIDR blocks of DTS servers to the security settings of on-premises databases.
WarningAdding DTS server CIDR blocks to whitelists or security group rules introduces security risks. Before proceeding, take preventive measures such as using strong credentials, limiting exposed ports, authenticating API calls, regularly auditing whitelist and security group rules, and revoking unauthorized CIDR blocks. Alternatively, connect the database to DTS over Express Connect, VPN Gateway, or Smart Access Gateway.
Step 3: Select sync objects and policy
Select the objects to synchronize and configure the sync policy.
| Parameter | Description |
|---|---|
| Select Object to Be Synchronized | In the Available section, select one or more objects and click the |
| Rename Databases and Tables | Rename synced objects in the destination instance. See Object name mapping. |
| Source table DMS_ONLINE_Do you want to copy the temporary table to the target database during DDL | If you use Data Management (DMS) for online DDL operations on the source database, specify whether to sync the temporary tables generated by those operations. Select Yes to sync temporary table data (note: large online DDL operations may delay the task). Select No to sync only the original DDL data; destination tables may be locked temporarily. |
| Retry Time for Failed Connection | The window during which DTS retries a failed connection. Default: 720 minutes (12 hours). DTS resumes the task if reconnected within this window. Adjust based on your needs and release the DTS instance promptly after both instances are released to avoid unnecessary charges. |
Click Next.
Step 4: Configure initial synchronization settings
Select both Initial Schema Synchronization and Initial Full Data Synchronization. These settings sync the schema and data from the source to the destination, which is the basis for ongoing incremental synchronization.
Step 5: Run the precheck
Click Precheck.
The task cannot start until it passes the precheck. If any items fail, click the
icon next to each failed item to view the cause. Fix the issues and run the precheck again. You can also choose to ignore specific failed items and rerun the precheck.
After the Precheck dialog shows The precheck is passed., close the dialog. The synchronization task starts automatically.
Step 6: Monitor the task
Wait for the initial synchronization to complete. The task enters the Synchronizing state when ongoing incremental synchronization begins.
Monitor the task status on the Data Synchronization page.
What's next
-
To rename objects in the destination database, see Object name mapping.
-
To monitor synchronization status and latency, see the Data Synchronization page in the DTS console.
-
To resolve issues with source databases that contain triggers, see Configure a data synchronization or migration task for a source database that contains a trigger.