Help Center/ Distributed Message Service for RocketMQ/ User Guide/ Using IAM to Grant Access to DMS for RocketMQ/ Using IAM Roles or Policies to Grant Access to DMS for RocketMQ
Updated on 2026-10-22 GMT+08:00

Using IAM Roles or Policies to Grant Access to DMS for RocketMQ

System-defined permissions in Role/Policy-based Authorization provided by Identity and Access Management (IAM) let you control access to DMS for RocketMQ. With IAM, you can:

  • Create IAM users in your Huawei Cloud account for employees based on your enterprise's organizational structure. Each IAM user has their own identity credentials for accessing DMS for RocketMQ resources.
  • Grant users only the permissions required to perform a given task based on their job responsibilities.
  • Entrust a Huawei Cloud account or a cloud service to perform efficient O&M on your DMS for RocketMQ resources.

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

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

Prerequisites

Before granting permissions to user groups, learn about system-defined permissions in Role/Policy-based Permissions Management for DMS for RocketMQ. To grant permissions for other services, learn about all system-defined permissions supported by IAM.

DMS for RocketMQ permissions policies are based on DMS. Therefore, when assigning permissions, select DMS permissions policies.

Process Flow

Figure 1 Process for granting DMS for RocketMQ permissions

  1. On the IAM console, create a user group and grant it permissions.

    DMS ReadOnlyAccess is used as an example.

  2. Create an IAM user and add it to the created user group.

    Add the created user to the user group created in 1.

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

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

    • Choose Service List > Distributed Message Service (for RocketMQ). Then click Buy Instance on the console of DMS for RocketMQ. If a message appears indicating that you have insufficient permissions to perform the operation, the DMS ReadOnlyAccess policy is in effect.
    • Choose Service List > Elastic Volume Service. If a message appears indicating that you have insufficient permissions to access the service, the DMS ReadOnlyAccess policy is in effect.

Example Custom Policies

You can create custom policies to supplement the system-defined policies of DMS for RocketMQ. For details about actions supported in custom policies, see Actions Supported by Policy-based Authorization.

To create a custom 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 Policy. This section lists examples of common DMS for RocketMQ custom policies.

  • Example 1: Grant permission to delete and restart instances.
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "dms:instance:modifyStatus",
                    "dms:instance:delete"
                ]
            }
        ]
    }
  • Example 2: Grant permission to deny instance deletion.

    A policy with only "Deny" permissions must be used together with other policies. If the permissions granted to an IAM user contain both "Allow" and "Deny", the "Deny" permissions take precedence over the "Allow" permissions.

    Assume that you want to grant the permissions of the DMS FullAccess policy to a user but want to prevent them from deleting instances. You can create a custom policy for denying instance deletion, and attach this policy together with the DMS FullAccess policy to the user. As an explicit deny in any policy overrides any allows, the user can perform all operations on instances excepting deleting them.

    Example policy denying instance deletion:

    {
            "Version": "1.1",
            "Statement": [
                    {
                            "Effect": "Deny",
                            "Action": [
                                    "dms:instance:delete"
                            ]
                    }
            ]
    }

DMS for RocketMQ Resources

A resource is an object that exists within a service. DMS for RocketMQ resources include rocketmq. To select these resources, specify their paths.

Table 1 DMS for RocketMQ resources and their paths

Resource

Resource Name

Path

rocketmq

Instance

[Format]

DMS:*:*: rocketmq:instance ID

[Note]

For instance resources, IAM automatically generates the prefix (DMS:*:*:rocketmq:) of the resource path.

For the path of a specific instance, add the instance ID to the end. You can also use an asterisk * to indicate any instance. For example:

DMS:*:*:rocketmq:* indicates any RocketMQ instance.

DMS for RocketMQ Request Conditions

Request conditions are useful in determining when a custom policy is in effect. A request condition consists of condition keys and operators. Condition keys are either global or service-level and are used in the Condition element of a policy statement. Global condition keys (starting with g:) are available for operations of all services, while service-specific condition keys (starting with a service name such as dms:) are available only for operations of specific services. An operator must be used together with a condition key to form a complete condition statement.

DMS for RocketMQ has a group of predefined condition keys that can be used in IAM. For example, to define an "Allow" permission, use the condition key dms:ssl to filter instances by SSL configurations. The following table lists the DMS for RocketMQ predefined condition keys.

Table 2 Predefined condition keys of DMS for RocketMQ

Condition Key

Operator

Description

dms:publicIP

Bool

Null

Whether public access is enabled

dms:ssl

Bool

Null

Whether SSL is enabled