All Products
Search
Document Center

DataWorks:Cross-account authorization (MaxCompute or Hologres)

Last Updated:Mar 26, 2026

Access MaxCompute or Hologres resources owned by another Alibaba Cloud account by adding them as data sources in DataWorks. Cross-account access uses a Resource Access Management (RAM) role: Account B (the resource owner) grants the role access to its project or database, and Account A (the DataWorks operator) uses that role to connect.

Workflow overview:

StepWho actsWhat happens
Step 1Account BCreates a RAM role, establishes a trust relationship with Account A, and grants the role access to the target resource (MaxCompute or Hologres)
Step 2Account AAdds the cross-account data source in DataWorks using the RAM role from Account B

Limitations

  • Cross-account data sources cannot be used for data development or scheduling. To perform data development, create a data source within your own account. For MaxCompute, see Add a MaxCompute compute engine. For Hologres, see Add a Hologres compute engine.

  • Cross-account access requires a RAM role. No other access method is supported.

Prerequisites

Before you begin, make sure that you have:

  • Two Alibaba Cloud accounts: Account A (the DataWorks operator who adds the data source) and Account B (the resource owner who provides access)

  • The target resource created in Account B:

Step 1: Create and authorize a RAM role in Account B

Account B completes this step entirely. Log in to the RAM console using Account B.

Create a RAM role and configure the trust policy

  1. Create a RAM role with Account A as the trusted Alibaba Cloud account. For detailed steps, see Create a RAM role for a trusted Alibaba Cloud account. Key parameters: To get Account A's UID: log in to the console using Account A and move the pointer over the profile picture in the top menu bar.

    Note

    Account A assumes this RAM role to access resources in Account B. If the RAM role also needs to access DataWorks in Account A, redefine the role policy. See Define a policy for a RAM role.

    ParameterValue
    Principal typeAlibaba Cloud Account
    Principal nameSelect Other Alibaba Cloud Account, then enter the UID of Account A
    Role nametestRole (or any name you choose)

    PixPin_2025-12-03_19-14-11

  2. Update the trust policy to allow the DataWorks service of Account A to assume this role. On the role details page, go to the Policy Document tab and click Edit Policy Document. Replace the content with the following, substituting <Account-A-UID> with Account A's actual UID:

    {
      "Statement": [
        {
          "Action": "sts:AssumeRole",
          "Effect": "Allow",
          "Principal": {
            "Service": [
              "<Account-A-UID>@engine.dataworks.aliyuncs.com"
            ]
          }
        }
      ],
      "Version": "1"
    }

    For more information, see Modify the trust policy of a RAM role.

Grant the RAM role access to the target resource

Select the tab that matches the resource type you want to share.

For MaxCompute

  1. In Account B, connect to the target MaxCompute project. Use the SQL analysis feature in the MaxCompute console, or another supported connection tool. For a full list of options, see Select a connection tool.

  2. Add the RAM role as a user in the MaxCompute project and grant it the necessary permissions. In the SQL statements below, <Account-B-name> is the name of Account B, and <role-name> is the RAM role name (for example, testRole):

    -- Add the RAM role to the MaxCompute project
    add user `RAM$<Account-B-name>:role/<role-name>`;
    -- View all users in the project
    list users;
    -- Check the permissions granted to the role
    show grants for `RAM$<Account-B-name>:role/<role-name>`;

    After adding the role, grant it the permissions that match how Account A will use the data source. For example, grant SELECT permission if Account A needs to query tables. For authorization steps, see Authorization operations.

For Hologres

  1. In Account B's RAM console, create a custom policy with the following content and attach it to the RAM role. This policy grants the permissions required to access the Hologres instance:

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "hologram:GetInstance",
            "hologram:DescribeInstance",
            "hologram:ListDatabases",
            "hologram:ListWarehouses",
            "hologram:ListInstances"
          ],
          "Resource": "*"
        }
      ]
    }

    To create the policy, see Create a custom policy. To attach it to the RAM role, see Manage permissions for a RAM role.

  2. Add the RAM role as a database user in Hologres. Log in to the Hologres management console using Account B and open the HoloWeb interface for the target instance. For more information, see Quick start for RAM user authorization.

    • In Security Center, go to User Management and add the RAM role as a database user. PixPin_2025-11-24_16-51-58

    • If the role is a regular user, go to Database Authorization in Security Center to grant database-level permissions. PixPin_2025-11-24_16-42-08

Step 2: Add the cross-account data source in Account A

Account A completes this step. Log in to the DataWorks console using Account A.

  1. Go to the Data Sources page. In the top navigation bar, select the target region. In the left-side navigation pane, choose More > Management Center. Select the target workspace and click Go to Management Center. In the left-side navigation pane of the SettingCenter page, click Data Sources.

  2. Click Add Data Source and select MaxCompute or Hologres as the data source type.

  3. Configure the following key parameters:

    ParameterValue
    Alibaba Cloud AccountAnother Alibaba Cloud Account
    RegionThe region where the MaxCompute project or Hologres instance resides
    UID Of Alibaba Cloud AccountThe UID of Account B
    MaxCompute Project Name / Hologres InstanceThe name or ID of the target resource in Account B
    RAM RoleThe name of the RAM role created in Account B (for example, testRole)
  4. Select a resource group and test the connectivity. For network configuration details, see Connect to a data source that belongs to a different Alibaba Cloud account.

    image.png

  5. Click Complete Creation.

What's next

After creating the cross-account data source, you can:

  • Synchronize data from this source using Data Integration. See Data Integration.

  • View data source details in DataWorks Data Map. See Data Map.