Creating a resource link to a shared Data Catalog table
You can create a resource link to a shared table in any Amazon Region by using the Amazon Lake Formation console, API, or Amazon Command Line Interface (Amazon CLI).
To create a resource link to a shared table (console)
-
Open the Amazon Lake Formation console at https://console.amazonaws.cn/lakeformation/
. Sign in as a principal who has the Lake Formation CREATE_TABLE
permission on the database to contain the resource link. -
In the navigation pane, choose Tables, and then choose Create, Resource link.
-
On the Create resource link page, provide the following information:
- Resource link name
-
Enter a name that adheres to the same rules as a table name. The name can be the same as the target shared table.
- Database
-
The database in the local Data Catalog to contain the resource link.
- Shared table owner Region
-
If you are creating the resource link in a different Region, select the region of the target shared table.
- Shared table
-
Select a shared table from the list, or enter a local (owned) or shared table name.
The list contains all the tables shared with your account. Note the database and owner account ID that are listed with each table. If you don't see a table that you know was shared with your account, check the following:
-
If you aren't a data lake administrator, check that the data lake administrator granted you Lake Formation permissions on the table.
-
If you are a data lake administrator, and your account is not in the same Amazon organization as the granting account, ensure that you have accepted the Amazon Resource Access Manager (Amazon RAM) resource share invitation for the table. For more information, see Accepting a resource share invitation from Amazon RAM.
-
- Shared table's database
-
If you selected a shared table from the list, this field is populated with the shared table's database in the external account. Otherwise, enter a local database (for a resource link to a local table) or the shared table's database in the external account.
- Shared table owner
-
If you selected a shared table from the list, this field is populated with the shared table's owner account ID. Otherwise, enter your Amazon account ID (for a resource link to a local table) or the ID of the Amazon account that shared the table.
-
Choose Create to create the resource link.
You can then view the resource link name under the Name column on the Tables page.
-
(Optional) Grant the Lake Formation
DESCRIBE
permission on the resource link to principals that must be able to view the link and access the target table.However, granting permissions on a resource link doesn't grant permissions on the target (linked) database or table. You must grant permissions on the target database separately for the table/resource link to be visible in Athena.
To create a resource link to a shared table in the same Region (Amazon CLI)
-
Enter a command similar to the following.
aws glue create-table --database-name myissues --table-input '{"Name":"my_customers","TargetTable":{"CatalogId":"111122223333","DatabaseName":"issues","Name":"customers"}}'
This command creates a resource link named
my_customers
to the shared tablecustomers
, which is in the databaseissues
in the Amazon account 1111-2222-3333. The resource link is stored in the local databasemyissues
. -
(Optional) Grant the Lake Formation
DESCRIBE
permission on the resource link to principals that must be able to view the link and access the target table.However, granting permissions on a resource link doesn't grant permissions on the target (linked) table. You must grant permissions on the target database separately for the table/resource link to be visible in Athena.
To create a resource link to a shared table in a different Region (Amazon CLI)
-
Enter a command similar to the following.
aws glue create-table --region eu-west-1 --cli-input-json '{ "CatalogId": "111122223333", "DatabaseName": "ireland_db", "TableInput": { "Name": "rl_useast1salestb_ireland", "TargetTable": { "CatalogId": "444455556666", "DatabaseName": "useast1_salesdb", "Region": "us-east-1", "Name":"useast1_salestb" } } }‘
This command creates a resource link named
rl_useast1salestb_ireland
in the Europe (Ireland) Region to the shared tableuseast1_salestb
, which is in the databaseuseast1_salesdb
in the Amazon account 444455556666 in the US East (N. Virginia) Region. The resource link is stored in the local databaseireland_db
. -
Grant the Lake Formation
DESCRIBE
permission to principals that must be able to view the link and access the link target through the link.However, granting permissions on a resource link doesn't grant permissions on the target (linked) table. You must grant permissions on the target table separately for the table/resource link to be visible in Athena.