You can create a RAM role by using the Alibaba Cloud account of Company A and grant permissions to the role. A RAM user from Company B can then assume this role to access Company A's cloud resources. This topic describes the required steps.
Prerequisites
PTS has been activated. For more information, see billing overview.
Background information
Assume that Company A has purchased multiple cloud resources to run its business and needs to authorize Company B to manage some of them on its behalf. You can use a RAM role to meet this requirement. A RAM role is a virtual user without a specific credential that a trusted entity must assume. To achieve this, follow these steps:
Step 1: Create a RAM role
Log on to the RAM console by using Company A's Alibaba Cloud account to create a RAM role.
-
Log on to the RAM console using your Alibaba Cloud account or as a RAM administrator.
-
In the left-side navigation pane, choose Identities > Roles.
-
On the Create Role page, select Alibaba Cloud Account as the Trusted Entity Type. Select Other Alibaba Cloud Account, and enter Company B's Alibaba Cloud account ID in the text box. Then, click OK.
Note-
Current Alibaba Cloud Account: Select this option to allow all RAM users in the current Alibaba Cloud account to assume the RAM role.
-
Other Alibaba Cloud Account: Select this option to allow all RAM users from another Alibaba Cloud account to assume the RAM role. Then, enter the ID of the other Alibaba Cloud account. This option is used for cross-account resource access. For more information, see Access resources across Alibaba Cloud accounts.
You can view the ID of your root account on the Security Settings page.
-
To allow only specific RAM users to assume the RAM role, rather than all users in a root account, use one of the following methods:
-
Modify the trust policy of the RAM role. For more information, see Example 1: Modify the trusted entity of a RAM role to an Alibaba Cloud account.
-
Modify the permission policy that allows a RAM user to assume a role. For more information, see How do I restrict a specific RAM user from assuming a specific RAM role?.
-
-
-
In the dialog box that appears, enter a role name and click OK.
Step 2: Grant permissions to the RAM role
A newly created RAM role has no permissions. Company A must grant permissions to the role.
-
Log on to the RAM console using your Alibaba Cloud account or as a RAM administrator.
-
In the left-side navigation pane, choose Identities > Roles.
-
On the Roles page, find the target RAM role and click Grant Permission in the Actions column.
-
In the Grant Permission panel, grant the
AliyunPTSFullAccesspermission to the RAM role. Then, click OK and close the panel.
Step 3: Create a RAM user
Log on to the RAM console by using Company B's Alibaba Cloud account to create a RAM user.
-
Log on to the RAM console by using an Alibaba Cloud account or a RAM user with RAM administrator permissions (
AliyunRAMFullAccess). -
In the left-side navigation pane, choose Identities > Users.
-
On the Users page, click Create User.
-
On the Create User page, in the User Account Information section, configure the user's basic information.
-
Logon Name (Required): Can contain letters, digits, periods (.), hyphens (-), and underscores (_). The name can be up to 64 characters long.
-
Display Name (Optional): Up to 128 characters.
-
Tag (Optional): Click
and enter a tag key and tag value to manage users based on tags.NoteClick Add User to create multiple RAM users at a time.
-
-
In the Access Mode section, configure the settings based on the user type.
Important-
For better account security, select only one access mode and separate human users from application users.
-
A leaked AccessKey pair compromises the security of your entire account. Use Security Token Service (STS) tokens, which are temporary credentials, to reduce security risks. For more information, see Best practices for using access credentials to access Alibaba Cloud OpenAPI.
Console Access
Select Console Access.
-
Set Logon Password: You can automatically generate a password or specify a custom one. A custom password must meet the password complexity rules. For more information, see Set a password policy for RAM users.
-
Password Reset: Specify whether the RAM user must reset the password at the next logon.
-
Enable MFA: By default, the account enforces MFA for all users at logon. To change this setting, see Manage security settings for a RAM user. RAM users must bind an MFA device when they log on for the first time. For more information, see A RAM user binds an MFA device.
Programmatic access
Select Programmatic Access.
If you enable this option, an AccessKey ID and an AccessKey secret are automatically generated for the RAM user.
ImportantThe AccessKey secret of a RAM user is displayed only when you create it and cannot be retrieved later. You must immediately download or copy the AccessKey secret and keep it in a secure place. A leaked AccessKey pair poses a high security risk to your entire account. For more information, see Create an AccessKey pair.
-
Step 4: Grant permissions to the RAM user
Company B must grant the AliyunSTSAssumeRoleAccess permission to the RAM user in its Alibaba Cloud account. This allows the RAM user to assume the RAM role created by Company A.
-
Log on to the RAM console using your Alibaba Cloud account or as a RAM administrator.
-
In the left-side navigation pane, choose Identities > Users.
-
On the Users page, find the target RAM user and click Add Permissions in the Actions column.
-
In the Add Permissions panel, grant the
AliyunSTSAssumeRoleAccesspermission to the RAM user. Then, click OK and close the panel.
Step 5: Access cloud resources
-
Log on to the Alibaba Cloud Management Console as the RAM user created in Step 3: Company B creates a RAM user.
-
In the upper-right corner of the console, move the pointer over the profile icon and click Switch Role.
-
On the Switch Role page, enter Company A's account alias or default domain name, and the name of the RAM role created in Step 1: Company A creates a RAM role. Then, click Submit.
-
After switching the role, you can manage Company A's cloud resources.