Updated on 2024-04-08 GMT+08:00

Creating a Custom Policy

You can create custom policies to supplement system-defined policies and implement more refined access control.

Creating a Custom Policy in the Visual Editor

  1. On the IAM console, choose Policies in the navigation pane, and click Create Custom Policy.
  2. Enter a policy name.
  3. Select Visual editor.
  4. Set the policy content.

    1. Select Allow or Deny.
    2. Select a cloud service.

      Only one cloud service can be selected for each permission block. To configure permissions for multiple cloud services, click Add Permissions or switch to the JSON view.

    3. Select actions.
    4. Select all resources, or select specific resources by specifying their paths.
    5. (Optional) Add request conditions by specifying condition keys, operators, and values.
      Table 1 Condition parameters

      Name

      Description

      Condition Key

      A key in the Condition element of a statement. There are global and service-level condition keys. Global condition keys (starting with g:) are available for operations of all services, while service-level condition keys (starting with a service abbreviation name such as obs:) are available only for operations of the corresponding service.

      Operator

      Used together with a condition key to form a complete condition statement.

      Value

      Used together with a condition key and an operator that requires a keyword, to form a complete condition statement.

  5. (Optional) Switch to the JSON view and modify the policy content in the JSON format.

    If the policy content is incorrect after modification, check and modify the content, or click Reset to cancel the modifications.

  6. (Optional) To add another permission block for the policy, click Add Permissions. Alternatively, click the plus (+) icon on the right of an existing permission block to clone its permissions.
  7. (Optional) Enter a brief description for the policy.
  8. Click OK.
  9. Attach the policy to a user group. Users in the group then inherit the permissions defined in the policy.

Creating a Custom Policy in JSON View

  1. On the IAM console, choose Policies in the navigation pane, and click Create Custom Policy.
  2. Enter a policy name.
  3. Select JSON.
  4. (Optional) Click Select Existing Policy, and select a policy to use it as a template, such as VPC Admin.
  5. Click OK.
  6. Modify the statement in the template.

    • Effect: Set it to Allow or Deny.
    • Action: Enter the actions provided in the API actions table of the EVS service, for example, evs:volumes:create.
      • The version of each custom policy is fixed at 1.1.

  7. (Optional) Enter a brief description for the policy.
  8. Click OK. If the policy list is displayed, the policy is created successfully.
  9. Attach the policy to a user group. Users in the group then inherit the permissions defined in the policy.