Analyzing access with the AWS CLI - AWS Lake Formation
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

Analyzing access with the AWS CLI

The following AWS CLI command analyzes the access of the role analyst to the table sales_db.orders.

aws lakeformation analyze-access \ --principal DataLakePrincipalIdentifier=arn:aws:iam::111122223333:role/analyst \ --resource '{"Table": {"CatalogId": "111122223333", "DatabaseName": "sales_db", "Name": "orders"}}'

In this example, the role has SELECT on the columns region and user_id. The role also has the RLS policy us-east-only (region = 'us-east-1') on the table. The response is as follows:

{ "AccessDecision": { "Principal": { "DataLakePrincipalIdentifier": "arn:aws:iam::111122223333:role/analyst" }, "AuthorizedActions": ["SELECT"], "SelectActionDetails": { "AuthorizedColumns": ["region", "user_id"], "RowFilter": { "FilterExpression": "region = 'us-east-1'" } }, "ContributingGrants": [{ "Principal": { "DataLakePrincipalIdentifier": "arn:aws:iam::111122223333:role/analyst" }, "Resource": { "TableWithColumns": { "CatalogId": "111122223333", "DatabaseName": "sales_db", "Name": "orders", "ColumnNames": ["region", "user_id"] } }, "Actions": ["SELECT"], "IssuingSource": "Explicitly Granted" }], "ContributingRLSPolicies": [{ "Principal": { "DataLakePrincipalIdentifier": "arn:aws:iam::111122223333:role/analyst" }, "Resource": { "Table": { "CatalogId": "111122223333", "DatabaseName": "sales_db", "Name": "orders" } }, "PolicyName": "us-east-only", "IssuingSource": "Explicitly Attached" }] } }

For the complete response syntax, see AnalyzeAccess in the Lake Formation API Reference.

The response shows the following:

  • AuthorizedActions lists SELECT, the action that the role can perform.

  • SelectActionDetails describes how SELECT access is limited. AuthorizedColumns lists the columns that the role can read. It appears only when the role has access to some, but not all, of the table's columns.

  • RowFilter shows the filter expression that limits the rows.

  • ContributingGrants lists the grant that provided the access.

  • ContributingRLSPolicies lists the RLS policy that filters the rows.