代码之家  ›  专栏  ›  技术社区  ›  Eugene Brown

IAM仅对雅典娜上一个数据库的createtable权限

  •  2
  • Eugene Brown  · 技术社区  · 7 年前

    我有一个我想授予的团体 CreateTable 对雅典娜中一个数据库的权限,同时应用较小的权限,如 RunQuery 在同一组的所有数据库上。是否可以根据具体情况对雅典娜数据库应用权限?

    例如,在下面的IAM策略中,我想让这个组能够在测试数据库中创建和删除表。

    来自 AWS documentation 以下内容:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "athena:RunQuery",
                    "athena:StartQueryExecution",
                    "athena:StopQueryExecution"
                ],
                "Resource": [
                    "*"  // Apply these permissions on all schemas
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "glue:CreateTable",
                    "glue:DeleteTable"
                ],
                "Resource": [
                    "test"   // Apply these permissions to only the test database
                ]
            }
        ]
    }
    

    谢谢!

    1 回复  |  直到 6 年前
        1
  •  1
  •   Theo    6 年前

    在您提出此问题时,无法授予特定数据库和表的权限,但现在是。

    权限需要在三个级别上授予:目录、数据库和表(对于表权限,数据库权限只需要先授予两个)。

    下面是一个示例,说明如何授予对数据库中名为 my_db 在美国东部-1的账户1234567890中:

     {
      "Effect": "Allow",
      "Action": [
        "glue:CreateTable",
        "glue:UpdateTable",
        "glue:DeleteTable"
      ],
      "Resource": [
        "arn:aws:glue:us-east-1:1234567890:catalog",
        "arn:aws:glue:us-east-1:1234567890:database/my_db",
        "arn:aws:glue:us-east-1:1234567890:table/my_db/*"
      ]
    }
    

    可以对数据库名称或部分数据库名称使用通配符(例如,如果要授予具有特定前缀的所有数据库某些权限),也可以对表名称使用通配符。