This topic describes how to use a RAM role to access resources across Alibaba Cloud accounts.
Prerequisites
PTS is activated. For more information, see Activate PTS.
Background information
Enterprise A wants to authorize Enterprise B to use some of its cloud resources to perform business operations on its behalf. To facilitate this, Enterprise A can create a RAM role to allow Enterprise B to access and use the designated cloud resources on its behalf. A RAM role is a virtual user that does not have a fixed identity credential. A RAM role can be used only after it is assumed by a trusted entity. To use a RAM role to allow Enterprise B to access and use the designated cloud resources of Enterprise A, perform the following steps:
Step 1: Use the Alibaba Cloud account of Enterprise A to create a RAM role
Use the Alibaba Cloud account of Enterprise A to log on to the RAM console and create a RAM role.
Log on to the RAM console by using an Alibaba Cloud account or a RAM user who has administrative rights.
In the left-side navigation pane, choose .
In the Select Role Type step of the Create Role wizard, set the Select Trusted Entity parameter to Alibaba Cloud Account and click Next.
Enter a RAM role name, select Other Alibaba Cloud Account, and then enter the ID of the Alibaba Cloud account of Enterprise B as the trusted Alibaba Cloud account. Then, click OK.
Note Current Alibaba Cloud Account: If you want all RAM users that belong to the current Alibaba Cloud account to assume the RAM role, select Current Alibaba Cloud Account.
Other Alibaba Cloud Account: If you want all RAM users that belong to a different Alibaba Cloud account to assume the RAM role, select Other Alibaba Cloud Account and enter the ID of the Alibaba Cloud account. This option is provided to grant resources access permissions across Alibaba Cloud accounts. For more information, see Use a RAM role to grant permissions across Alibaba Cloud accounts.
You can view the ID of your Alibaba Cloud account on the Security Settings page.
If you want a specific RAM user instead of all RAM users that belong to an Alibaba Cloud account to assume the RAM role, you can use one of the following methods:
Step 2: Use the Alibaba Cloud account of Enterprise A to grant permissions to the RAM role
The RAM role that is created in Step 1 does not have permissions. Therefore, Enterprise A must grant permissions to the RAM role.
Log on to the RAM console by using an Alibaba Cloud account or a RAM user who has administrative rights.
In the left-side navigation pane, choose .
On the Roles page, find the RAM role that you want to manage and click Grant Permission in the Actions column.
In the Grant Permission panel, grant the AliyunPTSFullAccess
permission to the RAM role. Click Grant Permissions and then close the window.
Step 3: Use the Alibaba Cloud account of Enterprise B to create a RAM user
Use the Alibaba Cloud account of Enterprise B to log on to the RAM console and create a RAM user.
Log on to the RAM console by using an Alibaba Cloud account or a RAM user who has administrative rights.
In the left-side navigation pane, choose .
On the Users page, click Create User.
In the User Account Information section of the Create User page, configure the following parameters:
Logon Name: The logon name can be up to 64 characters in length, and can contain letters, digits, periods (.), hyphens (-), and underscores (_).
Display Name: The display name can be up to 128 characters in length.
Tag: Click the icon and enter a tag key and a tag value. You can add one or more tags to the RAM user. This way, you can manage the RAM user based on the tags.
Note You can click Add User to create multiple RAM users at a time.
In the Access Mode section, select an access mode and configure the required parameters.
To ensure the security of your Alibaba Cloud account, we recommend that you select only one access mode for the RAM user. This way, the RAM user for an individual is separated from the RAM user for a program.
Console Access
If the RAM user represents an individual, we recommend that you select Console Access for the RAM user. This way, the RAM user can use a username and password to access Alibaba Cloud. If you select Console Access, you must configure the following parameters:
Set Console Password: You can select Automatically Regenerate Default Password or Reset Custom Password. If you select Reset Custom Password, you must specify a password. The password must meet the complexity requirements. For more information, see Configure a password policy for RAM users.
Password Reset: specifies whether the RAM user is required to reset the password upon the next logon.
Enable MAF: specifies whether to enable multi-factor authentication (MFA) for the RAM user. After you enable MFA, you must bind an MFA device to the RAM user or allow the RAM user to bind an MFA device. For more information, see Bind an MFA device to a RAM user.
OpenAPI Access
If the RAM user represents a program, we recommend that you select OpenAPI Access for the RAM user. This way, the RAM user can use an AccessKey pair to access Alibaba Cloud. If you select OpenAPI Access, the system automatically generates an AccessKey ID and AccessKey secret for the RAM user. For more information, see Obtain an AccessKey pair.
Important An AccessKey secret for a RAM user is displayed only after you click Create AccessKey. You cannot query the AccessKey secret in subsequent operations. Therefore, you must back up your AccessKey secret.
Click OK.
Complete security verification as prompted.
Step 4: Use the Alibaba Cloud account of Enterprise B to grant permissions to the RAM user
Enterprise B must grant the AliyunSTSAssumeRoleAccess permission to the RAM user. This way, the RAM user can assume the RAM role created by Enterprise A.
Log on to the RAM console by using an Alibaba Cloud account or a RAM user who has administrative rights.
In the left-side navigation pane, choose .
On the Users page, find the RAM user that you created, and click Add Permissions in the Actions column.
In the Grant Permission panel, grant the AliyunSTSAssumeRoleAccess
permission to the RAM user. Click Grant Permissions and then close the window.
Step 5: Use the RAM user of Enterprise B to access the Alibaba Cloud resources of Enterprise A
Log on to the Alibaba Cloud Management Console by using the RAM user of Enterprise B created in Step 3.
On the Alibaba Cloud Management Console homepage, move the pointer over the profile picture in the upper-right corner and then click Switch Role.
On the Switch Role page, enter the alias or default domain name of Enterprise A and the name of the RAM role of Enterprise A created in Step 1, and then click Submit.
Enterprise B can manage the Alibaba Cloud resources of Enterprise A.