本文為您介紹云連接器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"
}