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:
-
AuthorizedActionslistsSELECT, the action that the role can perform. -
SelectActionDetailsdescribes howSELECTaccess is limited.AuthorizedColumnslists 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. -
RowFiltershows the filter expression that limits the rows. -
ContributingGrantslists the grant that provided the access. -
ContributingRLSPolicieslists the RLS policy that filters the rows.