Step 1: Provide fine-grained access to another account
Learn how a data lake administrator of Account A provides fine-grained access for Account B.
Grant fine-grained access to another account
Sign into Amazon Web Services Management Console at https://console.amazonaws.cn/connect/
in Account A as a data lake administrator. Open the Lake Formation console (https://console.amazonaws.cn/lakeformation/
), and choose Get started. in the navigation pane, choose Databases.
Choose Create database.
In the Database details section, select Database.
For Name, enter a name (for this tutorial, we use
sampledb01
).Make sure that Use only IAM access control for new tables in this database is not selected. Leaving this unselected allows us to control access from Lake Formation.
Choose Create database.
On the Databases page, choose your database
sampledb01
.On the Actions menu, choose Grant.
In the Grant permissions section, select External account.
For Amazon Web Services account ID or Amazon organization ID, enter the account ID for Account B in OU2.
For Table, choose the table you want Account B to have access to (for this post, we use table
acc_a_area
). Optionally, you can grant access to columns within the table, which we do in this post.For Include columns¸ choose the columns you want Account B to have access to (for this post, we grant permissions to type, name, and identifiers).
For Columns, choose Include columns.
For Table permissions, select Select.
For Grantable permissions, select Select. Grantable permissions are required so admin users in Account B can grant permissions to other users in Account B.
Choose Grant.
In the navigation pane, choose Tables.
You could see one active connection in the Amazon Web Services accounts and Amazon organizations with access section.
Create a resource link
Integrated services like Amazon Athena can not directly access databases or tables across accounts.
Hence, you need to create a resource link so that Athena can access resource links in your account to databases and tables in other accounts.
Create a resource link to the table (acc_a_area
) so Account B users can query its data with Athena.
Sign into the Amazon console at https://console.amazonaws.cn/connect/
in Account B as testuser1
.On the Lake Formation console (https://console.amazonaws.cn/lakeformation/
), in the navigation pane, choose Tables. You should see the tables that Account A has provided access. Choose the table
acc_a_area
.On the Actions menu, choose Create resource link.
For Resource link name, enter a name (for this tutorial,
acc_a_area_rl
).For Database, choose your database (
testdb
).Choose Create.
In the navigation pane, choose Tables.
Choose the table
acc_b_area_rl
.On the Actions menu, choose View data.
You are redirected to the Athena console, where you should see the database and table.
You can now run a query on the table to see the column value for which access was provided to testuser1 from Account B.