Skip to content
GitHubXDiscord

TagAssociation

The TagAssociation resource allows you to manage AWS LakeFormation TagAssociations which are used to associate tags with LakeFormation resources, enabling fine-grained access control.

Create a basic TagAssociation with required properties:

import AWS from "alchemy/aws/control";
const tagAssociation = await AWS.LakeFormation.TagAssociation("basicTagAssociation", {
LFTags: [
{
TagKey: "Environment",
TagValues: ["Production"]
}
],
Resource: {
Table: {
DatabaseName: "myDatabase",
Name: "myTable"
}
}
});

Configure a TagAssociation with multiple tags and adopt existing resources:

const advancedTagAssociation = await AWS.LakeFormation.TagAssociation("advancedTagAssociation", {
LFTags: [
{
TagKey: "Environment",
TagValues: ["Production"]
},
{
TagKey: "Department",
TagValues: ["Finance"]
}
],
Resource: {
Table: {
DatabaseName: "myDatabase",
Name: "myTable"
}
},
adopt: true // Adopt existing resource instead of failing
});

Use Case: Associating Tags with a Data Lake Resource

Section titled “Use Case: Associating Tags with a Data Lake Resource”

This example demonstrates how to associate tags with a data lake resource for better access management:

const dataLakeTagAssociation = await AWS.LakeFormation.TagAssociation("dataLakeTagAssociation", {
LFTags: [
{
TagKey: "Confidentiality",
TagValues: ["High"]
},
{
TagKey: "Retention",
TagValues: ["1 Year"]
}
],
Resource: {
DataLakePrincipal: {
DataLakePrincipalIdentifier: "arn:aws:iam::123456789012:role/MyLakeFormationRole"
}
}
});