This tutorial explains how to grant cross-account bucket permissions to OSS buckets and folders from one primary account to another primary account.
In this tutorial, we illustrate the permission granting process using the two fictitious account entities, account A and account B. Account A grants aaccount B permission to access its resources. Account B then delegates this permission to RAM users in its account. In this example scenario, a bucket owner grants cross-account permission to another account to perform full bucket operations.
Assume that account A (account ID = 11223344, enterprise alias = company-a) needs to grant OSS operation permissions to the employee Anne of account B (account ID = 12345678, enterprise alias = company-b). The process is as follows:
- Account A creates a role which allows account B to assume the role.
- Account A grants permissions to the role.
- Account B creates RAM users and authorizes them to assume the role.
Note: For more information about enterprise alias, see the Set your enterprise alias section of Set up RAM in the RAM Quick Start.
Log on to the RAM console with the primary account credentials of account A.
Select Roles from the menu on the left, and then click Create Role.
The Create Role wizard page is displayed.
For 1: Select Rule type, select User Role.
For 2: Enter Type, select Other Alibaba Cloud Account, and enter the account ID of account B as the trusted Alibaba Cloud account ID. In this example, enter 12345678.
For 3: Configure Basic, enter a role name. In this example, enter oss-admin, and then click Create.
After creating the role, account A can view the role information on the Role Details page. In this example, the global name ARN of the role is
acs:ram::11223344:role/oss-admin. The authorization policy of the role is as follows:
The preceding policy allows account B to assume this role.
In this step, account A attaches the authorization policy
AliyunOSSFullAccess to the role so that the role can access OSS resources.
To grant permission to the role, follows these steps:
Click Authorize in 4: Role Created, or go to the Role Details page and click Role Authorization Policies.
Click Edit Authorization Policy.
The Edit Role Authorization Policy page is displayed.
- On the Search and Attach tab page, find the AliyunOSSFullAccess policy in the Available Authorization Policy Names pane, add it to the Selected Authorization Policy Name pane, and then click OK.
Note: This step grants full access to OSS resources. If you want to grant specific permissions to OSS buckets and folders, see Tutorial: Control access to buckets and folders.
Log on to the RAM console with the primary account credentials of account B.
Select Users from the menu on the left, and then click Create User.
The Create User page is displayed.
Enter a user name such as Anne. The other information is optional. Then click OK.
In the user name list, click the user name to open the User Details page. Click Enable Console Logon and set the logon password for the RAM user.
Go back to the RAM console and click Dashboard. Find the URL after RAM User Logon Link:. You will provide this URL to RAM users to log on to the console with their RAM user name and password.
Go to the User Details page, click User Authorization Policies, and then click Edit Authorization Policy.
The Edit User-Level Authorization page is displayed.
Find the AliyunSTSAssumeRoleAccess policy in the Available Authorization Policy Names pane, add it to the Selected Authorization Policy Name pane, and then click OK.
Open the RAM user logon page, and log on to the RAM console with RAM user Anne’s credentials.
The user logon information is displayed in the upper-right corner.
Move the mouse pointer to the user name and click Switch Role.
The Switch Role page is displayed.
Enter the enterprise alias of account A company-a and the role name oss-admin, and then click Switch.
Perform operations on the OSS resources of account A.