All Products
Search
Document Center

DataWorks:Connect to a self-managed data source on an ECS instance

Last Updated:Mar 26, 2026

This guide explains how to connect a data source hosted on an Alibaba Cloud Elastic Compute Service (ECS) instance to DataWorks. It uses a MySQL database as the example, but the same approach applies to any DataWorks-supported data source running on ECS.

Choose a connectivity approach

Your configuration path depends on how your ECS instance and DataWorks workspace relate to each other. Use the following table to identify your scenario and jump to the relevant steps.

ScenarioAccount relationshipRegion relationshipRecommended approach
Same account and regionSameSameDeploy the DataWorks resource group and ECS instance in the same Virtual Private Cloud (VPC), or associate the ECS VPC with the resource group
Same account, different regionsSameDifferentConnect the two VPCs using Cloud Enterprise Network (CEN) or a VPC Peering Connection
Different accountsDifferentSame or differentConnect the two VPCs using CEN or a VPC Peering Connection

When to use CEN vs. VPC Peering Connection:

  • Cloud Enterprise Network (CEN): Use for complex enterprise networks that require connectivity across multiple VPCs.

  • VPC Peering Connection: Use for a direct, point-to-point connection between exactly two VPCs.

How it works

Same account and region

Deploy the DataWorks resource group and ECS instance in the same VPC to establish network communication over a private connection.

Same account, different regions

Use CEN or a VPC Peering Connection to link the VPC of the DataWorks resource group with the VPC of the ECS instance across regions.

Different accounts

Use CEN or a VPC Peering Connection to link the VPC of the DataWorks resource group with the VPC of the ECS instance across accounts.

Network architecture diagrams

Same account and region

幻灯片5

Same account, different regions

幻灯片6

Different accounts

幻灯片7

Prerequisites

Before you begin, make sure you have:

Billing

Charges vary depending on the networking product you choose. For details, see the billing documentation for Cloud Enterprise Network (CEN) or VPC Peering Connection.

No fees are charged when you use a VPC Peering Connection to connect ECS instances and DataWorks resource groups that are in different accounts but the same region.

Configure network connectivity

The following steps outline the general procedure. For a detailed walkthrough of a cross-account, cross-region scenario, see the Configuration example in this topic.

Step 1: Get the required information

Collect the VPC and vSwitch details for both the ECS instance and the DataWorks resource group. The information you need depends on your scenario.

Same account and region

Data source (ECS instance)

  1. Go to the Elastic Compute Service console. In the top navigation bar, select the region where your ECS instance is located.

  2. In the left-side navigation pane, choose Instances. Find the ECS instance that hosts your database and click the instance name to open the Instance Details page.

  3. In the Configuration Information section, note the VPC (referred to as VPC 1 in this guide) and vSwitch values.

    image

DataWorks resource group

  1. Go to the DataWorks resource group list. Find the target resource group and click Network Settings in the Actions column.

  2. Under the relevant feature module, note the VPC (referred to as VPC 2 in this guide) and vSwitch values. For example, for data synchronization, check the VPC and vSwitch under Data Scheduling & Data Integration.

    image

Same account, different regions

Data source (ECS instance)

  • Region: Note the region where the ECS instance is located. This example uses China (Hangzhou).

  • VPC and vSwitch:

    1. Go to the Elastic Compute Service console. In the top navigation bar, select the region where your ECS instance is located.

    2. In the left-side navigation pane, choose Instances. Find the ECS instance that hosts your database and click the instance name to open the Instance Details page.

    3. In the Configuration Information section, note the VPC and vSwitch values. image

DataWorks resource group

  • Region: Note the region where the DataWorks workspace and resource group are located. This example uses China (Shanghai).

  • VPC and vSwitch:

    1. Go to the DataWorks resource group list. Find the target resource group and click Network Settings in the Actions column.

    2. Under the relevant feature module, note the VPC and vSwitch values. For example, for data synchronization, check the VPC and vSwitch under Data Scheduling & Data Integration. image

Different accounts

Data source (ECS instance)

  • Account: This example uses Account A.

  • Region: This example uses the China (Hangzhou) region.

  • VPC and vSwitch:

    1. Go to the Elastic Compute Service console. In the top navigation bar, select the region where your ECS instance is located.

    2. In the left-side navigation pane, choose Instances. Find the ECS instance that hosts your database and click the instance name to open the Instance Details page.

    3. In the Configuration Information section, note the VPC and vSwitch values. image

DataWorks resource group

  • Account: This example uses Account B.

  • Region: This example uses the China (Shanghai) region.

  • VPC and vSwitch:

    1. Go to the DataWorks resource group list. Find the target resource group and click Network Settings in the Actions column.

    2. Under the relevant feature module, note the VPC and vSwitch values. For example, for data synchronization, check the VPC and vSwitch under Data Scheduling & Data Integration. image

Step 2: Establish a network connection

Same account and region

  • If VPC 1 and VPC 2 are the same, the ECS instance and the DataWorks resource group are already in the same VPC. Network connectivity is established by default — skip to Step 5: Configure the security group.

  • If VPC 1 and VPC 2 are different, go to the network settings page of the DataWorks resource group and click Add VPC Association to associate VPC 1 with the resource group. This places both the resource group and the ECS instance in the same VPC. After the association is saved, the network settings page shows VPC 1 listed under the resource group's associated VPCs.

Same account, different regions

Connect the two VPCs using one of the following options:

If you encounter issues while establishing the connection, submit a ticket to contact technical support for the relevant cloud product.

Different accounts

Connect the two VPCs using one of the following options:

If you encounter issues while establishing the connection, submit a ticket to contact technical support for the relevant cloud product.

Step 3: Add a route to the resource group

This step is required only for cross-region or cross-account scenarios. Skip this step if the ECS instance and the DataWorks workspace are in the same account and region.

Add a route in the DataWorks resource group that points to the CIDR block of the ECS instance's vSwitch.

  1. Go to the DataWorks resource group list. Find the target resource group and click Network Settings in the Actions column.

  2. Under the relevant feature module, find the associated VPC and click Custom Route in the Actions column.

  3. Click Add Route. Set the connection method to CIDR Block and set Destination CIDR Block to the CIDR block of the ECS instance's vSwitch.

After saving, the route entry appears in the custom route list for the associated VPC.

Step 4: (Optional) Enable remote database access

Some databases require you to configure the database to accept connections from external IP addresses. The exact steps vary by database — refer to your database's official documentation.

For MySQL-specific instructions, see step 4 in the configuration example.

Step 5: Configure the security group

ECS security groups act as firewalls. Add an inbound rule to the security group of the ECS instance to open the database port to the CIDR block of the DataWorks resource group's vSwitch.

  1. Go to the Elastic Compute Service console. In the top navigation bar, select the region where your ECS instance is located.

  2. In the left-side navigation pane, choose Instances. Find the ECS instance that hosts your database and click the instance name to open the Instance Details page.

  3. Click the Security Groups tab, then click the name of the security group to open the Security Group Details page.

  4. In the Rules section, click Add Rule and configure the following parameters. Keep the default values for all other parameters.

    ParameterValue
    SourceThe CIDR block of the DataWorks resource group's vSwitch
    Port RangeThe port used by your database (see the table below)

Common database ports:

DatabaseDefault port
MySQL3306
PostgreSQL5432
SQL Server1433
Oracle1521
MongoDB27017
Redis6379

Verify network connectivity

After completing the configuration steps, test the connection from DataWorks.

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

  2. In the left-side navigation pane, click Data source. On the Data Sources page, click Add Data Source. Select the appropriate data source type and configure the connection parameters.

  3. In the resource group list at the bottom of the page, select the resource group connected to the data source and click Test Network Connectivitysubmit a ticket.

    image

If the test returns Connection failed, use the Network Connectivity Diagnosis Tool to identify the issue. If the problem persists, submit a ticket.

Configuration example

This example walks through a cross-account, cross-region scenario: a MySQL database runs on an ECS instance in the China (Hangzhou) region under Account A, and the DataWorks workspace is in the China (Shanghai) region under Account B.

1. Basic information

Parameter

Data source

DataWorks resource group

Account

Account A

Account B

Region

China (Hangzhou)

China (Shanghai)

VPC

  • Primary private IP of the ECS instance: 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

ECS basic information page:

image

  • VPC name: Account_B_shanghai_VPC

  • VPC CIDR block: 172.16.0.0/12

  • vSwitch CIDR block: 172.16.66.0/24

Resource group network settings page:

image

2. Establish network connection

This example uses a VPC Peering Connection to connect the ECS instance to DataWorks.

If you encounter issues while establishing the connection, submit a ticket to contact technical support for the relevant cloud product.
  1. Log on to Account A. Go to the VPC Peering Connection console. In the top navigation bar, select the China (Hangzhou) region, then click Create Peering Connection. Configure the following key parameters. Keep the default values for all other parameters.

    ParameterConfiguration
    Peering connection nameEnter a custom name. This example uses Account_A to Account_B.
    Requester VPC instanceThe VPC in Account A that contains the ECS instance. This example uses Account_A_hangzhou_VPC.
    Accepter account typeSelect Cross-account.
    Accepter Alibaba Cloud account UIDEnter the UID of the Alibaba Cloud account for Account B.
    Accepter region typeSelect Cross-region.
    Accepter regionThe region of the DataWorks workspace and resource group in Account B. Select China (Shanghai).
    Accepter VPC instanceManually enter the ID of the VPC associated with the DataWorks resource group in Account B (Account_B_shanghai_VPC).
  2. Click OK. The peering connection is created with a Status of Pending Acceptance.

  3. Log on to Account B. Go to the VPC Peering Connection console. In the top navigation bar, select the China (Shanghai) region. Find the incoming peering connection request and click Accept in the Actions column. After acceptance, the Status changes to Activated.

  4. Click Configure Route under the Accepter VPC Instance. In the dialog box, enter a custom name for the route entry. Set Destination CIDR Block to the VPC CIDR block of the requester (the ECS instance): 192.168.0.0/16.

    image

  5. Log on to Account A. Go to the VPC Peering Connection console. In the top navigation bar, select the China (Hangzhou) region and find the peering connection you created.

  6. Click Configure Route under the Requester VPC Instance. In the dialog box, enter a custom name for the route entry. Set Destination CIDR Block to the VPC CIDR block of the accepter (the DataWorks resource group): 172.16.0.0/12.

    image

3. Add a route to the resource group

  1. Log on to Account B. Go to the DataWorks resource group list. Find the target resource group and click Network Settings in the Actions column.

  2. Under the relevant feature module, find the associated VPC and click Custom Route in the Actions column.

  3. Click Add Route. For Connection Method, select CIDR Block. For Destination CIDR Block, enter the CIDR block of the vSwitch where the ECS instance is located: 192.168.6.0/24.

4. Enable remote database access

Connect to the ECS instance that hosts the MySQL database and enable remote access.

The following commands apply to MySQL 8.0 on Linux. Adapt the steps for other operating systems or MySQL versions.
  1. Find the my.cnf configuration file. With a default installation, it is typically at /etc/my.cnf.

    find / -name my.cnf
  2. Open the file for editing. Replace the path if your my.cnf is in a different location.

    vim /etc/my.cnf
  3. At the end of the file, press i to enter insert mode and add the following line under [mysqld]:

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

  5. Restart the MySQL service.

    systemctl restart mysqld
  6. Create a database user for DataWorks to use when connecting remotely.

    1. Log on to the database as the administrator.

      mysql -u root -p
    2. Create a user and set a password.

      -- "dataworks_user" is the username. Customize as needed. -- "%" allows connections from any IP address. Replace with a specific IP for finer-grained control. -- "StrongPassword123!" is the password. Customize as needed. CREATE USER 'dataworks_user'@'%' IDENTIFIED BY 'StrongPassword123!';
    3. Grant the user access to the database.

      -- Run one of the following commands. -- Grants all privileges on all databases. Use with caution. GRANT ALL PRIVILEGES ON *.* TO 'dataworks_user'@'%' WITH GRANT OPTION; -- Grants privileges on a specific database (for example, mydatabase). GRANT ALL PRIVILEGES ON mydatabase.* TO 'dataworks_user'@'%' WITH GRANT OPTION;
    4. Flush the privileges, then exit.

      FLUSH PRIVILEGES;
      exit
    5. Verify the remote connection.

      mysql -u dataworks_user -h <Private_IP_address_of_the_ECS_instance> -p

5. Configure the security group

  1. Log on to Account A. Go to the Elastic Compute Service console. In the top navigation bar, select the China (Hangzhou) region.

  2. In the left-side navigation pane, choose Instances. Find the ECS instance that hosts the MySQL database and click the instance name to open the Instance Details page.

  3. Click the Security Groups tab, then click the name of the security group to open the Security Group Details page.

  4. In the Rules section, click Add Rule and configure the following parameters. Keep the default values for all other parameters.

    ParameterValue
    SourceThe CIDR block of the DataWorks resource group's vSwitch: 172.16.66.0/24
    Port Range3306

6. Test the connection

  1. Log on to Account B.

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

  3. In the left-side navigation pane, click Data source to open the Data Sources page, then click Add Data Source.

  4. Select the MySQL data source type and configure the following parameters.

    ParameterValue
    Configuration ModeConnection String Mode
    Host IP AddressThe private IP address of the ECS instance: 192.168.6.172
    Port Number3306
    Database NameThe name of an existing database
    Usernamedataworks_user (created in step 4)
    PasswordThe password set in step 4
  5. In the Connection Configuration section, click Test Network Connectivity for the associated resource group. Verify that the result is passed.

    If the connectivity test fails, use the Network Connectivity Diagnosis Tool to troubleshoot. If the problem persists, submit a ticket for assistance.

    image

What's next

For frequently asked questions about network connectivity, see Resource group operations and network connectivity.