If a RAM user encounters an authorization issue when calling the Machine Translation API, the Alibaba Cloud account must grant the RAM user the required permissions to use the Machine Translation service. This topic describes how to grant a RAM user permissions for Machine Translation or revoke them.
Grant permissions to a RAM user
-
Log on to the Alibaba Cloud console with your Alibaba Cloud account. Go to , select the RAM user you want to authorize, and click Add Permissions.
-
Select a policy.
You can select from All Policy Types, system policy, or custom policy.
NotePermission assignment principles:
Principle of least privilege: Grant only the minimum set of permissions required to perform a task.
Privilege separation principle: Create separate policies for RAM users with different job functions.
System policy
-
For Policy Type, select system policy. In the Filter by policy name, description search box, enter mt. The system automatically lists the system policies related to Machine Translation.
-
In the list of policies, click the policy you want to attach.
Select the target policy and click OK. The following table describes the system policies for Machine Translation:
Parameter
Remarks
Description
AliyunMTFullAccess
Grants permissions to manage Machine Translation (alimt).
Allows access to and operations on all Machine Translation APIs and the console.
NoteThis policy grants permissions for high-risk operations, such as modifying or deleting resources.
AliyunMTReadOnlyAccess
Grants read-only access to Machine Translation (alimt).
Allows read-only access to all Machine Translation APIs and the console.
Custom policy
-
Add a custom policy
For Policy Type, select custom policy.
In the list of policies, click the custom policy you want to attach. If the policy does not exist, you can create a custom policy.
-
Create a custom policy
In the left-side navigation pane, choose , and then click Create Policy. Select the Script Editor tab. Create the required policy.
NoteA custom policy allows you to grant permissions for specific APIs.
For instructions on creating a custom policy, see Create a custom policy.
The Script Editor displays a JSON policy template. The structure includes a
Versionkey with a value of"1"and aStatementarray. The array contains theEffect("Allow"or"Deny"),Action(the API operations to authorize),Resource(the resource ARN), andCondition(the conditions for the policy to apply) fields. -
Custom policy example
For example, the permission requirements are as follows:
Permission requirement
Policy content
-
The ID of the Alibaba Cloud account is
123456.NoteYour Alibaba Cloud account ID and access keys are sensitive credentials. Do not store them in plaintext.
-
Allow calls to the Machine Translation General Edition API.
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": "alimt:TranslateGeneral", "Resource": "acs:alimt:*:123456:*" } ] }NoteFor more information about policy configuration, see Policy Management.
-
-
Revoke permissions from a RAM user
Log on to the Alibaba Cloud console with your Alibaba Cloud account. Go to . In the list of principals, find the target RAM user and click Remove Permission in the Actions column.
FAQ
-
Q: Why does a RAM user still get a "permission denied" error after being granted permissions?
A: Ensure the policy has taken effect and verify any API allowlist restrictions.
-
Q: How can I limit the number of translation requests for a RAM user?
A: You can control usage by using the
Conditionelement in a RAM policy.