本文为您介绍云连接器CC(Cloud Connector)的服务关联角色(AliyunServiceRoleForCCIoT)以及如何删除CC服务关联角色。

背景信息

服务关联角色是指与某个云服务关联的RAM角色。在某些场景下,为了完成云服务的某个功能,需要获取其他云服务的访问权限。通过服务关联角色,您可以更好地创建云服务正常操作所需的权限,避免误操作带来的风险。更多信息,请参见服务关联角色

创建服务关联角色

创建CC时,如果服务关联角色不存在,系统会自动创建一个名称为AliyunServiceRoleForCCIoT的服务关联角色,并且为该角色添加名称为AliyunServiceRolePolicyForCCIoT的权限策略,授予CC访问其他云资源的权限,策略内容如下。

{
    "Version": "1",
    "Statement": [{
            "Action": [
                "vpc:CreateVpc",
                "vpc:DescribeVpcs",
                "vpc:DeleteVpc",
                "vpc:CreateVSwitch",
                "vpc:DescribeVSwitches",
                "vpc:DeleteVSwitch",
                "vpc:DescribeRegions",
                "vpc:AllocateEipAddress",
                "vpc:ModifyEipAddressAttribute",
                "vpc:ReleaseEipAddress",
                "vpc:CreateNatGateway",
                "vpc:DescribeNatGateways",
                "vpc:DescribeSnatTableEntries",
                "vpc:DeleteSnatEntry",
                "vpc:DescribeForwardTableEntries",
                "vpc:DeleteForwardEntry",
                "vpc:DeleteNatGateway",
                "vpc:CreateSnatEntry",
                "vpc:DeleteNatGateway",
                "vpc:ModifySnatEntry",
                "vpc:AssociateEipAddress",
                "vpc:DescribeEipAddresses",
                "vpc:UnassociateEipAddress",
                "vpc:CreateCommonBandwidthPackage",
                "vpc:AddCommonBandwidthPackageIp",
                "vpc:RemoveCommonBandwidthPackageIp",
                "vpc:CreateRouteTable",
                "vpc:DescribeRouteTables",
                "vpc:DescribeRouteTableList",
                "vpc:DeleteRouteTable",
                "vpc:CreateRouteEntry",
                "vpc:DescribeRouteEntryList",
                "vpc:DeleteRouteEntry"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "ecs:CreateSecurityGroup",
                "ecs:RevokeSecurityGroup",
                "ecs:AuthorizeSecurityGroup",
                "ecs:AuthorizeSecurityGroupEgress",
                "ecs:RevokeSecurityGroupEgress",
                "ecs:DeleteSecurityGroup",
                "ecs:DescribeSecurityGroups",
                "ecs:DescribeSecurityGroupAttribute",
                "ecs:CreateSecurityGroupPermission",
                "ecs:AuthorizeSecurityGroupPermission",
                "ecs:RevokeSecurityGroupPermission",
                "ecs:JoinSecurityGroupPermission",
                "ecs:DeleteSecurityGroupPermission",
                "ecs:LeaveSecurityGroupPermission",
                "ecs:DescribeSecurityGroupPermissions",
                "ecs:JoinSecurityGroup",
                "ecs:LeaveSecurityGroup",
                "ecs:CreateNetworkInterface",
                "ecs:AttachNetworkInterface",
                "ecs:DetachNetworkInterface",
                "ecs:DeleteNetworkInterface",
                "ecs:DescribeNetworkInterfaces",
                "ecs:CreateNetworkInterfacePermission",
                "ecs:DescribeNetworkInterfacePermissions",
                "ecs:DeleteNetworkInterfacePermission",
                "ecs:AttachNetworkInterfacePermissions",
                "ecs:DetachNetworkInterfacePermissions"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": "ram:DeleteServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "uisplus.aliyuncs.com"
                }
            }
        },
        {
            "Action": "ram:CreateServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "cciot.aliyuncs.com"
                }
            }
        }
    ]
}

删除服务关联角色

如果您要删除CC服务关联角色(AliyunServiceRoleForCCIoT),请先删除CC实例。具体操作,请参见:
  1. 删除云连接器
  2. 删除服务关联角色

常见问题

为什么我的RAM用户无法自动创建CC服务关联角色(AliyunServiceRoleForCCIoT)?

您需要拥有指定的权限策略,才能自动创建或删除CC服务关联角色(AliyunServiceRoleForCCIoT)。因此,在RAM用户无法自动创建CC服务关联角色(AliyunServiceRoleForCCIoT)时,您需为其添加以下权限策略。

{
    "Statement": [
        {
            "Action": "ram:CreateServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "cciot.aliyuncs.com"
                }
            }
        }
    ],
    "Version": "1"
}