To perform operations such as managing mount targets and dataflows, a CPFS file system must access other Alibaba Cloud services, including VPC, ECS, and OSS. CPFS automatically creates service-linked roles that grant the minimum required privileges for cross-service access, which eliminates the need for manual permission configuration.
How service-linked roles work
A service-linked role is a type of RAM role whose trusted entity is an Alibaba Cloud service. CPFS uses service-linked roles to access other Alibaba Cloud services and resources, which eliminates the need to configure cross-service permissions manually.
When you perform specific operations, the system automatically creates the required service-linked role. If automatic creation fails, or if CPFS does not support automatic creation, you must create the role manually.
RAM attaches a system policy to each service-linked role. This policy cannot be modified. To view the policy details, go to the details page for the specific role.
For more information about service-linked roles, see Service-linked roles.
Service-linked roles for CPFS
CPFS uses the following four service-linked roles. The permissions of each role are scoped to its specific operations:
-
AliyunServiceRoleForNasCpfsNetwork
CPFS assumes this role to access VPC and ECS when creating or deleting an elastic network interface (ENI) or a security group.
-
AliyunServiceRoleForNasCpfsClient
CPFS assumes this role to access VPC and ECS when creating or deleting an ECS instance, a Cloud Assistant instance, authorization information, or a security group.
-
AliyunServiceRoleForNasOssDataFlow
When the dataflow feature is active, CPFS assumes this role to query, read, and write data in a specified OSS bucket.
-
AliyunServiceRoleForNasEventNotification
When the dataflow feature is active, CPFS assumes this role to create and modify parameters related to EventBridge event notifications.
For more information about service-linked roles, see Service-linked roles.
Permissions
The following permission policies are attached to CPFS service-linked roles. Each role's permissions are limited to the minimum necessary for its function.
RAM user permissions for service-linked roles
For a RAM user to create or delete a CPFS service-linked role, an administrator must grant the RAM user the AliyunNASFullAccess system policy. Alternatively, add the following permissions to the Action statement of a custom policy:
Create a service-linked role:
ram:CreateServiceLinkedRoleDelete a service-linked role:
ram:DeleteServiceLinkedRole
For more information about granting permissions, see Permissions required to manage service-linked roles.
View a service-linked role
After a service-linked role is created, you can find it on the Roles page of the RAM console by searching for its name, such as AliyunServiceRoleForNasCpfsNetwork, to view the following information:
-
Basic Information
In the Basic Information section of the role details page, you can view basic information, including the role name, creation time, role ARN, and description.
-
Permission Policy
On the Permissions tab of the role details page, click the permission policy name to view the policy document and the resources that the role can access.
-
Trust Policy
On the Trust Policy tab of the role details page, you can view the trust policy document. A trust policy describes the trusted entities that can assume the role. The trusted entity for a service-linked role is an Alibaba Cloud service, as specified in the
Servicefield of the trust policy.
For more information about how to view a service-linked role, see View the information about a RAM role.
Delete a service-linked role for CPFS
If you no longer need a CPFS service-linked role, for example, after you stop using the dataflow feature, you can delete the role. Before deleting the role, you must first delete the associated CPFS file system instances. For more information, see Delete a file system and Delete a service-linked role.
FAQ
Why can't a RAM user automatically create a service-linked role for CPFS?
A RAM user must have specific permissions to trigger the automatic creation of a service-linked role. Attach the following system policies and a custom policy to the RAM user. For more information about how to create a custom policy, see Create a custom permission policy.
-
System policies
AliyunVPCFullAccess: Permissions to manage VPC.
AliyunBSSFullAccess: Permissions to manage Billing Management.
AliyunNASFullAccess: Permissions to manage NAS.
AliyunECSNetworkInterfaceManagementAccess: Permissions to manage ECS elastic network interfaces.
-
Custom policy
To manage mount targets, you need permissions for
cpfs-network.nas.aliyuncs.comandcpfs-client.nas.aliyuncs.com.To manage dataflow, you need permissions for
oss-dataflow.nas.aliyuncs.comandevent-notification.nas.aliyuncs.com.
Example:
{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action": [ "ram:CreateServiceLinkedRole" ], "Resource": "*", "Condition": { "StringEquals": { "ram:ServiceName": [ "cpfs-network.nas.aliyuncs.com", "cpfs-client.nas.aliyuncs.com", "oss-dataflow.nas.aliyuncs.com", "event-notification.nas.aliyuncs.com" ] } } } ] }