文档

文件存储CPFS服务关联角色

更新时间:
一键部署

为了完成CPFS文件系统的某个功能,文件存储将自动创建CPFS服务关联角色获取访问云服务器ECS、专有网络VPC等云服务的权限。

背景信息

服务关联角色是一种可信实体为阿里云服务的RAM角色。文件存储CPFS使用服务关联角色获取其他云服务或云资源的访问权限。

通常情况下,服务关联角色是在您执行某项操作时,由系统自动创建。在自动创建服务关联角色失败或文件存储CPFS不支持自动创建时,您需要手动创建服务关联角色。

阿里云访问控制为每个服务关联角色提供了一个系统权限策略,该策略不支持修改。如果您想了解该系统策略的具体内容,可前往指定服务关联角色的详情页面查看。

说明

关于服务关联角色的更多信息,请参见服务关联角色

应用场景

CPFS服务关联角色的应用场景如下:

  • AliyunServiceRoleForNasCpfsNetwork

    CPFS文件系统在创建或删除弹性网卡、安全组时,需要通过AliyunServiceRoleForNasCpfsNetwork角色访问您的专有网络VPC服务与云服务器ECS服务。

  • AliyunServiceRoleForNasCpfsClient

    CPFS文件系统在创建或删除ECS、云助手、授权信息及安全组时,需要通过AliyunServiceRoleForNasCpfsClient角色访问您的专有网络VPC服务与云服务器ECS服务。

  • AliyunServiceRoleForNasOssDataFlow

    使用CPFS文件系统数据流动服务时,需要通过AliyunServiceRoleForNasOssDataFlow角色查询和读写对象存储OSS中指定Bucket的数据。

  • AliyunServiceRoleForNasEventNotification

    使用CPFS文件系统数据流动服务时,需要通过AliyunServiceRoleForNasEventNotification角色创建和修改EventBridge相关参数。

更多服务关联角色的信息,请参见服务关联角色

权限说明

CPFS服务关联角色的权限内容如下:

AliyunServiceRoleForNasCpfsNetwork

{
    "Version": "1",
    "Statement": [{
            "Action": [
                "vpc:DescribeVSwitchAttributes",
                "vpc:DescribeVpcs",
                "vpc:DescribeVSwitches"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:CreateSecurityGroup",
                "ecs:DescribeSecurityGroups",
                "ecs:CreateNetworkInterface",
                "ecs:DeleteNetworkInterface",
                "ecs:DescribeNetworkInterfaces",
                "ecs:CreateNetworkInterfacePermission",
                "ecs:DescribeNetworkInterfacePermissions",
                "ecs:DeleteNetworkInterfacePermission"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ecs:DescribeSecurityGroupAttribute",
                "ecs:DeleteSecurityGroup",
                "ecs:AuthorizeSecurityGroup",
                "ecs:AuthorizeSecurityGroupEgress",
                "ecs:RevokeSecurityGroup",
                "ecs:RevokeSecurityGroupEgress"
            ],
            "Resource": "acs:ecs:*:*:*/*",
            "Condition": {
                "StringEqualsIgnoreCase": {
                    "ecs:tag/nas:cpfs": "true"
                }
            }
        },
        {
            "Action": "ram:DeleteServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "cpfs-network.nas.aliyuncs.com"
                }
            }
        }
    ]
}
      

AliyunServiceRoleForNasCpfsClient

{
 "Version": "1",
 "Statement": [
 {
 "Action": [
 "vpc:DescribeVSwitchAttributes",
 "vpc:DescribeVpcs",
 "vpc:DescribeVSwitches"
 ],
 "Resource": "*",
 "Effect": "Allow"
 },
 {
 "Action": [
 "ecs:RunInstances",
 "ecs:CreateInstance",
 "ecs:DescribeInstances",
 "ecs:CreateSecurityGroup",
 "ecs:DescribeSecurityGroups",
 "ecs:InstallCloudAssistant",
 "ecs:DescribeInvocations"
 ],
 "Resource": "*",
 "Effect": "Allow"
 },
 {
 "Effect": "Allow",
 "Action": [
 "ecs:StartInstances",
 "ecs:DeleteInstances",
 "ecs:RunCommand",
 "ecs:DescribeSecurityGroupAttribute",
 "ecs:DeleteSecurityGroup",
 "ecs:AuthorizeSecurityGroup",
 "ecs:AuthorizeSecurityGroupEgress",
 "ecs:RevokeSecurityGroup",
 "ecs:RevokeSecurityGroupEgress"
 ],
 "Resource": "acs:ecs:*:*:*/*",
 "Condition": {
 "StringEqualsIgnoreCase": {
 "ecs:tag/nas:cpfs": "true"
 }
 }
 },
 {
 "Action": "ram:DeleteServiceLinkedRole",
 "Resource": "*",
 "Effect": "Allow",
 "Condition": {
 "StringEquals": {
 "ram:ServiceName": "cpfs-client.nas.aliyuncs.com"
 }
 }
 } 
 ]
 }
 

AliyunServiceRoleForNasOssDataFlow

{
 "Statement": [
 {
 "Effect": "Allow",
 "Action": [
 "oss:ListBuckets",
 "oss:GetBucketTagging"
 ],
 "Resource": [
 "acs:oss:*:*:*"
 ]
 },
 {
 "Effect": "Allow",
 "Action": [
 "oss:HeadBucket",
 "oss:GetBucketLocation",
 "oss:GetBucketInventory",
 "oss:GetBucketInfo",
 "oss:GetBucketVersion",
 "oss:GetBucketAcl",
 "oss:GetBucketStat",
 "oss:GetBucket",
 "oss:ListObjects",
 "oss:GetObject",
 "oss:PutObject",
 "oss:CopyObject",
 "oss:AppendObject",
 "oss:DeleteObject",
 "oss:GetObjectMeta",
 "oss:PutObjectACL",
 "oss:GetObjectACL",
 "oss:PutObjectTagging",
 "oss:GetObjectTagging",
 "oss:InitiateMultipartUpload",
 "oss:CompleteMultipartUpload",
 "oss:AbortMultipartUpload",
 "oss:ListMultipartUploads",
 "oss:UploadPart",
 "oss:UploadPartCopy",
 "oss:ListParts"
 ],
 "Resource": [
 "acs:oss:*:*:*",
 "acs:oss:*:*:*/*"
 ],
 "Condition": {
 "StringEqualsIgnoreCase": {
 "oss:tag/cpfs-dataflow": "true"
 }
 }
 },
 {
 "Action": "ram:DeleteServiceLinkedRole",
 "Resource": "*",
 "Effect": "Allow",
 "Condition": {
 "StringEquals": {
 "ram:ServiceName": "oss-dataflow.nas.aliyuncs.com"
 }
 }
 }
 ],
 "Version": "1"
}
 

AliyunServiceRoleForNasEventNotification

{
 "Statement": [
 {
 "Effect": "Allow",
 "Action": [
 "eventbridge:GetEventBus",
 "eventbridge:CreateRule"
 ],
 "Resource": [
 "acs:eventbridge:*:*:*"
 ]
 },
 {
 "Effect": "Allow",
 "Action": [
 "eventbridge:GetRule",
 "eventbridge:ListRules",
 "eventbridge:UpdateRule",
 "eventbridge:EnableRule",
 "eventbridge:DisableRule",
 "eventbridge:DeleteRule",
 "eventbridge:CreateTargets",
 "eventbridge:UpdateTargets",
 "eventbridge:DeleteTargets"
 ],
 "Resource": [
 "acs:eventbridge:*:*:*"
 ]
 },
 {
 "Action": "ram:DeleteServiceLinkedRole",
 "Resource": "*",
 "Effect": "Allow",
 "Condition": {
 "StringEquals": {
 "ram:ServiceName": "event-notification.nas.aliyuncs.com"
 }
 }
 }
 ],
 "Version": "1"
}
 

RAM用户使用服务关联角色需要的权限

如果使用RAM用户创建或删除服务关联角色,必须联系管理员为该RAM用户授予管理员权限(AliyunNASFullAccess)或在自定义权限策略的Action语句中为RAM用户添加以下权限:

  • 创建服务关联角色:ram:CreateServiceLinkedRole

  • 删除服务关联角色:ram:DeleteServiceLinkedRole

关于授权的详细操作,请参见创建和删除服务关联角色所需的权限

查看服务关联角色

当服务关联角色创建成功后,您可以在RAM控制台的角色页面,通过搜索服务关联角色名称(例如,AliyunServiceRoleForNasStandard)查看该服务关联角色的以下信息:

  • 基本信息

    在AliyunServiceRoleForNasStandard角色详情页面的基本信息区域,查看角色基本信息,包括角色名称、创建时间、角色ARN和备注等。

  • 权限策略

    在AliyunServiceRoleForNasStandard角色详情页面的权限管理页签,单击权限策略名称,查看权限策略内容以及该角色可授权访问哪些云资源。

  • 信任策略

    在AliyunServiceRoleForNasStandard角色详情页的信任策略页签,查看信任策略内容。信任策略是描述RAM角色可信实体的策略,可信实体是指可以扮演RAM角色的实体用户身份。服务关联角色的可信实体为云服务,您可以通过信任策略中的Service字段查看。

关于如何查看服务关联角色的详细操作,请参见查看RAM角色

删除CPFS服务关联角色

如果您暂时不需要使用CPFS服务关联角色,例如不再使用CPFS文件系统的数据流动功能时,可以删除CPFS服务关联角色。删除时,请先删除该角色关联的CPFS文件系统实例。具体操作,请参见创建文件系统删除服务关联角色

常见问题

为什么RAM用户无法自动创建CPFS服务关联角色?

RAM用户需要拥有指定的权限,才能自动创建或删除CPFS服务关联角色。因此,在RAM用户无法自动创建CPFS服务关联角色时,您需要为其添加以下系统策略和自定义策略。具体操作,请参见创建自定义权限策略

  • 系统策略

    • AliyunVPCFullAccess:管理专有网络VPC的权限。

    • AliyunBSSFullAccess:管理费用中心BSS的权限。

    • AliyunNASFullAccess:管理文件存储NAS的权限。

    • AliyunECSNetworkInterfaceManagementAccess:管理ECS弹性网卡的权限。

  • 自定义策略

    • 管理挂载点,需要cpfs-network.nas.aliyuncs.comcpfs-client.nas.aliyuncs.com权限。

    • 管理数据流动,需要oss-dataflow.nas.aliyuncs.comevent-notification.nas.aliyuncs.com权限。

    示例如下:

    {
      "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" 
             ]
            }
          }
        }
      ]
    }