Help Center> Document Database Service> Best Practices> Creating a User and Granting the Read-Only Permission to the User
Updated on 2024-01-18 GMT+08:00

Creating a User and Granting the Read-Only Permission to the User

Step 1: Create a User Group and Grant Permissions

Users in the same user group have the same permissions. Users created in IAM inherit permissions from the groups to which they belong. Users created in IAM inherit permissions from the groups they belong to. To create a user group, perform the following steps:

  1. Log in to Huawei Cloud using your Huawei account. Select HUAWEI ID login.

    Figure 1 HUAWEI ID Login

  2. On the management console, click the username in the upper right corner and then choose Identity and Access Management.

    Figure 2 Choosing IAM

  3. On the IAM console, choose User Groups in the navigation pane. Then click Create User Group.

    Figure 3 User group

  4. Enter a user group name (for example, test_01), set the password, and click OK.

    The user group is then displayed in the user group list.

  5. In the user group list, choose Authorize in the row that contains the test_01 user group.
  6. Select Document Database Service from the drop-down list, select DDS ReadOnlyAccess, and click Next.

    Figure 4 Authorization

  7. Specify the scope and click OK.

    • All resources
    • Region-specific projects: The selected permissions will be applied to resources in the region-specific projects you select.
    Figure 5 Specifying the scope

Step 2: Create an IAM User

IAM users can be created for employees or applications of an enterprise. Each IAM user has their own security credentials, and inherits permissions from the groups it is a member of. To create an IAM user, perform the following steps:

  1. On the IAM console, choose Users in the navigation pane. Then click Create User.
  2. Specify the user information on the Create User page. To create more users, click Add User. You can add a maximum of 10 users at a time.

    Figure 6 Creating a user
    • Username: Used for logging in to Huawei Cloud. For this example, enter James.
    • Email Address: Email address bound to the IAM user. This parameter is mandatory if the access type is specified as Set by user.
    • (Optional) Mobile Number: Mobile number bound to the IAM user.
    • (Optional) Description: Description of the user.

  3. Configure required parameters and click Next.

    Figure 7 Configuring user details
    Table 1 Configuration items

    Parameter

    Description

    Access Type

    • Programmatic access: Select this option to allow the user to access cloud services using development tools, such as APIs, CLI, and SDKs. You can generate an access key or set a password for the user.
    • Management console access: Select this option to allow the user to access cloud services using the management console. You can set or generate a password for the user or request the user to set a password at first login.

    Credential Type

    • Access key: Download the access key after the user is created.
    • Password: If you create multiple users, set a password for the users and determine whether to require the users to reset the password at first login. If you create one user, you can select Automatically generated and the system automatically generates a login password for the user.

    Login Protection

    To ensure account security, you are advised to select Enable. To enable or disable login protection for an IAM user after creation, see Login Protection.

  4. Add the users to user group created in 4 and click Create User.

    Figure 8 Creating a user

  5. Check the created users in the user list. If you select Access key for Credential Type, you can download the access key after you create the user. You can also manage the Access Keys on the My Credentials page.

    Figure 9 Viewing the results

Step 3: Log In and Verify Permissions

After the user is created, use the username and identity credential to log in to Huawei Cloud, and verify that the user has the permissions defined by the DDS ReadOnlyAccess policy.

  1. On the Huawei Cloud login page, click IAM User in the lower left corner.

    Figure 10 IAM user login

  2. Enter the account name, username, and password, and click Log In.

    • The account name is the name of the Huawei account that created the IAM user.
    • The username and password are those set by the account when creating the IAM user.

    If the login fails, contact the entity owning the account to verify the username and password. Alternatively, you can reset the password by following the procedure in Resetting Password for an IAM User.

  3. After successful login, switch to a region where the user has been granted permissions on the management console.

    Figure 11 Region

  4. Choose Service List > Document Database Service. Then click Buy DB Instance on the DDS console. If a message appears indicating insufficient permissions to perform the operation, the DDS ReadOnlyAccess policy has already taken effect.
  5. Choose any other service in the Service List. If a message appears indicating insufficient permissions to access the service, the DDS ReadOnlyAccess policy has already taken effect.