Create a custom policy
You can create custom policies to grant precise permissions beyond what system policies offer.
Creation methods
-
Create a custom policy by using the visual editor
Configure permissions in a WYSIWYG visual editor with built-in validation.
-
Create a custom policy by using the JSON editor
Write a custom policy in JSON. Ideal for users familiar with policy syntax.
-
Create a custom policy by importing a policy
-
Import a policy template: Start from built-in templates for common roles (system administrator, financial staff, network administrator) and customize them.
-
Import a system policy: Import and modify an existing system policy.
-
Use the visual editor
-
Sign in to the RAM console as a RAM administrator.
-
In the left-side navigation pane, choose .
-
On the Policies page, click Create Policy.

-
On the Create Policy page, click the Visual Editor tab.

-
Configure the permission policy.
Learn about the effect, action, resource, and condition elements in Basic elements of a permission policy.
-
In the Effect section, select Allow or Deny.
-
In the Service section, select a cloud service.
NoteThe visual editor supports only the cloud services listed in the console.
-
In the Action section, select All action(s) or Select action(s).
Actions are filtered by the selected cloud service. If you select Select action(s), select individual actions.
-
In the Resources section, select All Resources or Specified resource(s).
Resource types are filtered by the selected actions. If you select Specified resource(s), click Add Resource to specify resource ARNs. Use Match All to select all resources for a resource type.
NoteResource ARNs required by the selected actions are marked Required. Configure these ARNs to restrict the scope of permissions.
-
In the Condition section, click Add Condition to configure conditions.
Alibaba Cloud conditions and service-specific conditions are filtered by the selected cloud service and actions. Select a condition key and set its value.
-
Click Add Statement and repeat the steps above to configure multiple policy statements.
-
-
At the top of the page, click Optimize, and then click Perform to optimize the policy.
This feature:
-
Splits resources or conditions for incompatible actions
-
Reduces resource scope for greater precision
-
Removes duplicate statements or merges statements
-
-
On the Create Policy page, click OK.
-
In the Create Policy dialog box, enter a policy name and Description, then click OK.
Use the JSON editor
-
Sign in to the RAM console as a RAM administrator.
-
In the left-side navigation pane, choose .
-
On the Policies page, click Create Policy.

-
On the Create Policy page, click the JSON Editor tab.

-
Enter the policy content.
Write the policy in JSON format following Policy syntax and structure.
-
At the top of the page, click Optimize, and then click Perform to optimize the policy.
This feature:
-
Splits resources or conditions for incompatible actions
-
Reduces resource scope for greater precision
-
Removes duplicate statements or merges statements
-
-
On the Create Policy page, click OK.
-
In the Create Policy dialog box, enter a policy name and Description, then click OK.
Import a policy
-
Sign in to the RAM console as a RAM administrator.
-
In the left-side navigation pane, choose .
-
On the Policies page, click Create Policy.

-
On the Create Policy page, click Import Policy.

-
In the upper-right corner of the Import Policy dialog box, select policy template or System Policy from the drop-down list, and then import a policy.

-
Select a policy template or system policy.
-
For some policy templates, you must configure parameters to meet your business requirements.
-
Select an import rule for the new policy.
By default, imported content overwrites existing content. Select Do not overwrite. Append the new statement to the end. to append instead.
-
Click Import.
-
-
In the visual editor or JSON editor, review and modify the imported content.
-
At the top of the page, click Optimize, and then click Perform to optimize the policy.
This feature:
-
Splits resources or conditions for incompatible actions
-
Reduces resource scope for greater precision
-
Removes duplicate statements or merges statements
-
-
On the Create Policy page, click OK.
-
In the Create Policy dialog box, enter a policy name and Description, then click OK.

