All Products
Search
Document Center

DataWorks:Solution 4: Network connectivity to a data source deployed on ECS

Last Updated:Oct 08, 2026

This topic uses MySQL deployed on Alibaba Cloud ECS to explain how to connect a data source to DataWorks.

Use cases

This solution is recommended if your data source meets the following condition:

  • The data source is deployed on an Alibaba Cloud ECS instance.

Solution

ECS and DataWorks under the same account and in the same region

If the ECS instance hosting the data source and DataWorks are under the same account and in the same region, we recommend that you use a VPC (private network) connection. Deploy the resource group of your DataWorks workspace and the ECS instance in the same VPC to enable network connectivity.

ECS and DataWorks under different accounts, or under the same account in different regions

If the ECS instance hosting the data source and DataWorks are under different accounts or under the same account but in different regions, we recommend that you use a VPC (private network) connection. Use a network connectivity tool (Cloud Enterprise Network or VPC Peering Connection) to connect the VPC of your DataWorks workspace resource group with the VPC where the ECS instance resides.

Network connectivity diagram

ECS and DataWorks under the same account and in the same region

For ECS and DataWorks under the same account and in the same region, configure connectivity in four steps. First, on the ECS instance details page, for example for MySQL_on_ECS, obtain its VPC, such as vpc-ufi***gvg, and vSwitch, such as vsw-ufi***37. Second, on the DataWorks console Resource Group List page, find the target Serverless resource group, such as Serverless_Resource_Group, and click Network Settings. Confirm that its VPC matches the ECS instance VPC. Third, under Data Integration & DataService on the resource group network details page, obtain the bound vSwitch CIDR block, such as 172.16.0.0/24. Fourth, in the inbound rules of the ECS security group, click Add Security Group Rule. Add a rule with the authorization policy Allow, protocol Custom TCP, port 3306 (MySQL), and the vSwitch CIDR block from step 3, such as 172.16.0.0/24, so the DataWorks resource group can access MySQL on ECS.

ECS and DataWorks under the same account but in different regions

Slide 6

ECS and DataWorks under different accounts

Slide 7

Prerequisites

Billing

Billing varies depending on the network connectivity tool you choose. For details, see Cloud Enterprise Network billing or VPC peering connection billing.

Note

For a VPC peering connection between ECS and a DataWorks resource group in different accounts but the same region, no fee is charged.

Configure network connectivity

Note

The following general procedure explains the core network configuration. For more detail, see the Configuration exampleconfiguration example below.

Step 1: Collect basic information

ECS and DataWorks under the same account and in the same region

Data source side
  • ECS VPC and vSwitch information:

    1. Go to the ECS console and switch to the target ECS region.

    2. In the left navigation pane, click Instances & Images > Instance. Find the ECS instance with MySQL and click its name to open the Instance Details page.

    3. In the Configuration Information section, obtain VPC (called VPC 1 in this example) and vSwitch.

DataWorks side
  • VPC and vSwitch information bound to the resource group:

    1. Go to the DataWorks Resource Group List, find the target resource group and click Operation in the Network Settings on ECS.

    2. column. In the applicable module, view the bound VPC and vSwitch.

      . For example, to synchronize data from MySQL on ECS to DataWorks, under Data Scheduling & Data Integration check the corresponding VPC (called VPC 2 in this example) and vSwitch.

ECS and DataWorks under the same account in different regions

Data source side
  • Region information: This example uses an ECS instance in China (Hangzhou).

  • ECS VPC and vSwitch information:

    1. Go to the ECS console and switch to the target ECS region.

    2. In the left navigation pane, click Instances & Images > Instance. Find the ECS instance with MySQL and click its name to open the Instance Details page.

    3. In the Configuration Information section, obtain VPC and vSwitch.

DataWorks side
  • Region information: This example uses an ECS instance in China (Shanghai) and a DataWorks workspace and resource group in that region.

  • VPC and vSwitch information bound to the resource group:

    1. Go to the DataWorks Resource Group List, find the target resource group and click Operation in the Network Settings on ECS.

    2. column. In the applicable module, view the bound VPC and vSwitch.

      For example, to connect RDS MySQL to DataWorks for synchronization, under Data Scheduling & Data Integration check the corresponding VPC and vSwitch.

ECS and DataWorks under different accounts

Data source side
  • Account information:This example uses Account A and on ECS.

  • Region information: This example uses an ECS instance in China (Hangzhou).

  • ECS VPC and vSwitch information:

    1. Go to the ECS console and switch to the target ECS region.

    2. In the left navigation pane, click Instances & Images > Instance. Find the ECS instance with MySQL and click its name to open the Instance Details page.

    3. In the Configuration Information section, obtain VPC and vSwitch.

DataWorks side
  • Account information:This example uses Account B and on ECS.

  • Region information: This example uses an ECS instance in China (Shanghai) and a DataWorks workspace and resource group in that region.

  • VPC and vSwitch CIDR information bound to the resource group:

    1. Go to the DataWorks Resource Group List, find the target resource group and click Operation in the Network Settings on ECS.

    2. column. In the applicable module, view the bound VPC and vSwitch.

      For example, to connect RDS MySQL to DataWorks for synchronization, under Data Scheduling & Data Integration check the corresponding VPC and vSwitch.

      This is on the resource group details page under Network Settings > VPC Binding. In addition to VPC and vSwitch, the table includes vSwitch CIDR Block and Security Group fields.

Step 2: Connect the networks

ECS and DataWorks under the same account and in the same region

  • If VPC 1 and VPC 2 are the same, ECS and the DataWorks resource group are in one VPC, so the network is connected by default.

  • If VPC 1 and VPC 2If they differ, click Add Binding on the DataWorks resource group network settings page and bind VPC 1 to the resource group to put both in the same VPC.

ECS and DataWorks under the same account in different regions

Note

If you encounter issues during network configuration, submit a ticket to contact Alibaba Cloud technical support.

ECS and DataWorks under different accounts

Note

If you encounter issues during network configuration, submit a ticket to contact Alibaba Cloud technical support.

Step 3: Add a route to the DataWorks resource group

For the same-account cross-region and different-account scenarios, also add a route in the DataWorks resource group pointing to the ECS vSwitch CIDR block.

  1. Go to the DataWorks Resource Group List, find the target resource group and click Operation in the Network Settings on ECS.

  2. Find the bound VPC under the applicable module and click Operation in the Custom Route on ECS.

  3. Click Add Route and set Connection Method to CIDR Block, then set Destination CIDR Block to the ECS vSwitch CIDR block.

Step 4 (optional): Enable remote database access

Some databases require remote access to be enabled in their configuration files so specified users can connect externally by IP address and port. See the database’s official documentation for its configuration.

Example:4. Enable remote MySQL access on ECS.

Step 5: Configure the ECS security group

ECS security groups provide firewall controls. Open the database port to the VPC of the DataWorks resource group so it can access services on ECS.

  1. Go to the ECS console and switch to the target ECS region.

  2. In the left navigation pane, click Instances & Images > Instance. Find the ECS instance with MySQL and click its name to open the Instance Details page.

  3. Switch to the Security Group tab, click the security group name, and open Security Group Details page.

  4. In the Access Rules section. Click Add Rule and configure these key parameters; retain defaults for others.

    • Source: Enter the vSwitch CIDR block bound to the DataWorks resource group.

    • Port: Select the database port on ECS. For MySQL, open 3306 ports.

Verify connectivity

  1. Log on to the DataWorks console. In the target region, click Data Integration > Data Integration in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Integration.

  2. In the left navigation pane, click Data Sources. In the data source list, add a data source and configure its connection settings.

  3. At the bottom, select a resource group whose network is connected to the data source and click Test Connectivity. In the data source Connection Configuration section, select a resource group and click Test Connectivity. Confirm the status is Connected on ECS.

    Note

    If the test result is Failed, use Network Connectivity Diagnostic Tool to troubleshoot. If the resource group still cannot connect to the data source, submit a ticket.

Configuration example

Suppose MySQL runs on an ECS instance in Account A, China (Hangzhou), and DataWorks is in Account B, China (Shanghai). Configure connectivity as follows.

1. Basic information

Parameter

Data source (ECS instance with MySQL)

DataWorks resource group

Account

Account A

Account B

Region

China (Hangzhou)

China (Shanghai)

VPC

  • ECS primary private IP:192.168.6.172

  • VPC name:Account_A_hangzhou_VPC

  • VPC CIDR block:192.168.0.0/16

  • vSwitch CIDR block:192.168.6.0/24

The ECS instance has 2 vCPUs and 2 GiB of memory, uses image rockylinux_9_5_x64_20G_alibase_20250319.vhd, and is associated with vSwitch ID vsw-bp***ncs.

  • VPC name:Account_B_shanghai_VPC

  • VPC CIDR block:172.16.0.0/12

  • vSwitch CIDR block:172.16.66.0/24

On the resource group details Network Settings page, select VPC Binding. In the Data Scheduling & Data Integration section, click Add Binding to bind the VPC, vSwitch, and security group. The displayed VPC ID should match Account_B_shanghai_VPC.

2. Connect the networks

This example uses VPC peering connection to connect ECS and DataWorks.

Note

If you encounter issues during network configuration, submit a ticket to contact Alibaba Cloud technical support.

  1. Log on to Account A and open the VPC Peering Connection console. Switch to China (Hangzhou) at the top, then click Create Peering Connection and configure the parameters.

    Key parameters for this example are listed below; retain defaults for others.

    Parameter

    Configuration and example

    Peering connection name

    Custom name. This example uses Account_A to Account_B on ECS.

    Requester VPC

    Account AThe VPC containing ECS in Account_A_hangzhou_VPC on ECS.

    Recipient account type

    Select Cross-account on ECS.

    Recipient account UID

    Enter the primary account UID of Account B.

    Recipient region type

    Select Cross-region on ECS.

    Recipient region

    Account BSelect the region containing the DataWorks workspace and resource group in China (Shanghai) on ECS.

    Recipient VPC

    Enter the VPC ID of the DataWorks resource group in Account B (Account_B_shanghai_VPC).

  2. Click DetermineFinish configuring peering and open its details page. Its status is Status initially Pending Peer Acceptance on ECS.

  3. Log on to Account B and open the VPC Peering Connection console. Switch to China (Shanghai) and find the same peering record. Click Operation in the Receiver on ECS. to accept it. The status Status changes to Active on ECS.

  4. Click Recipient VPC Instance > Configure Route Entry. In the Configure Route Entry dialog box, specify a route entry Name and set Destination CIDR Block to the requester ECS VPC CIDR block, which is 192.168.0.0/16.

  5. Log on to Account A and open the VPC Peering Connection console. Switch to China (Hangzhou) and find the created peering connection.

  6. Click Requester VPC Instance > Configure Route Entry. In the Configure Route Entry dialog box, specify a route entry Name and set Destination CIDR Block to the recipient DataWorks resource group VPC CIDR block, which is 172.16.0.0/12.

3. Add a route to the DataWorks resource group

  1. Log on to Account B and go to DataWorks Resource Group List, find the target resource group and click Operation in the Network Settings on ECS.

  2. Find the bound VPC under the applicable module and click Operation in the Custom Route on ECS.

  3. Click Add Route and set Connection Method to CIDR Block, then set Destination CIDR Block to the ECS vSwitch CIDR block (192.168.6.0/24).

4. Enable remote MySQL access

Connect to the ECS instance running MySQL and enable remote access.

Note

These commands apply only to MySQL 8.0 on Linux. Adapt them for other operating systems or MySQL versions.

  1. Find the my.cnf configuration file (usually at /etc/my.cnf).

    find / -name my.cnf
  2. Use the vim /etc/my.cnf command to edit the file (replace the my.cnf path with the path found above).

  3. At the end of the file, press i and add this setting under [mysqld]:

    bind-address=0.0.0.0
  4. Press Esc, then type :wq! to save and quit.

  5. Run systemctl restart mysqld to restart the service.

  6. Create a user for DataWorks to connect remotely to MySQL.

    1. Edit the file with mysql -u root -p to log on as an administrator.

    2. Create the user and set a password.

      -- "dataworks_user" is a customizable username.
      -- "%" allows access from any IP address. Specify an IP address for tighter control.
      -- "StrongPassword123!" is a customizable password.
      CREATE USER 'dataworks_user'@'%' IDENTIFIED BY 'StrongPassword123!';
    3. Grant the user database permissions.

      -- Run either command.
      
      -- Grant all privileges to the user (use caution).
      GRANT ALL PRIVILEGES ON *.* TO 'dataworks_user'@'%' WITH GRANT OPTION;
      
      -- Grant privileges on a specified database, such as mydatabase.
      GRANT ALL PRIVILEGES ON mydatabase.* TO 'dataworks_user'@'%' WITH GRANT OPTION;
    4. Run FLUSH PRIVILEGES;Refresh permissions with exit).

    5. and exit MySQL (

      mysql -u dataworks_user -h <ECS_PRIMARY_PRIVATE_IP> -p

5. Configure the ECS security group

  1. Log on to Account A and go to ECS console and switch to China (Hangzhou) on ECS.

  2. In the left navigation pane, click Instances & Images > Instance. Find the ECS instance with MySQL and click its name to open the Instance Details page.

  3. Switch to the Security Group tab, click the security group name, and open Security Group Details page.

  4. In the Access Rules section. Click Add Rule and configure these key parameters; retain defaults for others.

    • Source: Enter the DataWorks resource group vSwitch CIDR block (172.16.66.0/24).

    • Port: Select the database port on ECS (3306).

6. Test connectivity

  1. Log on to Account B on ECS.

  2. Log on to the DataWorks console. In the target region, click Data Integration > Data Integration in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Integration.

  3. In the left navigation pane, click Data Sources and open the Data Sources page. Then click Add Connection on ECS.

  4. Select MySQL as the data source and configure it.

    • Configuration ModeSelect User-created Data Store with Public IP Addresses on ECS.

    • Host Address ID and enter the ECS private IP (192.168.6.172).

    • Port NumberSet to 3306 on ECS.

    • Database NameSet to an existing database name.

    • Username and PasswordSet to 4. Enable remote MySQL accessUse the dataworks_user user and password created above.

  5. In the Connection ConfigurationClick Test Connectivity for the workspace-bound resource group and check whether the result is Connectable on ECS.

    In the data source Connection Configuration section, select a resource group and click Test Connectivity. Confirm the status is Connected on ECS.

    Note

    If the test result shows Failed, use the Network Connectivity Diagnostic Tool to troubleshoot. If connectivity still fails, submit a ticket for assistance.

Related documents

For common network connectivity questions, see Resource group operations and network connectivity on ECS.