RAM access control

Updated at:

Create multiple RAM users with role-based permissions so that different RAM users can manage specific resources, improving efficiency and reducing the risk of information leakage.

Prerequisites

  • Application Real-Time Monitoring Service (ARMS) is activated. For more information, see Activate ARMS.

  • Understand the basic structure and syntax of permission policies before you create a custom one. For more information, see Permission policy elements.

Step 1: Add a system permission policy to a RAM user

Grant a RAM user the permissions to access the Prometheus console.

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

  2. In the left-side navigation pane, choose Identities > Users.
  3. On the User page, find the target RAM user and click Add Permission in the Operation column.

  4. On the Create Authorization page, configure the following parameters.

    Parameter

    Description

    Resource Range

    Select Account.

    Principal

    The RAM user to receive the permission.

    Permission Policy

    Select AliyunARMSPrometheusAccessAuth.

  5. Click OK, and then click Close.

Step 2: Create a custom permission policy

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

  2. In the left-side navigation pane, choose Permission Management > Permission Policy.

  3. On the Permission Policy page, click Create Policy.

  4. On the Create Policy page, click the Edit Script tab. Enter your policy content in the policy editor. The following example policy grants all operation permissions on Prometheus instances in the China (Hangzhou) region.

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "arms:List*",
            "arms:Get*",
            "arms:Update*",
            "arms:Exe*",
            "arms:Create*",
            "arms:Del*",
            "arms:Add*",
            "arms:Check*",
            "arms:Delete*",
            "arms:Restart*",
            "arms:HealthCheck*",
            "arms:BindPrometheus*",
            "arms:install*"
          ],
          "Resource": "acs:arms:cn-hangzhou:*:prometheus/*"
        }
      ]
    }
  5. Click OK. Enter a Name and Description for the permission policy.

  6. Click OK.

Step 3: Add a custom permission policy for a RAM user

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

  2. In the left-side navigation pane, choose Identities > Users.
  3. On the User page, find the target RAM user and click Add Permission in the Operation column.

  4. On the Add Permission page, grant permissions to the RAM user as described in the following table.

    Parameter

    Description

    Resource Range

    Select resource. The permission takes effect within the specified resource group.

    Principal

    The RAM user to receive the permission.

    Permission Policy

    Select the custom permission policy that you created in Step 2.

  5. Click OK, and then click Close.

Step 4: Verify the permissions

  1. After attaching the permission policies to the RAM user, log on to the ARMS console as the RAM user to verify the permissions. For more information, see Log on to the Alibaba Cloud Management Console as a RAM user.

  2. In the ARMS console, choose Managed Service for Prometheus and click Instances.

  3. On the Instances page, click image to view the resources in the authorized resource group.

    Use the All Resources drop-down list in the top navigation bar.

    Note

    If you try to view an unauthorized resource group, a "permission denied" message appears. Click Close.

Related operations

  • Resource groups enable fine-grained access control for Prometheus resources.

  • To use tags for fine-grained permissions, modify the custom policy from Step 2 and add a Condition. The following example grants permissions on Prometheus instances with specific tags. Replace tagkey and tagvalue with the actual values.

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": [
            "arms:List*",
            "arms:Get*",
            "arms:Update*",
            "arms:Exe*",
            "arms:Create*",
            "arms:Del*",
            "arms:Add*",
            "arms:Check*",
            "arms:Delete*",
            "arms:Restart*",
            "arms:HealthCheck*",
            "arms:BindPrometheus*",
            "arms:install*"
          ],
          "Resource": "acs:arms:*:*:prometheus/*",
          "Condition": {
            "StringEquals": {
               "acs:RequestTag/tagkey": [
                "tagvalue"
              ]
            }
          }
        }
      ]
    }
  1. When you navigate to the Prometheus instance list for the first time, a "permission denied" message is displayed.

    Note

    This is because no tag is selected for authorization.

  2. After you select a specific tag, you can view the Instances.

    The tag you select here must match the tag defined in the custom permission policy.

    On the Prometheus instance list page, click the Filter by Tag button. In the drop-down panel, select the tag key and tag value to filter the instances.