You can use Resource Access Management (RAM) to grant different permissions to different
RAM users as required. Only RAM users that are granted required permissions can manage
resources in the Function Compute console. You can also prevent security risks caused
by exposing the AccessKey pair of the Alibaba Cloud account. This topic describes
how to grant permissions to a RAM user by using an Alibaba Cloud account.
Scenario
Enterprise A has activated Function Compute and requires employees to manage Function
Compute resources, such as creating and deleting services and functions. Employees
with different roles require different permissions. Enterprise A has the following
requirements:
- For security reasons, Enterprise A does not want to disclose the AccessKey pair of
its Alibaba Cloud account to the employees. Instead, Enterprise A wants to create
different RAM users for the employees and grant different permissions to the RAM users.
- A RAM user can manage resources only under authorization. Resource usage and costs
are not separately calculated for the RAM user. All expenses are billed to the Alibaba
Cloud account of Enterprise A.
- Enterprise A can revoke the permissions granted to RAM users and delete RAM users
at any time.
Procedure
- Use the Alibaba Cloud account of Enterprise A to log on to the RAM console and create
a RAM user.
- Log on to the RAM console by using the Alibaba Cloud account.
- In the left-side navigation pane, choose .
- On the Users page, click Create User.
- On the Create User page, set the Logon Name and Display Name parameters in the User Account Information section.
Note You can click Add User to create multiple RAM users at a time.
- In the Access Mode section, select an access mode.
- Console Access: Set the Console Password, Password Reset, and Multi-factor Authentication parameters.
- Programmatic Access: If you select this access mode, an AccessKey pair is automatically created for the
RAM user. The RAM user can call API operations or use other development tools to access
Alibaba Cloud resources.
Note To ensure the security of the Alibaba Cloud account, we recommend that you select
only one access mode for the RAM user. This prevents the RAM user from using an AccessKey
pair to access Alibaba Cloud resources after the RAM user leaves the organization.
- Click OK.
- Grant permissions to the RAM user.
- In the left-side navigation pane, choose .
- On the Users page, find the RAM user to which you want to grant permissions and click Add Permissions in the Actions column.
- In the Add Permissions panel, grant permissions to the RAM user.
- Select the authorization scope.
- Alibaba Cloud Account: The authorization takes effect on the current Alibaba Cloud account.
- Specific Resource Group: The authorization takes effect on a specific resource group.
- Specify the principal.
The principal is the RAM user to which you want to grant permissions. By default,
the current RAM user is specified. You can also specify another RAM user.
- Select policies.
Attach policies to the RAM user as required.
- System policies: the policies that are created by Alibaba Cloud. You can use these policies, but
cannot modify them. Alibaba Cloud maintains the version updates of the policies.
For example, if the RAM user requires the permissions to manage Function Compute,
you can perform the following steps to attach the required policy to the RAM user:
- On the System Policy tab, enter AliyunFCFullAccess in the Enter a policy name field.
- Click AliyunFCFullAccess in the Authorization Policy Name column. Then, click OK.
- Custom policies: the policies that you can create, update, and delete. You maintain the version updates
of these policies.
For example, if the RAM user requires the permissions to create and query services
in Function Compute and create and invoke functions, you can perform the following
steps to attach a custom policy to the RAM user:
- Create a policy.
- In the left-side navigation pane, choose .
- On the Policies page, click Create Policy.
- On the Create Custom Policy page, set the parameters. For more information, see Policies and sample custom policies.
The following part describes the parameters:
- Policy Name: Enter a custom policy name.
- Configuration Mode: Select Script. The following policy can be used to grant the permissions to create and query services
in Function Compute and create and invoke functions:
{
"Version": "1",
"Statement": [
{
"Action": [
"fc:CreateService",
"fc:GetService",
"fc:CreateFunction",
"fc:GetFunction",
"fc:InvokeFunction",
"fc:ListServices",
"fc:ListFunctions",
"fc:ListServiceVersions",
"fc:GetResourceTags",
"fc:ListServiceVersions",
"fc:ListAliases",
"fc:ListTriggers",
"fc:GetFunctionAsyncInvokeConfig"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
- Click OK.
- Attach the policy.
- In the left-side navigation pane, click Users.
- On the Users page, find the RAM user to which you want to attach the policy and click Add Permissions in the Actions column.
- In the Select Policy section of the Add Permissions panel, click the Custom Policy tab.
- On the Custom Policy tab, click the name of the policy in the Authorization Policy Name column.
- Click OK.
Note You can attach a maximum of five policies to a RAM user at a time. If you need to
attach more than five policies to a RAM user, attach the policies in batches.
- Click Complete.
What to do next
After the RAM user is created by using the Alibaba Cloud account, Enterprise A can
allocate the logon name and password or AccessKey pair of the RAM user to an employee.
The employee can use the RAM user to log on to the console or call an API operation
of the service by performing the following steps: