@aws-mdaa/lakeformation-tags-l3-construct

中文文档
1.10.0发布于 2026/11/07Apache-2.0TypeScriptCommonJS近 30 天下载 2607

MDAA LakeFormation Tags L3 Construct

原始使用文档
文档目录7 节
  1. Overview
  2. Constructs
  3. LakeFormationTagsL3Construct
  4. LakeFormationTagAssociationL3Construct
  5. Complete Example
  6. Best Practices
  7. Related Constructs

Lake Formation Tags L3 Construct

This package provides two constructs for managing AWS Lake Formation tags and their associations with data resources for tag-based access control (TBAC).

Overview

Lake Formation tags (LF-Tags) are key-value pairs that you can attach to Data Catalog resources (databases, tables, columns). These tags enable attribute-based access control, allowing you to grant permissions based on tag expressions rather than individual resources.

This package separates tag creation from tag association into two distinct constructs:

  • LakeFormationTagsL3Construct: Creates LF-Tags at the account level
  • LakeFormationTagAssociationL3Construct: Associates existing tags with databases and tables

Constructs

LakeFormationTagsL3Construct

Creates LF-Tags at the account level. These tags define the vocabulary for tag-based access control and can be reused across multiple databases and tables.

Usage

import { LakeFormationTagsL3Construct } from '@aws-mdaa/lakeformation-tags-l3-construct';

const tagsConstruct = new LakeFormationTagsL3Construct(this, 'ProjectLFTags', {
  lfTags: [
    {
      tagKey: 'environment',
      tagValues: ['dev', 'test', 'prod'],
    },
    {
      tagKey: 'data_tier',
      tagValues: ['bronze', 'silver', 'gold'],
    },
  ],
});

Properties

  • lfTags (required): Array of LFTagConfig objects defining the tags to create

LFTagConfig

  • tagKey (required): The key (name) of the Lake Formation tag
  • tagValues (required): Array of allowed values for this tag
  • catalogId (optional): The catalog ID where the tag will be created (defaults to current account)

LakeFormationTagAssociationL3Construct

Associates existing LF-Tags with databases and tables. This construct assumes the tags have already been created.

Usage

import { 
  LakeFormationTagsL3Construct,
  LakeFormationTagAssociationL3Construct 
} from '@aws-mdaa/lakeformation-tags-l3-construct';

// First, create the tags
const tagsConstruct = new LakeFormationTagsL3Construct(this, 'ProjectLFTags', {
  lfTags: [
    {
      tagKey: 'environment',
      tagValues: ['dev', 'test', 'prod'],
    },
    {
      tagKey: 'data_tier',
      tagValues: ['bronze', 'silver', 'gold'],
    },
  ],
});

// Then, associate tags with a database
new LakeFormationTagAssociationL3Construct(this, 'DatabaseTagAssociation', {
  databaseName: 'my-database',
  tagValues: [
    {
      tagKey: 'environment',
      tagValues: ['prod'],
    },
    {
      tagKey: 'data_tier',
      tagValues: ['gold'],
    },
  ],
  projectLevelTagsConstruct: tagsConstruct, // Ensures tags exist before association
});

// Optionally, associate tags with specific tables
new LakeFormationTagAssociationL3Construct(this, 'TableTagAssociation', {
  databaseName: 'my-database',
  tables: ['table1', 'table2'],
  tagValues: [
    {
      tagKey: 'environment',
      tagValues: ['prod'],
    },
  ],
  projectLevelTagsConstruct: tagsConstruct,
});

Properties

  • databaseName (required): The Glue database name to associate tags with
  • tagValues (required): Array of LFTagConfig objects specifying which tag values to associate
  • projectLevelTagsConstruct (optional): Reference to the construct that created the tags (for dependency management)
  • tables (optional): Array of specific table names to associate tags with

Complete Example

import { 
  LakeFormationTagsL3Construct,
  LakeFormationTagAssociationL3Construct 
} from '@aws-mdaa/lakeformation-tags-l3-construct';

// Step 1: Create account-level tags
const tagsConstruct = new LakeFormationTagsL3Construct(this, 'OrgLFTags', {
  lfTags: [
    {
      tagKey: 'environment',
      tagValues: ['dev', 'test', 'prod'],
    },
    {
      tagKey: 'data_tier',
      tagValues: ['bronze', 'silver', 'gold'],
    },
    {
      tagKey: 'pii',
      tagValues: ['true', 'false'],
    },
  ],
});

// Step 2: Associate tags with production database
new LakeFormationTagAssociationL3Construct(this, 'ProdDatabaseTags', {
  databaseName: 'production-db',
  tagValues: [
    { tagKey: 'environment', tagValues: ['prod'] },
    { tagKey: 'data_tier', tagValues: ['gold'] },
  ],
  projectLevelTagsConstruct: tagsConstruct,
});

// Step 3: Associate tags with specific sensitive tables
new LakeFormationTagAssociationL3Construct(this, 'SensitiveTableTags', {
  databaseName: 'production-db',
  tables: ['customers', 'transactions'],
  tagValues: [
    { tagKey: 'pii', tagValues: ['true'] },
  ],
  projectLevelTagsConstruct: tagsConstruct,
});

Best Practices

  1. Separation of Concerns: Create tags once at the account level, then associate them with multiple resources as needed
  2. Tag Naming: Use consistent naming conventions for tag keys (e.g., snake_case)
  3. Tag Values: Define all possible values upfront in the tag creation step to ensure consistent tagging
  4. Dependencies: Always pass projectLevelTagsConstruct to ensure tags exist before associations are created
  5. Reusability: Account-level tags can be reused across multiple databases and tables
  • LakeFormationTagBasedPermissionsL3Construct: Grant permissions based on LF-Tag expressions
  • LakeFormationAccessControlL3Construct: Traditional resource-based Lake Formation permissions

版本与发布记录

@aws-mdaa/lakeformation-tags-l3-construct 共发布 8 个版本,首次发布于 2026/02/04;过去 12 个月发布了 8 个版本。

版本发布日期距今
1.10.0latest2026/11/07今天
1.9.02026/10/021 个月前
1.8.12026/09/151 个月前
1.8.02026/09/022 个月前
1.7.02026/07/173 个月前
1.6.02026/05/225 个月前

关于 @aws-mdaa/lakeformation-tags-l3-construct 的常见问题

@aws-mdaa/lakeformation-tags-l3-construct 是什么?

MDAA LakeFormation Tags L3 Construct

如何安装 @aws-mdaa/lakeformation-tags-l3-construct?

在项目目录运行 npm install @aws-mdaa/lakeformation-tags-l3-construct,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:constructs(10.6.0)、aws-cdk-lib(2.263.0)、@aws-mdaa/construct(1.10.0)、@aws-mdaa/l3-construct(1.10.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@aws-mdaa/lakeformation-tags-l3-construct 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aws-mdaa/lakeformation-tags-l3-construct 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@aws-mdaa/lakeformation-tags-l3-construct 可以商用吗?

@aws-mdaa/lakeformation-tags-l3-construct 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aws-mdaa/lakeformation-tags-l3-construct 的下载量有多少?

根据 npm 官方下载统计,@aws-mdaa/lakeformation-tags-l3-construct 在 2026/10/08 – 2026/11/06 这 30 天内被下载 2,607 次,日均约 87 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aws-mdaa/lakeformation-tags-l3-construct 还在维护吗?

最新版本 1.10.0 发布于 2026/11/07(今天);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/02/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。