The permission assistant of Function Compute simplifies the process of creating permission policies. This helps you create permission policies and attach the policies to RAM users as needed. This topic describes how to create a permission policy in the Function Compute console and then create and attach a custom policy to a RAM user in the Resource Access Management (RAM) console.
Background information
The permission assistant can be used to create permission policies. You can use the permission assistant to manage permissions on Function Compute in a visualized way and generate the corresponding policy syntax in the Function Compute console. Then, you can create a custom policy in the RAM console by replacing the policy syntax with the one generated in the Function Compute console. After that, you can attach the custom policy to the RAM user as needed.
Usage notes
- If Function Compute releases a new feature, you must generate the policy syntax again and modify the syntax of the custom policy that is attached to a RAM user in the RAM console. Otherwise, the RAM user does not have the permissions to use the new feature of Function Compute.
- The permission assistant can be used to manage permissions on Function Compute resources by service, function, layer, and domain name. If you want to grant fine-grained permissions on Function Compute resources or permissions to access other Alibaba Cloud services to RAM users, see Create a custom policy.
Prerequisites
- RAM
- Function Compute
Step 1: Create a permission policy in the Function Compute console
- Log on to the Function Compute console.
- In the left-side navigation pane, choose .
- On the Permission Assistant page, click Create Policy.
- In the Configure Policy step of the Create Policy wizard, set the parameters and click Next.
- In the Preview Policy step, check the generated rules and click Next.
In the Policy section, you can click Compress, Format, or Copy to manage the generated policy syntax as needed. The copied policy syntax is used to create a custom policy in the RAM console. For more information, see Step 2: Create a custom policy in the RAM console.
- In the Apply to RAM step, read the instructions on how to create a custom policy in the RAM console, and click Completed.
Step 2: Create a custom policy in the RAM console
When you create a custom policy in the RAM console, you must use the policy syntax that you copy in the Function Compute console. For more information, see Step 1: Create a permission policy in the Function Compute console.
- Log on to the RAM console by using your Alibaba Cloud account.
- In the left-side navigation pane, choose .
- On the Policies page, click Create Policy.
- On the Create Policy page, click the JSON tab.
- Enter the policy document and click Next to edit policy information.
For more information about the syntax and structure of policies, see Policy structure and syntax.
- Specify the Name and Description fields.
- Check and optimize the document of the custom policy.
- Basic optimization
The system automatically optimizes the policy statement. The system performs the following operations during basic optimization:
- Deletes unnecessary conditions.
- Deletes unnecessary arrays.
- Optional:Advanced optimization
You can move the pointer over Optional advanced optimize and click Perform. The system performs the following operations during the advanced optimization:
- Splits resources or conditions that are incompatible with actions.
- Narrows down resources.
- Deduplicates or merges policy statements.
- Basic optimization
- Click OK.
Step 3: Attach the custom policy to a RAM user in the RAM console
After you create a custom policy, you can attach the policy to a RAM user based on your business requirements in the RAM console. This section describes how to attach a custom policy to a RAM user on the Grants page in the RAM console. For more information, see Grant permissions to the RAM user.
- Log on to the RAM console by using your Alibaba Cloud account.
- In the left-side navigation pane, choose .
- On the Grants page, click Grant Permission.
- On the Grant Permission page, grant permissions to a RAM user.
- Click OK.
- Click Complete.
References
In addition to the Function Compute console, you can use the permission assistant by calling API operations or by using SDKs. For more information, see SDKs.