Skip to main content

AWS CDK lambda layer resource that contains node and aws cdk cli packages.

Project description

B.NodeCdkLayer

Pipeline

Description

This is a simple Lambda layer AWS CDK resource that contains node and aws cdk cli within. This package is useful for lambda functions that want to run aws cdk commands within themselves. Imagine a scenario where you run cdk deploy --all command not within you local pc or a build environment but through a lambda function. This library would greatly help you.

Remarks

Biomapas aims to modernise life-science industry by sharing its IT knowledge with other companies and the community. This is an open source library intended to be used by anyone. Improvements and pull requests are welcome.

Related technology

  • Python3
  • Docker
  • AWS CDK

Assumptions

This project assumes you have:

  • Good knowledge in AWS.
  • Good knowledge in AWS CDK.
  • Good Python skills and basis of OOP.

Useful sources

Install

Before installing this library, ensure you have these tools setup:

  • Python / Pip

To install this project from source run:

pip install .

Or you can install it from a PyPi repository:

pip install b-node-cdk-layer

Usage & Examples

Simply create a lambda function with this layer:

from aws_cdk.aws_lambda import Function
from b_node_cdk_layer.node_cdk_layer import NodeCdkLayer

Function(
    scope=Stack(...),
    id='Function',
    
    ...,
  
    layers=[NodeCdkLayer(Stack(...))],
  
    # Running node process requires more RAM and longer runtime.
    timeout=Duration.minutes(1),
    memory_size=512
)

To run some node or cdk command, follow this example:

import subprocess

# This is the path to AWS CDK CLI. It comes from a NodeCDK layer, that is a custom-built layer using docker.
CDK_CLI_PATH = '/opt/bin/node_modules/aws-cdk/bin/cdk'


def handler(*args, **kwargs):
    output = subprocess.check_output([
        CDK_CLI_PATH,
        '--version',
    ])

    print(output)

Testing

This package has unit tests based on pytest. To run tests simply run:

pytest b_node_cdk_layer_test/integration

Contribution

Found a bug? Want to add or suggest a new feature? Contributions of any kind are gladly welcome. You may contact us directly, create a pull-request or an issue in github platform. Lets modernize the world together.

Release history

0.1.0

  • Release build. Package works as intended.

0.0.1

  • Initial build.

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

b_node_cdk_layer-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

b_node_cdk_layer-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file b_node_cdk_layer-0.1.0.tar.gz.

File metadata

  • Download URL: b_node_cdk_layer-0.1.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.15

File hashes

Hashes for b_node_cdk_layer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9c36ae2ea7a9ec97181ede89a519142bafba93172749653299afcfe7480867df
MD5 d5a836c5cdc9e6c97233e2b2255773bd
BLAKE2b-256 60a990ce068c2334b4f6dbaf1d831f0650c44cc364f454f5124a7fc87b2ac26a

See more details on using hashes here.

File details

Details for the file b_node_cdk_layer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for b_node_cdk_layer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f2a3ef0394bd9bf6aa77d880468055a2eed93ba774afb79d7848770e0e8f84a
MD5 bead5009926a202d8f9427f5a1a7f0be
BLAKE2b-256 8257a3ae7a450990b5dc27cbe0b84601cdb1e7516c09ceeee9ec69064c54e84c

See more details on using hashes here.

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