湖仓构建 LakeFormation-创建LakeFormation自定义IAM策略:LakeFormation自定义策略样例

时间:2023-11-01 16:20:26

LakeFormation自定义策略样例

  • 示例1:授权用户批量LakeFormation只读权限
    {    "Version": "1.1",    "Statement": [        {            "Effect": "Allow",            "Action": [                "lakeformation:instance:describe",                "lakeformation:role:describe",                "lakeformation:policy:export",                "lakeformation:group:describe",                "lakeformation:function:describe",                "lakeformation:catalog:describe",                "lakeformation:policy:describe",                "lakeformation:table:describe",                "lakeformation:database:describe"            ]        }    ]}
  • 示例2:拒绝用户删除数据

    拒绝策略需要同时配合其他策略使用,否则没有实际作用。用户被授予的策略中,一个授权项的作用如果同时存在Allow和Deny,则遵循Deny优先原则

    如果您给用户授予Admin的系统策略,但不希望用户拥有删除LakeFormation的Catalog、数据库、表的权限,您可以创建一条拒绝删除云服务的自定义策略,然后同时将Admin和拒绝策略授予用户,根据Deny优先原则,则用户可以对LakeFormation执行除了删除Catalog、数据库、表外的所有操作。

    拒绝策略示例如下:

    {    "Version": "1.1",    "Statement": [        {            "Effect": "Deny",            "Action": [                "lakeformation:database:drop",                "lakeformation:table:drop",                "lakeformation:catalog:drop"            ]        }    ]}
  • 示例3:多个云服务同时授权项策略
    {    "Version": "1.1",    "Statement": [        {            "Effect": "Allow",            "Action": [                "obs:bucket:CreateBucket"            ]        },        {            "Effect": "Allow",            "Action": [                "lakeformation:table:create",                "lakeformation:database:create",                "lakeformation:catalog:create"            ]        }    ]}
support.huaweicloud.com/usermanual-lakeformation/lakeformation_03_00005.html