All Products
Search
Document Center

Server Load Balancer:Authorize a RAM user to access SLB resources within a different Alibaba Cloud account

Last Updated:Mar 24, 2025

This topic describes how to use the Alibaba Cloud account of Enterprise A to create a Resource Access Management (RAM) role and allow a RAM user of Enterprise B to assume the RAM role. The RAM role allows the RAM user of Enterprise B to access the Server Load Balancer (SLB) resources of Enterprise A.

Background Information

If Enterprise A purchases a variety of cloud resources for business use and wants to entrust some tasks to Enterprise B, Enterprise A can create a RAM role to grant permissions to Enterprise B. A RAM role does not have a specific logon password or an AccessKey pair. A RAM role can be used only after the RAM role is assumed by a trusted entity. To meet the business requirements of Enterprise A, perform the following steps:

  1. Create a RAM role with the Alibaba Cloud account of Enterprise A.

  2. Attach a policy to the RAM role.

  3. Create a RAM user with the Alibaba Cloud account of Enterprise B.

  4. Attach the AliyunSTSAssumeRoleAccess policy to the RAM user with the Alibaba Cloud account of Enterprise B.

  5. The RAM user of Enterprise B accesses the resources within the Alibaba Cloud account of Enterprise A in the console or by calling API operations.

Step 1: Create a RAM role with the Alibaba Cloud account of Enterprise A

Log on to the RAM console and create a RAM role with the Alibaba Cloud account of Enterprise A.

  1. Log on to the RAM console as a RAM user who has administrative rights.

  2. In the left-side navigation pane, choose Identities > Roles.

  3. On the Roles page, click Create Role.

    image

  4. On the Create Role page, set the Principal Type parameter to Cloud Account, specify an Alibaba Cloud account, and then click OK.

    image

    • Current Account: If you want a RAM user or RAM role that belongs to your Alibaba Cloud account to assume the RAM role, select Current Account.

    • Other Account: If you want a RAM user or RAM role that belongs to a different Alibaba Cloud account to assume the RAM role, select Other Account and enter the ID of the Alibaba Cloud account. This option is provided to grant permissions on resources that belong to different 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.

  5. Optional. If you want the RAM role to be assumed only by a specific RAM user or RAM role that belongs to the trusted Alibaba Cloud account, click Switch to Policy Editor and modify the trust policy of the RAM role in the editor.

    The editor supports the Visual editor and JSON modes. In the following example, only the RAM user Alice within the Alibaba Cloud account whose ID is 100******0719 can assume the RAM role.

    • Visual editor

      Specify a RAM user for the Principal element.

      image

      image

    • JSON

      Specify a RAM user for the RAM field of the Principal parameter.

      {
        "Version": "1",
        "Statement": [
          {
            "Effect": "Allow",
            "Principal": {
              "RAM": "acs:ram::100******0719:user/Alice"
            },
            "Action": "sts:AssumeRole"
          }
        ]
      }

  6. In the Create Role dialog box, configure the Role Name parameter and click OK.

Step 2: Grant permissions to the RAM role with the Alibaba Cloud account of Enterprise A

The RAM role that is created in Step 1 does not have permissions. Therefore, Enterprise A must grant permissions to the RAM role.

  1. Log on to the RAM console as a RAM administrator.

  2. In the left-side navigation pane, choose Identities > Roles.

  3. On the Roles page, find the RAM role created in Step 1 and click Grant Permission in the Actions column.

  4. In the Grant Permission panel, grant permissions to the RAM role created in Step 1.

    1. Configure the Resource Scope parameter.

      • Account: The authorization takes effect on the current Alibaba Cloud account.

      • Resource Group: The authorization takes effect on a specific resource group.

        Note

        If you select Resource Group for the Resource Scope parameter, make sure that the required cloud service supports resource groups. For more information, see Services that work with Resource Group.

    2. Configure the Principal parameter.

      The principal is the RAM role to which you want to grant permissions. The current RAM role is automatically selected.

    3. Configure the Policy parameter.

      A policy is a set of access permissions. You can select multiple policies at a time.

      • System policies: policies that are created by Alibaba Cloud. You can use but cannot modify these policies. Version updates of the policies are maintained by Alibaba Cloud. For more information, see Services that work with RAM.

        Note

        The system automatically identifies high-risk system policies, such as AdministratorAccess and AliyunRAMFullAccess. We recommend that you do not grant unnecessary permissions by attaching high-risk policies.

      • Custom policies: You can manage and update custom policies based on your business requirements. You can create, update, and delete custom policies. For more information, see Create a custom policy.

    4. Click Grant permissions.

  5. Click Close.

Step 3: Create a RAM user with the Alibaba Cloud account of Enterprise B

Enterprise B must use its Alibaba Cloud account to log on to the RAM console and create a RAM user.

  1. Log on to the RAM console by using an Alibaba Cloud account or a RAM user who has administrative rights.

  2. In the left-side navigation pane, choose Identities > Users.

  3. On the Users page, click Create User. image

  4. 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 edit 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.

  5. 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. For more information, see Bind an MFA device to a RAM user.

    • Using permanent AccessKey to access

      If the RAM user represents a program, you can select Using permanent AccessKey to 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 when you create an AccessKey pair. You cannot query the AccessKey secret in subsequent operations. Therefore, you must back up your AccessKey secret.

      • An AccessKey pair is a permanent credential for application access. If the AccessKey pair of an Alibaba Cloud account is leaked, the resources that belong to the account are exposed to potential risks. To prevent credential leak risks, we recommend that you use Security Token Service (STS) tokens. For more information, see Best practices for using an access credential to call API operations.

  6. Click OK.

  7. Complete security verification as prompted.

Step 4: Grant permissions to the RAM user with the Alibaba Cloud account of Enterprise B

Enterprise B must attach the AliyunSTSAssumeRoleAccess policy to the RAM user created in Step 3. This way, the RAM user can assume the RAM role created in Step 1.

  1. Log on to the RAM console as a RAM administrator.

  2. In the left-side navigation pane, choose Identities > Users

  3. On the Users page, find the RAM user created in Step 3 and click Add Permissions in the Actions column.

  4. In the Grant Permission panel, grant permissions to the RAM user.

    1. Configure the Resource Scope parameter.

      • Account: The authorization takes effect on the current Alibaba Cloud account.

      • Resource Group: The authorization takes effect on a specific resource group.

        Note

        If you select Resource Group for the Resource Scope parameter, make sure that the required cloud service supports resource groups. For more information, see Services that work with Resource Group.

    2. Select a principal. In this example, the RAM user created in Step 3 is selected.

    3. Select a policy. In this example, AliyunSTSAssumeRoleAccess is selected.

  5. Click Grant permissions. Then, click Close.

What to do next

After the preceding steps are completed, the RAM user of Enterprise B can perform the following steps to access the resources of Enterprise A by using the console or calling API operations:

Access the cloud resources of Enterprise A by using the console

  1. Log on to the Alibaba Cloud Management Console with the Alibaba Cloud account of Enterprise B.

  2. Move the pointer over the avatar and click Switch Identity.

    Note

    Enter the alias of the Alibaba Cloud account of Enterprise A and the name of the RAM role created in Step 1.

    For more information, see Assume a RAM role.

  3. Log on to the SLB console. Then, Enterprise B can access the SLB resources of Enterprise A.

Access the cloud resources of Enterprise A by calling API operations

To access the cloud resources of Enterprise A by calling API operations as the RAM user, Enterprise B must specify AccessKeyId, AccessKeySecret, and SecurityToken of the RAM user in the code. The value of SecurityToken is a temporary security token. For more information about how to obtain a temporary token by using Security Token Service (STS), see AssumeRole.