MAPREDUCE服务 MRS-创建MRS IAM自定义权限策略:MRS自定义策略样例

时间:2024-08-18 05:11:16

MRS 自定义策略样例

  • 示例1:授权用户仅有创建MRS集群的权限。
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "mrs:cluster:create",
                    "ecs:*:*",
                    "bms:*:*",
                    "evs:*:*",
                    "vpc:*:*",
                    "smn:*:*"
                ]
            }
        ]
    }
  • 示例2:授权用户具有调整MRS集群的权限。
    { 
        "Version": "1.1", 
        "Statement": [ 
            { 
                "Effect": "Allow", 
                "Action": [ 
                    "mrs:cluster:resize" 
                ] 
            } 
        ] 
    }
  • 示例3:授权用户创建集群、创建并执行作业、删除单个作业,但不允许用户删除集群的权限。
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "mrs:cluster:create",
                    "mrs:job:submit",
                    "mrs:job:delete"
                ]
            },
            {
                "Effect": "Deny",
                "Action": [
                    "mrs:cluster:delete"
                ]
            }
        ]
    }
  • 示例4:授权用户最小权限,创建E CS 规格的MRS集群。
    • 创建集群时如果使用密钥对,需增加权限“ecs:serverKeypairs:get”“ecs:serverKeypairs:list”
    • 创集群时使用数据盘加密,需增加权限“kms:cmk:list”
    • 创建集群时开启告警功能,需增加权限“mrs:alarm:subscribe”
    • 创建集群时使用外置数据源,需增加权限“rds:instance:list”
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "mrs:cluster:create"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "ecs:cloudServers:updateMetadata",
                    "ecs:cloudServerFlavors:get",
                    "ecs:cloudServerQuotas:get",
                    "ecs:servers:list",
                    "ecs:servers:get",
                    "ecs:cloudServers:delete",
                    "ecs:cloudServers:list",
                    "ecs:serverInterfaces:get",
                    "ecs:serverGroups:manage",
                    "ecs:servers:setMetadata",
                    "ecs:cloudServers:get",
                    "ecs:cloudServers:create"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "vpc:securityGroups:create",
                    "vpc:securityGroupRules:delete",
                    "vpc:vpcs:create",
                    "vpc:ports:create",
                    "vpc:securityGroups:get",
                    "vpc:subnets:create",
                    "vpc:privateIps:delete",
                    "vpc:quotas:list",
                    "vpc:networks:get",
                    "vpc:publicIps:list",
                    "vpc:securityGroups:delete",
                    "vpc:securityGroupRules:create",
                    "vpc:privateIps:create",
                    "vpc:ports:get",
                    "vpc:ports:delete",
                    "vpc:publicIps:update",
                    "vpc:subnets:get",
                    "vpc:publicIps:get",
                    "vpc:ports:update",
                    "vpc:vpcs:list"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "evs:quotas:get",
                    "evs:types:get"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "bms:serverFlavors:get"
                ]
            }
        ]
    }
  • 示例5:授权用户最小权限,创建BMS规格的MRS集群。
    • 创建集群时如果使用密钥对,需增加权限“ecs:serverKeypairs:get”“ecs:serverKeypairs:list”
    • 创集群时使用数据盘加密,需增加权限“kms:cmk:list”
    • 创建集群时开启告警功能,需增加权限“mrs:alarm:subscribe”
    • 创建集群时使用外置数据源,需增加权限“rds:instance:list”
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "mrs:cluster:create"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "ecs:servers:list",
                    "ecs:servers:get",
                    "ecs:cloudServers:delete",
                    "ecs:serverInterfaces:get",
                    "ecs:serverGroups:manage",
                    "ecs:servers:setMetadata",
                    "ecs:cloudServers:create",
                    "ecs:cloudServerFlavors:get",
                    "ecs:cloudServerQuotas:get"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "vpc:securityGroups:create",
                    "vpc:securityGroupRules:delete",
                    "vpc:vpcs:create",
                    "vpc:ports:create",
                    "vpc:securityGroups:get",
                    "vpc:subnets:create",
                    "vpc:privateIps:delete",
                    "vpc:quotas:list",
                    "vpc:networks:get",
                    "vpc:publicIps:list",
                    "vpc:securityGroups:delete",
                    "vpc:securityGroupRules:create",
                    "vpc:privateIps:create",
                    "vpc:ports:get",
                    "vpc:ports:delete",
                    "vpc:publicIps:update",
                    "vpc:subnets:get",
                    "vpc:publicIps:get",
                    "vpc:ports:update",
                    "vpc:vpcs:list"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "evs:quotas:get",
                    "evs:types:get"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "bms:servers:get",
                    "bms:servers:list",
                    "bms:serverQuotas:get",
                    "bms:servers:updateMetadata",
                    "bms:serverFlavors:get"
                ]
            }
        ]
    }
  • 示例6:授权用户最小权限,创建ECS和BMS混合集群。
    • 创建集群时如果使用密钥对,需增加权限“ecs:serverKeypairs:get”“ecs:serverKeypairs:list”
    • 创集群时使用数据盘加密,需增加权限“kms:cmk:list”
    • 创建集群时开启告警功能,需增加权限“mrs:alarm:subscribe”
    • 创建集群时使用外置数据源,需增加权限“rds:instance:list”
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "mrs:cluster:create"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "ecs:cloudServers:updateMetadata",
                    "ecs:cloudServerFlavors:get",
                    "ecs:cloudServerQuotas:get",
                    "ecs:servers:list",
                    "ecs:servers:get",
                    "ecs:cloudServers:delete",
                    "ecs:cloudServers:list",
                    "ecs:serverInterfaces:get",
                    "ecs:serverGroups:manage",
                    "ecs:servers:setMetadata",
                    "ecs:cloudServers:get",
                    "ecs:cloudServers:create"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "vpc:securityGroups:create",
                    "vpc:securityGroupRules:delete",
                    "vpc:vpcs:create",
                    "vpc:ports:create",
                    "vpc:securityGroups:get",
                    "vpc:subnets:create",
                    "vpc:privateIps:delete",
                    "vpc:quotas:list",
                    "vpc:networks:get",
                    "vpc:publicIps:list",
                    "vpc:securityGroups:delete",
                    "vpc:securityGroupRules:create",
                    "vpc:privateIps:create",
                    "vpc:ports:get",
                    "vpc:ports:delete",
                    "vpc:publicIps:update",
                    "vpc:subnets:get",
                    "vpc:publicIps:get",
                    "vpc:ports:update",
                    "vpc:vpcs:list"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "evs:quotas:get",
                    "evs:types:get"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "bms:servers:get",
                    "bms:servers:list",
                    "bms:serverQuotas:get",
                    "bms:servers:updateMetadata",
                    "bms:serverFlavors:get"
                ]
            }
        ]
    }
support.huaweicloud.com/usermanual-mrs/mrs_01_0455.html