Use resource groups to restrict project visibility
Use resource groups to control which Simple Log Service projects a RAM user can view in the console.
Background information
In the Simple Log Service console, the project list is retrieved by calling the ListProject OpenAPI operation. If a user has the ListProject permission, the console displays all projects within the account by default. To let RAM users see only specific projects and hide the rest, use resource group-based authorization.
RAM permission policies support two authorization methods: account-level and resource group-based.
-
Account-level authorization: Grants RAM users permissions on specific resources through attached policies. However, this method does not restrict project visibility in the Simple Log Service console. For more information, see Custom policies for Simple Log Service.
-
Resource group-based authorization: Every Alibaba Cloud account includes a default resource group, and you can create custom ones. By moving resources that support resource groups, such as Simple Log Service projects, to a specific resource group and scoping permissions to that group, you restrict RAM users to viewing and managing only the resources within it.
Prerequisites
A RAM user has been created. For more information, see Create a RAM user.
Step 1: Create a resource group
Create a resource group by using an Alibaba Cloud account or a RAM identity (RAM user or RAM role) that has the required permissions. For more information, see Use resource groups.
For more information, see Create a resource group.
Step 2: Add a project to the resource group
Add the target project to a resource group, or move it from one resource group to another.
For more information, see Select a resource group.
Step 3: Create a policy for project visibility
-
Log on to the RAM console by using your Alibaba Cloud account or a RAM user who has administrative rights.
-
Create a custom policy. On the JSON tab of the Create Policy page, replace the existing script in the code editor with the following policy document. For more information, see Using the script editor.
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": "log:*", "Resource": "acs:log:*:*:project/*" } ] }
Step 4: Grant permissions to the RAM user
For more information, see Grant permissions to a RAM user.
Step 5: View the specified projects
-
Log on to the Simple Log Service console as the RAM user.
-
At the top of the page, select the resource group that you were granted access to in Step 4. The console displays only the projects within that resource group.