使用授予数据库权限Amazon CLI和命名资源方法 - Amazon Lake Formation
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 Amazon Web Services 服务入门

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用授予数据库权限Amazon CLI和命名资源方法

您可以通过使用 named resource 方法和Amazon Command Line Interface(Amazon CLI)。

使用授予数据库权限Amazon CLI

  • 运行grant-permissions命令,并将数据库或数据目录指定为资源,具体取决于所授予的权限。

    在以下示例中,将<account-id>使用有效的Amazon账户 ID。

    例 — 授予权限以创建数据库

    这个例子授予CREATE_DATABASE给用户datalake_user1. 由于授予此权限的资源是 Data Catalog,因此该命令指定了一个空CatalogResource结构作为resource参数。

    aws lakeformation grant-permissions --principal DataLakePrincipalIdentifier=arn:aws:iam::<account-id>:user/datalake_user1 --permissions "CREATE_DATABASE" --resource '{ "Catalog": {}}'

    例 — 授予在指定数据库中创建表的权限

    接下来的例子是补助金CREATE_TABLE在数据库上retail给用户datalake_user1.

    aws lakeformation grant-permissions --principal DataLakePrincipalIdentifier=arn:aws:iam::<account-id>:user/datalake_user1 --permissions "CREATE_TABLE" --resource '{ "Database": {"Name":"retail"}}'

    例 — 拨款给外部Amazon具有 “授予” 选项的账户

    接下来的例子是补助金CREATE_TABLE在数据库上使用 grant 选项retail转至外部账户 11-2222-33333333。

    aws lakeformation grant-permissions --principal DataLakePrincipalIdentifier=111122223333 --permissions "CREATE_TABLE" --permissions-with-grant-option "CREATE_TABLE" --resource '{ "Database": {"Name":"retail"}}'

    例 — 为组织授予补助金

    接下来的例子是补助金ALTER在数据库上使用 grant 选项issues给组织o-abcdefghijkl.

    aws lakeformation grant-permissions --principal DataLakePrincipalIdentifier=arn:aws:organizations::111122223333:organization/o-abcdefghijkl --permissions "ALTER" --permissions-with-grant-option "ALTER" --resource '{ "Database": {"Name":"issues"}}'
注意

授予后CREATE_TABLE要么ALTER对于具有指向已注册位置的 location 属性的数据库,请确保还向承担者授予该位置的数据位置权限。有关更多信息,请参阅 授予数据位置权限