Assigning LF-Tags to Data Catalog resources
You can assign LF-Tags to Data Catalog resources (databases, tables, and columns) to control access to those resources. Only principals that are granted matching LF-Tags (and principals that are granted access with the named resource method) can access the resources.
If a table inherits a LF-Tag from a database or a column inherits a LF-Tag from a table, you can override the inherited value by assigning a new value to the LF-Tag key.
The maximum number of LF-Tags that you can assign to a resource is 50.
Topics
Requirements for managing tags assigned to resources
To assign a LF-Tag to a Data Catalog resource, you must:
-
Have the Lake Formation
ASSOCIATE
permission on the LF-Tag. -
Have the IAM
lakeformation:AddLFTagsToResource
permission. -
Have glue:GetDatabase permission on a Glue database.
-
Be the resource owner (creator), have the
Super
Lake Formation permission on the resource with theGRANT
option, or have the following permissions with theGRANT
option:-
For databases in the same AWS account:
DESCRIBE
,CREATE_TABLE
,ALTER
, andDROP
-
For databases in an external account:
DESCRIBE
,CREATE_TABLE
andALTER
-
For tables (and columns):
DESCRIBE
,ALTER
,DROP
,INSERT
,SELECT
, andDELETE
-
In addition, the LF-Tag and the resource that it is being assigned to must be in the same AWS account.
To remove a LF-Tag from a Data Catalog resource, you must meet these requirements, and also
have the lakeformation:RemoveLFTagsFromResource
IAM permission.
Assign LF-Tags to a table column
To assign LF-Tags to a table column (console)
-
Open the Lake Formation console at https://console.aws.amazon.com/lakeformation/
. Sign in as a user who meets the requirements listed above.
-
In the navigation pane, choose Tables.
-
Choose a table name (not the option button next to the table name).
-
On the table details page, in the Schema section, choose Edit schema.
-
On the Edit schema page, select one or more columns, and then choose Edit tags.
Note
If you intend to add or delete columns and save a new version, do that first. Then edit the LF-Tags.
The Edit LF-Tags dialog box appears, and displays any LF-Tags that are inherited from the table.
-
(Optional) For the Values list next to an Inherited keys field, choose a value to override the inherited value.
-
(Optional) Choose Assign new LF-Tag. Then for Assigned keys, choose a key, and for Values, choose a value for the key.
-
(Optional) Choose Assign new LF-Tag again to add another LF-Tag.
-
Choose Save.
Assign LF-Tags to a Data Catalog resource
Updating LF-Tags for a resource
To update a LF-Tag for a Data Catalog resource (AWS CLI)
-
Use the
add-lf-tags-to-resource
command, as described in the previous procedure.Adding a LF-Tag with the same key as an existing LF-Tag, but with a different value updates the existing value.
Removing LF-Tag from a resource
To remove a LF-Tag for a Data Catalog resource (AWS CLI)
-
Run the
remove-lf-tags-from-resource
command.If a table has a LF-Tag value that overrides the value that is inherited from the parent database, removing that LF-Tag from the table restores the inherited value. This behavior also applies to a column that overrides key values inherited from the table.
The following example removes the LF-tag
level=director
from thetotal
column of thesales
table. TheCatalogID
property for--lf-tags
is optional. If not provided, the catalog ID of the resource (in this case, the table) is assumed.aws lakeformation remove-lf-tags-from-resource --resource ' { "TableWithColumns": { "DatabaseName": "erp", "Name": "sales", "ColumnNames":[ "total"]}}' --lf-tags CatalogId=111122223333,TagKey=level,TagValues=director