Help Center/ Bare Metal Server/ User Guide/ Using IAM to Grant Access to BMS/ Using IAM Identity Policies to Grant Access to BMS
Updated on 2025-11-21 GMT+08:00

Using IAM Identity Policies to Grant Access to BMS

System-defined permissions in identity policy-based authorization provided by Identity and Access Management (IAM) let you control access to your BMSs. With IAM, you can:

  • Create IAM users or user groups for employees based on your enterprise's organizational structure. Each IAM user has their own identity credentials for accessing BMS resources.
  • Grant only the permissions required for users to perform a specific task.
  • Entrust a HUAWEI ID or a cloud service to perform efficient O&M on your BMS resources.

If your Huawei Cloud account meets your permissions requirements, you can skip this section.

Figure 1 shows the process flow of identity policy-based authorization.

Prerequisites

Before granting permissions to user groups, learn about system-defined permissions in identity policy-based authorization for BMS. To grant permissions for other services, learn about all system-defined permissions supported by IAM.

Process Flow

Figure 1 Process of granting BMS permissions
  1. On the IAM console, create an IAM user or create a user group.
  2. Attach a system-defined identity policy to the user or user group.

    Assign the permissions defined in the system-defined identity policy (BMSReadOnlyPolicy as an example) to the user or group, or attach the system-defined identity policy to it.

  3. Log in as the IAM user and verify permissions.

    In the authorized region, perform the following operations:

    • Choose Service List > Bare Metal Server. Then, click Buy BMS on the BMS console. If you are not allowed for this operation, the BMSReadOnlyPolicy has taken effect (assume that you only have the BMSReadOnlyPolicy assigned).
    • Choose any other service in the Service List, such as Virtual Private Cloud. If a message appears indicating insufficient permissions to access the service, the BMSReadOnlyPolicy has taken effect.
  4. (Optional) Create custom identity policies to supplement the system-defined identity policies of BMS. Add actions in custom identity policies as needed. For details about supported actions, see Actions Supported by Identity Policy-based Authorization.

    To create a custom identity policy, choose either visual editor or JSON.

    • Visual editor: Select cloud services, actions, resources, and request conditions. This does not require knowledge of policy syntax.
    • JSON: Create a JSON policy or edit an existing one.

    For details, see Creating a Custom Identity Policy and Attaching It to a Principal.

    When creating an identity custom policy, use the Resource element to specify the resources the policy applies to and use the Condition element (condition keys) to control when the policy is in effect. For details about the supported resource types and condition keys, see Actions Supported by Identity Policy-based Authorization.

Example Custom Identity Policies

  • Example 1: Grant permission to stop and delete BMSs in batches.
    { 
        "Version": "5.0", 
        "Statement": [ 
            { 
                "Effect": "Allow", 
                "Action": [ 
                    " 
                         bms:servers:stop 
                         bms:servers:start 
                     " 
                ] 
            } 
        ] 
    }
  • Example 2: Create a custom policy containing multiple actions.

    A custom identity policy can contain the actions of one or multiple services. Example:

    { 
            "Version": "5.0", 
            "Statement": [ 
                    { 
                            "Action": [ 
                                 "ecs:cloudServers:resize", 
                                 "ecs:cloudServers:delete", 
                                 "ecs:cloudServers:delete", 
                                 "ims:images:list", 
                                 "ims:serverImages:create", 
                                 "bms:servers:delete", 
                                 "bms:servers:changeOS"
                            ], 
                            "Effect": "Allow" 
                    } 
            ] 
    }