Skip to main content

AWS CDK Constructs that can be used to create datalakes/meshes and more

Project description

cdk-datalake-constructs

Very experimental until version 1.0. This is my attempt at simplifying deploying various datalake strategies in AWS with the CDK.

License Build Release Python pip npm version pypi version Maven nuget

Table of Contents

Features

  • Easy to Start - Create a Datalake in a few lines.
  • Easy to Expand - Expand into multiple accounts and into a data mesh.
  • Easy to Admin - Initial governance created on deploy.

Installation

TypeScript/JavaScript

$ npm install @randyridgley/cdk-datalake-constructs

Python

$ pip install cdk-datalake-constructs

.Net

$ nuget install CDK.Datalake.Constructs

# See more: https://www.nuget.org/packages/CDK.Datalake.Constructs/

Usage

Basic

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from randyridgley.cdk_datalake_constructs import DataLake

taxi_pipes = [
    pipelines.YellowPipeline(),
    pipelines.GreenPipeline()
]

data_products = [{
    "pipelines": taxi_pipes,
    "account_id": lake_account_id,
    "data_catalog_account_id": "123456789012",
    "database_name": "taxi-product"
}]

# deploy to local account
dl.DataLake(self, "LocalDataLake",
    name="data-lake,",
    account_id=central_account_id,
    region="us-east-1",
    policy_tags={
        "classification": "public,confidential,highlyconfidential,restricted,critical",
        "owner": "product,central,consumer"
    },
    stage_name=Stage.PROD,
    data_products=data_products,
    create_default_database=False
)

Data Mesh

You can setup cross account access and pre-created policy tags for TBAC access in Lake Formation

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
lake_account_id = app.node.try_get_context("lakeAccountId")
central_account_id = app.node.try_get_context("centralAccountId")
consumer_account_id = app.node.try_get_context("consumerAccountId")

taxi_pipes = [
    pipelines.YellowPipeline(),
    pipelines.GreenPipeline()
]

data_products = [{
    "pipelines": taxi_pipes,
    "account_id": lake_account_id,
    "data_catalog_account_id": central_account_id,
    "database_name": "taxi-product"
}]

# deploy to the central account
dl.DataLake(self, "CentralDataLake",
    name="central-lake,",
    account_id=central_account_id,
    region="us-east-1",
    policy_tags={
        "classification": "public,confidential,highlyconfidential,restricted,critical",
        "owner": "product,central,consumer"
    },
    stage_name=Stage.PROD,
    cross_account={
        "consumer_account_ids": [consumer_account_id, lake_account_id],
        "data_catalog_owner_account_id": central_account_id,
        "region": "us-east-1"
    },
    data_products=data_products,
    create_default_database=True
)

# deploy to the data product account
datalake = dl.DataLake(self, "LocalDataLake",
    name="local-lake",
    account_id=lake_account_id,
    region="us-east-1",
    stage_name=Stage.PROD,
    data_products=data_products,
    create_default_database=True
)

# Optionally add custom resource to download public data set products
datalake.create_downloader_custom_resource(account_id, region, props.stage_name)

# deploy to consumer account
datalake = dl.DataLake(self, "ConsumerDataLake",
    name="consumer-lake",
    account_id=consumer_account_id,
    region="us-east-1",
    stage_name=Stage.PROD,
    policy_tags={
        "access": "analyst,engineer,marketing"
    },
    create_default_database=True
)

Documentation

Construct API Reference

See API.md.

Supporting this project

I'm working on this project in my free time, if you like my project, or found it helpful and would like to support me any contributions are much appreciated! ❤️

License

This project is distributed under the MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-datalake-constructs-0.0.27.tar.gz (643.9 kB view hashes)

Uploaded Source

Built Distribution

cdk_datalake_constructs-0.0.27-py3-none-any.whl (642.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page