This topic describes how to create a RAM role whose trusted entity is an Alibaba Cloud account and authorize the RAM role to access Log Service resources. This type of RAM role is used for cross-account access and temporary authorization.
Background information
Roles and users are identities that are used in Resource Access Management (RAM). A RAM role is a virtual identity that does not have a credential, such as a password or an AccessKey pair. If an entity user assumes a RAM role, the entity user can obtain and use the Security Token Service (STS) token of the role to access the corresponding resources. You can assign the RAM role to a trusted entity, such as an Alibaba Cloud account, a RAM user, or an Alibaba Cloud service. For more information, see RAM role overview.
Step 1: Create a RAM role
Step 2: Grant permissions to the RAM role
- AliyunLogFullAccess: the permissions to manage all Log Service resources.
- AliyunLogReadOnlyAccess: the read-only permissions on all Log Service resources.
If the system policies do not meet your business requirements, you can create a custom policy to implement fine-grained access control. For more information, see Create a custom policy. For information about the examples of policies, see Use custom policies to grant permissions to a RAM user and Overview.
To attach the AliyunLogReadOnlyAccess policy to a RAM role, perform the following steps:
- Log on to the RAM console.
- In the left-side navigation pane, choose .
- On the Roles page, find the RAM role and click Add Permissions in the Actions column.
- In the Add Permissions panel, select the AliyunLogReadOnlyAccess policy and click OK.
- Confirm the authorization result and click Complete.
Step 3: Assign the RAM role to a RAM user of the specified Alibaba Cloud account
You must use the specified Alibaba Cloud account to grant the AliyunSTSAssumeRoleAccess permission to a RAM user of the account. Then, the RAM user can be used to call the AssumeRole operation of STS and assume the RAM role that is created in Step 1: Create a RAM role.
- Log on to the RAM console.
- In the left-side navigation pane, choose .
- On the Users page, find the RAM user and click Add Permissions in the Actions column.
- In the Add Permissions panel, click System Policy, select the AliyunSTSAssumeRoleAccess policy, and then click OK.
- Confirm the authorization result and click Complete.
Step 4: Obtain an STS token for the RAM role
After you grant the AssumeRole permission to a RAM user, the RAM user calls the AssumeRole operation to obtain a temporary STS token for the RAM role that is created in Step 1: Create a RAM role.
- For more information about how to call the AssumeRole operation, see STS SDK for Java.
- After a RAM user obtains the AccessKey ID, AccessKey secret, and STS token, the RAM user can access Log Service by using the SDKs. For more information, see Overview.