When a data shipping job of the new version is running to ship data to MaxCompute,
the job must read data from a source Logstore. To meet the requirement, you can assign
a custom role to the data shipping job. This topic describes how to grant permissions
to a custom role.
Prerequisites
A Resource Access Management (RAM) role named MaxcomputeShipRole is created. For more
information, see Create a RAM role.
Procedure
After you grant a RAM role the permissions to read data from a Logstore, you can assign
the RAM role to a data shipping job to read data from the Logstore.
- Log on to the RAM console.
- Create a policy that specifies the permissions to read data from a Logstore.
- In the left-side navigation pane, choose .
- On the Policies page, click Create Policy.
- On the Create Policy page, click the JSON tab, replace the existing script in the editor with the following script, and then
click Next: Edit Basic Information.
- Policy that uses exact names to match resources
You can replace the names with the actual names of your projects and Logstores.
{
"Version":"1",
"Statement":[
{
"Action":[
"log:GetCursorOrData",
"log:ListShards"
],
"Resource":[
"acs:log:*:*:project/Project name/logstore/Logstore name/*"
],
"Effect":"Allow"
}
]
}
- Policy that uses wildcard characters to match resources
In this example, the names of the projects are log-project-dev-a, log-project-dev-b,
and log-project-dev-c. The names of the Logstores are website_a_log, website_b_log,
and website_c_log. You can replace the names with the actual names of your projects
and Logstores.
{
"Version":"1",
"Statement":[
{
"Action":[
"log:GetCursorOrData",
"log:ListShards"
],
"Resource":[
"acs:log:*:*:project/log-project-dev-*/logstore/website_*_log*"
],
"Effect":"Allow"
}
]
}
- Configure the Name parameter and click OK.
For example, set the policy name to log-maxcompute-export-source-policy.
- Attach the policy to the RAM role.
- In the left-side navigation pane, choose .
- Find the RAM role to which you want to attach the policy and click Add Permissions in the Actions column.
- Click Custom Policy in the Select Policy section, select the policy that you created in 2, and then click OK. In this example, the log-maxcompute-export-source-policy policy is selected.
- Confirm the authorization result and click Complete.
After you configure the settings, you can assign the custom RAM role to a data shipping
job of the new version to read data from the source Logstore. If you create a data
shipping job of the new version, set the
Authorization of MaxCompute Write Permission parameter to
Custom Role and enter the Alibaba Cloud Resource Name (ARN) of the custom RAM role. In this example,
acs:ram::10****12:role/maxcomputeshiprole is used. For information about how to obtain
the ARN of a RAM role, see
View the information about a RAM role.
