All Products
Search
Document Center

Simple Log Service:Scenario 2: Intra-account transfer with RAM roles

Last Updated:Jun 16, 2026

RAM users can use custom roles to transfer log data within the same Alibaba Cloud account during data transformation.

Prerequisites

Background information

When a RAM user creates a data transformation job within a single account, RAM role A requires read permissions on the source Logstore and RAM role B requires write permissions on the destination Logstore. The following figure shows the authorization model.

image

Step 1: Create role A

  1. Log on to the RAM console with your Alibaba Cloud account or as a RAM administrator.
  2. Create RAM role A.

    For more information, see Create a RAM role for a trusted Alibaba Cloud service. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Select type of trusted entity

    Select Alibaba Cloud Service.

    Role Type

    Select Normal Service Role.

    Role Name

    Enter a role name, such as role-A.

    Select Trusted Service

    Select Simple Log Service.

Step 2: Grant read permissions

  1. Log on to the RAM console with your Alibaba Cloud account or as a RAM administrator.
  2. In the script editor mode, create a custom policy that allows you to read data from the source Logstore. For example, name the policy ori_read.

    For more information, see Create a custom policy. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Name

    Enter a name for the custom policy. For example, enter ori_read.

    Policy Document

    Replace the existing script in the editor with the following content.

    In this example, the source project is log-project-prod and the source Logstore is access_log. Replace these values based on your actual configuration.

    {
      "Version": "1",
      "Statement": [
        {
          "Action": [
            "log:ListShards",
            "log:GetCursorOrData",
            "log:GetConsumerGroupCheckPoint",
            "log:UpdateConsumerGroup",
            "log:ConsumerGroupHeartBeat",
            "log:ConsumerGroupUpdateCheckPoint",
            "log:ListConsumerGroup",
            "log:CreateConsumerGroup"
          ],
          "Resource": [
            "acs:log:*:*:project/log-project-prod/logstore/access_log",
            "acs:log:*:*:project/log-project-prod/logstore/access_log/*"
          ],
          "Effect": "Allow"
        }
      ]
    }
  3. Grant RAM role A read permissions on the source Logstore.

    For more information, see Manage permissions for a RAM role. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Grant Permission On

    Select Account Level. The permissions take effect within the current Alibaba Cloud account.

    Principal

    Select role-A, which you created in Step 1: Create RAM role A.

    Custom Policy

    Select ori_read.

  4. Obtain the Alibaba Cloud Resource Name (ARN) of the RAM role.

    On the details page for RAM role A, find the ARN in the Basic Information section. Example: acs:ram::1379******44:role/role-a.

Step 3: Create role B

  1. Create RAM role B.

    For more information, see Create a RAM role for a trusted Alibaba Cloud service. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Select type of trusted entity

    Select Alibaba Cloud Service.

    Role Type

    Select Normal Service Role.

    Role Name

    Enter a role name, such as role-B.

    Select Trusted Service

    Select Simple Log Service.

Step 4: Grant write permissions

  1. Create a custom policy in script editing mode to write data transformation results to the destination LogStore. For example, you can create a policy named write.

    For more information, see Create a custom policy. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Name

    Enter a name for the custom policy. For example, enter write.

    Policy Document

    Replace the existing script in the editor with the following content.

    In this example, the destination project is log-project-prod and the destination Logstore is access_log_output. Replace these values based on your actual configuration.

    {
      "Version": "1",
      "Statement": [
        {
          "Action": [
            "log:Post*",
            "log:BatchPost*"
          ],
           "Resource": "acs:log:*:*:project/log-project-prod/logstore/access_log_output",
          "Effect": "Allow"
        }
      ]
    }
  2. Grant RAM role B write permissions on the destination Logstore.

    For more information, see Manage permissions for a RAM role. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Grant Permission On

    Select Account Level. The permissions take effect within the current Alibaba Cloud account.

    Principal

    Select role-B, which you created in Step 3: Create RAM role B.

    Custom Policy

    Select write.

  3. Obtain the Alibaba Cloud Resource Name (ARN) of the RAM role.

    On the details page for RAM role B, find the ARN in the Basic Information section. Example: acs:ram::1379******44:role/role-b.

  4. Create a custom policy in script editor mode. This policy allows you to write data transformation results to the destination Logstore. For example, name the policy write.

    For more information, see Create a custom policy. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Name

    Enter a name for the custom policy. For example, enter write.

    Policy Document

    Replace the existing script in the editor with the following content.

    In this example, the destination project is log-project-prod and the destination Logstore is access_log_output. Replace these values based on your actual configuration.

    {
      "Version": "1",
      "Statement": [
        {
          "Action": [
            "log:Post*",
            "log:BatchPost*"
          ],
           "Resource": "acs:log:*:*:project/log-project-prod/logstore/access_log_output",
          "Effect": "Allow"
        }
      ]
    }
  5. Grant Role B write permissions on the target Logstore.

    For more information, see Manage the permissions of a RAM role. Configure the key parameters as described in the following table.

    Key parameter

    Description

    Grant Permission On

    Select Account Level. The permissions take effect within the current Alibaba Cloud account.

    Principal

    Select role-B, which you created in Step 3: Create role B.

    Custom Policy

    Select write.

  6. Obtain the RAM role ARN.

    On the details page for RAM role B, find the ARN in the Basic Information section. Example: acs:ram::1379******44:role/role-b.

Step 5: Create data transformation job

  1. Log on to the Log Service console as the RAM user.

  2. Go to the data transformation page.

    1. In the Projects section, click the project you want.

    2. On the Log Storage > Logstores tab, click the logstore you want.

    3. On the Query and Analysis page, click Data Transformation.

  3. In the upper-right corner of the page, select a time range for the data.

    Make sure that log data appears on the Raw Logs tab.

  4. Enter a data transformation statement in the editor.

  5. Preview the data.

    1. Click Quick.

      Simple Log Service supports quick preview and advanced preview. Preview and debug.

    2. Click Preview Data.

      Review the preview results.

      • If the transformation fails due to incorrect statements or misconfigured permissions, follow the on-screen instructions to resolve the issue.

      • If the transformation result is correct, proceed to the next step.

  6. Create a data transformation job.

    1. Click Save as Transformation Job.

    2. In the Create Data Transformation Job panel, configure the parameters and click OK.

      For information about other parameters, see Data transformation quick start. The following table describes the key parameters.

      Key parameter

      Description

      Authorization Method

      Select Custom Role.

      Role ARN

      Enter the ARN of RAM role A. Example: acs:ram::1379******44:role/role-a.

      Authorization Method for Storage Destination

      Select Custom Role.

      Role ARN

      Enter the ARN of RAM role B. Example: acs:ram::1379******44:role/role-b.

    After the data transformation job starts running, the intra-account data transfer is configured. For more information, see Manage data transformation jobs.