14 types
This module is part of the AWS Cloud Development Kit project.
require 'aws-cdk-lib'
There are no official hand-written (L2) constructs for this service yet. Here are some suggestions on how to proceed:
There are no hand-written (L2) constructs for this service yet. However, you can still use the automatically generated L1 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.
(Read the CDK Contributing Guide and submit an RFC if you are interested in contributing to this construct library.)
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.
require 'aws-cdk-lib'
require 'aws-cdk-aws-glue-alpha'
stack = nil # AWSCDK::Stack
account_id = nil
tag_key = "aws"
tag_values = ["dev"]
database = Database.new(self, "Database")
table = S3Table.new(self, "Table", {
database: database,
columns: [
{
name: "col1",
type: Schema.STRING,
},
{
name: "col2",
type: Schema.STRING,
},
],
data_format: DataFormat.CSV,
})
synthesizer = stack.synthesizer
AWSCDK::LakeFormation::CfnDataLakeSettings.new(self, "DataLakeSettings", {
admins: [
{
data_lake_principal_identifier: stack.format_arn({
service: "iam",
resource: "role",
region: "",
account: account_id,
resource_name: "Admin",
}),
},
{
# The CDK cloudformation execution role.
data_lake_principal_identifier: synthesizer.cloud_formation_execution_role_arn.replace("${AWS::Partition}", "aws"),
},
],
})
tag = AWSCDK::LakeFormation::CfnTag.new(self, "Tag", {
catalog_id: account_id,
tag_key: tag_key,
tag_values: tag_values,
})
lf_tag_pair_property = {
catalog_id: account_id,
tag_key: tag_key,
tag_values: tag_values,
}
tag_association = AWSCDK::LakeFormation::CfnTagAssociation.new(self, "TagAssociation", {
lf_tags: [lf_tag_pair_property],
resource: {
table_with_columns: {
database_name: database.database_name,
column_names: ["col1", "col2"],
catalog_id: account_id,
name: table.table_name,
},
},
})
tag_association.node.add_dependency(tag)
tag_association.node.add_dependency(table)
Additionally, you may need to use the lakeformation console to give permissions, particularly to give the cdk-exec-role tagging permissions.