# AWS::LakeFormation Construct Library

This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts
import * as lakeformation from 'aws-cdk-lib/aws-lakeformation';
```

There are no official hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet. Here are some suggestions on how to proceed:

- Search [Construct Hub for LakeFormation construct libraries](https://constructs.dev/search?q=lakeformation)
- Use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, in the same way you would use [the CloudFormation AWS::LakeFormation resources](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LakeFormation.html) directly.

There are no hand-written ([L2](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_lib)) constructs for this service yet.
However, you can still use the automatically generated [L1](https://docs.aws.amazon.com/cdk/latest/guide/constructs.html#constructs_l1_using) constructs, and use this service exactly as you would using CloudFormation directly.

For more information on the resources and properties available for this service, see the [CloudFormation documentation for AWS::LakeFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/AWS_LakeFormation.html).

(Read the [CDK Contributing Guide](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and submit an RFC if you are interested in contributing to this construct library.)

## Example

Here is an example of creating a glue table and putting lakeformation tags on it. Note: this example uses deprecated constructs and overly permissive IAM roles. This example is meant to give a general idea of using the L1s; it is not production level.

```ts
import * as cdk from 'aws-cdk-lib';
import { S3Table, Database, DataFormat, Schema } from 'aws-cdk-lib/aws-glue';
import { CfnDataLakeSettings, CfnTag, CfnTagAssociation } from 'aws-cdk-lib/aws-lakeformation';

declare const stack: cdk.Stack;
declare const accountId: string;

const tagKey = 'aws';
const tagValues = ['dev'];

const database = new Database(this, 'Database');

const table = new S3Table(this, 'Table', {
  database,
  columns: [
    {
      name: 'col1',
      type: Schema.STRING,
    },
    {
      name: 'col2',
      type: Schema.STRING,
    }
  ],
  dataFormat: DataFormat.CSV,
});

const synthesizer = stack.synthesizer as cdk.DefaultStackSynthesizer;
new CfnDataLakeSettings(this, 'DataLakeSettings', {
  admins: [
    {
      dataLakePrincipalIdentifier: stack.formatArn({
        service: 'iam',
        resource: 'role',
        region: '',
        account: accountId,
        resourceName: 'Admin',
      }),
    },
    {
      // The CDK cloudformation execution role.
      dataLakePrincipalIdentifier: synthesizer.cloudFormationExecutionRoleArn.replace('${AWS::Partition}', 'aws'),
    },
  ],
});

const tag = new CfnTag(this, 'Tag', {
  catalogId: accountId,
  tagKey,
  tagValues,
});

const lfTagPairProperty: CfnTagAssociation.LFTagPairProperty = {
  catalogId: accountId,
  tagKey,
  tagValues,
};

const tagAssociation = new CfnTagAssociation(this, 'TagAssociation', {
  lfTags: [lfTagPairProperty],
  resource: {
    tableWithColumns: {
      databaseName: database.databaseName,
      columnNames: ['col1', 'col2'],
      catalogId: accountId,
      name: table.tableName,
    }
  }
});

tagAssociation.node.addDependency(tag);
tagAssociation.node.addDependency(table);
```

Additionally, you may need to use the lakeformation console to give permissions, particularly to give the cdk-exec-role tagging permissions.

## Types

| Name | Kind | Summary |
| --- | --- | --- |
| [`CfnDataCellsFilter`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataCellsFilter) | Construct (L1) | A structure that represents a data cell filter with column-level, row-level, and/or cell-level security. |
| [`CfnDataLakeSettings`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataLakeSettings) | Construct (L1) | The `AWS::LakeFormation::DataLakeSettings` resource is an AWS Lake Formation resource type that manages the data lake settings for your account. |
| [`CfnPermissions`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions) | Construct (L1) | The `AWS::LakeFormation::Permissions` resource represents the permissions that a principal has on an AWS Glue Data Catalog resource (such as AWS Glue database or AWS Glue tables). |
| [`CfnPrincipalPermissions`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions) | Construct (L1) | The `AWS::LakeFormation::PrincipalPermissions` resource represents the permissions that a principal has on a Data Catalog resource (such as AWS Glue databases or AWS Glue tables). |
| [`CfnResource`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnResource) | Construct (L1) | The `AWS::LakeFormation::Resource` represents the data ( buckets and folders) that is being registered with AWS Lake Formation . |
| [`CfnTag`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTag) | Construct (L1) | The `AWS::LakeFormation::Tag` resource represents an LF-tag, which consists of a key and one or more possible values for the key. |
| [`CfnTagAssociation`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociation) | Construct (L1) | The `AWS::LakeFormation::TagAssociation` resource represents an assignment of an LF-tag to a Data Catalog resource (database, table, or column). |
| [`CfnDataCellsFilter.ColumnWildcardProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataCellsFilter.ColumnWildcardProperty) | Struct | A wildcard object, consisting of an optional list of excluded column names or indexes. |
| [`CfnDataCellsFilter.RowFilterProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataCellsFilter.RowFilterProperty) | Struct | A PartiQL predicate. |
| [`CfnDataCellsFilterProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataCellsFilterProps) | Struct | Properties for defining a `CfnDataCellsFilter`. |
| [`CfnDataLakeSettings.DataLakePrincipalProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataLakeSettings.DataLakePrincipalProperty) | Struct | The Lake Formation principal. |
| [`CfnDataLakeSettings.PrincipalPermissionsProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataLakeSettings.PrincipalPermissionsProperty) | Struct | Permissions granted to a principal. |
| [`CfnDataLakeSettingsProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnDataLakeSettingsProps) | Struct | Properties for defining a `CfnDataLakeSettings`. |
| [`CfnPermissions.ColumnWildcardProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.ColumnWildcardProperty) | Struct | A wildcard object, consisting of an optional list of excluded column names or indexes. |
| [`CfnPermissions.DatabaseResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.DatabaseResourceProperty) | Struct | A structure for the database object. |
| [`CfnPermissions.DataLakePrincipalProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.DataLakePrincipalProperty) | Struct | The Lake Formation principal. |
| [`CfnPermissions.DataLocationResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.DataLocationResourceProperty) | Struct | A structure for a data location object where permissions are granted or revoked. |
| [`CfnPermissions.ResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.ResourceProperty) | Struct | A structure for the resource. |
| [`CfnPermissions.TableResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.TableResourceProperty) | Struct | A structure for the table object. |
| [`CfnPermissions.TableWildcardProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.TableWildcardProperty) | Struct |  |
| [`CfnPermissions.TableWithColumnsResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissions.TableWithColumnsResourceProperty) | Struct | A structure for a table with columns object. This object is only used when granting a SELECT permission. |
| [`CfnPermissionsProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPermissionsProps) | Struct | Properties for defining a `CfnPermissions`. |
| [`CfnPrincipalPermissions.ColumnWildcardProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.ColumnWildcardProperty) | Struct | A wildcard object, consisting of an optional list of excluded column names or indexes. |
| [`CfnPrincipalPermissions.DatabaseResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.DatabaseResourceProperty) | Struct | A structure for the database object. |
| [`CfnPrincipalPermissions.DataCellsFilterResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.DataCellsFilterResourceProperty) | Struct | A structure that describes certain columns on certain rows. |
| [`CfnPrincipalPermissions.DataLakePrincipalProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.DataLakePrincipalProperty) | Struct | The AWS Lake Formation principal. |
| [`CfnPrincipalPermissions.DataLocationResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.DataLocationResourceProperty) | Struct | A structure for a data location object where permissions are granted or revoked. |
| [`CfnPrincipalPermissions.LFTagKeyResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.LFTagKeyResourceProperty) | Struct | A structure containing an LF-tag key and values for a resource. |
| [`CfnPrincipalPermissions.LFTagPolicyResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.LFTagPolicyResourceProperty) | Struct | A list of LF-tag conditions that define a resource's LF-tag policy. |
| [`CfnPrincipalPermissions.LFTagProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.LFTagProperty) | Struct | The LF-tag key and values attached to a resource. |
| [`CfnPrincipalPermissions.ResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.ResourceProperty) | Struct | A structure for the resource. |
| [`CfnPrincipalPermissions.TableResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.TableResourceProperty) | Struct | A structure for the table object. |
| [`CfnPrincipalPermissions.TableWithColumnsResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissions.TableWithColumnsResourceProperty) | Struct | A structure for a table with columns object. This object is only used when granting a SELECT permission. |
| [`CfnPrincipalPermissionsProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnPrincipalPermissionsProps) | Struct | Properties for defining a `CfnPrincipalPermissions`. |
| [`CfnResourceProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnResourceProps) | Struct | Properties for defining a `CfnResource`. |
| [`CfnTagAssociation.DatabaseResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociation.DatabaseResourceProperty) | Struct | A structure for the database object. |
| [`CfnTagAssociation.LFTagPairProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociation.LFTagPairProperty) | Struct | A structure containing the catalog ID, tag key, and tag values of an LF-tag key-value pair. |
| [`CfnTagAssociation.ResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociation.ResourceProperty) | Struct | A structure for the resource. |
| [`CfnTagAssociation.TableResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociation.TableResourceProperty) | Struct | A structure for the table object. |
| [`CfnTagAssociation.TableWithColumnsResourceProperty`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociation.TableWithColumnsResourceProperty) | Struct | A structure for a table with columns object. This object is only used when granting a SELECT permission. |
| [`CfnTagAssociationProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagAssociationProps) | Struct | Properties for defining a `CfnTagAssociation`. |
| [`CfnTagProps`](/v2/docs/aws-cdk-lib.aws_lakeformation.CfnTagProps) | Struct | Properties for defining a `CfnTag`. |
