Updated on 2024-10-29 GMT+08:00

Creating an IAM User and Granting ModelArts Permissions

The agency created in Configuring Agency Authorization for ModelArts with One Click almost has all permissions of dependent services. If your Huawei Cloud account meets your permissions requirements, you can skip this section.

ModelArts allows you to configure fine-grained permissions for refined management of resources and permissions. This type of feature is commonly used in scenarios with large-scale enterprise users. If you want to precisely control the scope of permissions granted to an agency, use custom authorization.

This section describes how to configure fine-grained permissions for IAM users.

Using ModelArts requires OBS authorization. ModelArts users require OBS system permissions.

Prerequisites

You have learned about the permissions that can be added to user groups for using ModelArts and dependent services so that you can select them based on your requirements. For details about the permissions supported by ModelArts, see Table 1.

Table 1 Service authorizations

Target Service

Authorization Description

IAM Permission

Mandatory

ModelArts

This permission allows sub-users to use ModelArts.

The sub-users with the ModelArts CommonOperations permission can only use resources, but cannot create, update, or delete any dedicated resource pool. You are advised to assign this permission to sub-users.

ModelArts CommonOperations

Yes

The sub-users with the ModelArts FullAccess permission have all access permissions, including creating, updating, and deleting dedicated resource pools. Exercise caution when assigning this permission.

ModelArts FullAccess

No

Select either ModelArts FullAccess or ModelArts CommonOperations.

OBS

This permission allows sub-users to use OBS. ModelArts datasets, development environments, training jobs, and model inference and deployment require OBS for forwarding data.

OBS OperateAccess

Yes

SWR

This permission allows sub-users to use SWR. ModelArts custom images require the SWR FullAccess permission.

SWR OperateAccess

Yes

KMS

This permission allows sub-users to use remote SSH of ModelArts notebook.

KMS CMKFullAccess

No

IEF

This permission allows sub-users to use IEF. It is required if you use ModelArts edge services that depend on IEF.

Tenant Administrator

No

Cloud Eye

This permission allows sub-users to use Cloud Eye. Using Cloud Eye, you can view the running statuses of ModelArts real-time services and model loads, and set monitoring alarms.

CES FullAccess

No

SMN

This permission allows sub-users to use SMN. SMN is used with Cloud Eye.

SMN FullAccess

No

VPC

When creating a ModelArts dedicated resource pool, sub-users require VPC permissions so that they can customize networks.

VPC FullAccess

No

SFS

This permission allows sub-users to use SFS. SFS file systems can be mounted to ModelArts dedicated resource pools to serve as storage for development environments or training jobs.

SFS Turbo FullAccess

SFS FullAccess

No

Configuring Common Operations Permissions for ModelArts Standard

  1. Create a user group.

    Log in to the IAM console. Choose User Groups and click Create User Group. Enter a user group name and click OK.

  2. Configure permissions for the user group.

    In the user group list, locate the created user group, click Authorize in the Operation column, and perform the following operations.

    1. Assign permissions for using ModelArts. Search for ModelArts in the search box. Select either ModelArts FullAccess or ModelArts CommonOperations.
      The differences between the options are as follows:
      • The sub-users with the ModelArts CommonOperations permission can only use resources, but cannot create, update, or delete any dedicated resource pool. You are advised to assign this permission to sub-users.
      • The sub-users with the ModelArts FullAccess permission have all access permissions, including creating, updating, and deleting dedicated resource pools. Exercise caution when assigning this permission.
      Figure 1 Assigning permissions for using ModelArts

    2. Configure permissions for using other dependent services. For example, to use OBS, search for OBS and select OBS OperateAccess. ModelArts training jobs use OBS to forward data. Therefore, the permissions for using OBS are necessary.

      For permissions of more cloud services, such as SWR, see Table 1.

    3. Click Next and set the minimum authorization scope. Select Region-specific projects, select the region to be authorized, and click OK.
      In this example, you are allowed to use services in the CN-Hong Kong region only.
      Figure 2 Selecting an authorization scope

    4. A message is displayed, indicating that the authorization is successful. View the authorization information and click Finish. It takes 15 to 30 minutes for the authorization to take effect.

  3. Create a sub-user. In the navigation pane on the left of the IAM console, choose Users. In the right pane, click Create User in the upper right corner. On the Create User page, add multiple users. Set parameters as prompted and click Next.
  4. Add the sub-user to the user group. On the Add User to Group page, select a user group and click Create. The system adds the created users to the user group.
  5. Log in as the IAM user and verify permissions.

    Log in to the console as the created user, switch to the authorized region, and verify the permissions.

    • Choose Service List > ModelArts. In the navigation pane of the ModelArts console, choose your desired type of AI dedicated resource pools and create one. You should not be able to create a new resource pool if the ModelArts CommonOperations permission has taken effect.
    • Choose any other service in Service List. (Assume that the current policy contains only ModelArts CommonOperations.) If a message appears indicating that you have insufficient permissions to access the service, the ModelArts CommonOperations permission has taken effect.
    • Choose Service List > ModelArts. In the navigation pane of the ModelArts console, choose Asset Management > Datasets and click Create. You should be able to access the corresponding OBS path if the OBS permission has taken effect.
    • Verify other optional permissions according to Table 1.

Creating a Custom Policy for ModelArts Standard

In addition to the default system permissions of ModelArts, you can create custom policies for refined user permission management, for example, managing OBS operation permissions.

You can create custom policies using either the visual editor or JSON views on IAM. This section describes how to use a JSON view to create a custom policy to grant permissions required to use development environments and the minimum permissions required by ModelArts to access OBS.

For more about other functions and dependent services, see ModelArts Standard Role/Policy-based Authorization.

For details about how to create custom policies and related parameters, see Creating a Custom Policy.

A custom policy can contain actions of multiple services that are globally accessible or accessible through region-specific projects.

ModelArts is accessible through region-specific projects, but OBS is globally accessible, so you need to create separate policies for the two services and then apply these policies to the users.

  1. Create a custom policy with minimum OBS permissions for ModelArts.
    Log in to the IAM console, choose Permissions > Policies/Roles, and click Create Custom Policy. Set the following parameters:
  2. Create a custom policy for the permission to use the ModelArts development environment, as shown in Figure 4. Set the following parameters:
  3. After creating a user group on the IAM console, grant the custom policy created in 1 to the user group.
  4. Create a user on the IAM console and add the user to the group created in 3.
  5. Log in to the console as the created user, switch to the authorized region, and verify the permissions.
    • Choose Service List > ModelArts. In the navigation pane of the ModelArts console, choose Asset Management > Datasets. If you cannot create a dataset, the permission granted only for using the development environment has taken effect.
    • Choose Service List > ModelArts. In the navigation pane of the ModelArts console, choose Development & Production > Development Workspace > Notebook and click Create Notebook. If you can access the OBS path specified in Storage, the OBS permission has taken effect.

Example Custom Policy with OBS Permissions for ModelArts

In this example, the minimum permissions required by ModelArts to access OBS are assigned, including the permissions for OBS buckets and objects. With these permissions, you can access OBS from ModelArts without restrictions.

{
    "Version": "1.1",
    "Statement": [
        {
            "Action": [
                "obs:bucket:ListAllMybuckets",
                "obs:bucket:HeadBucket",
                "obs:bucket:ListBucket",
                "obs:bucket:GetBucketLocation",
                "obs:object:GetObject",
                "obs:object:GetObjectVersion",
                "obs:object:PutObject",
                "obs:object:DeleteObject",
                "obs:object:DeleteObjectVersion",
                "obs:object:ListMultipartUploadParts",
                "obs:object:AbortMultipartUpload",
                "obs:object:GetObjectAcl",
                "obs:object:GetObjectVersionAcl",
                "obs:bucket:PutBucketAcl",
                "obs:object:PutObjectAcl"
            ],
            "Effect": "Allow"
        }
    ]
}

Example Custom Policy with Permissions for Using the ModelArts Development Environment

{ 
    "Version": "1.1", 
    "Statement": [ 
        { 
            "Effect": "Allow", 
            "Action": [ 
                "modelarts:notebook:list", 
                "modelarts:notebook:create" ,
                "modelarts:notebook:get" ,
                "modelarts:notebook:update" ,
                "modelarts:notebook:delete" ,
                "modelarts:notebook:action" ,
                "modelarts:notebook:access" 
            ] 
        } 
    ] 
}