Skip to main content

Deploy Lambda container image with Bash script support in AWS CDK

Project description

NPM version PyPI version Release

cdk-lambda-bash

Deploy Lambda container image with Bash script support in AWS CDK

Why

AWS Lambda has the docker container image support since AWS re:Invent 2020 which allows you to run your Lambda code in a custom container image. Inspired by nikovirtala/cdk-eks-experiment, cdk-lambda-bash allows you to specify a local shell script and bundle it up as a custom resource in your cdk stack. On cdk deployment, your shell script will be executed in a Lambda container environment.

BashExecFunction

At this moment, we are offering BashExecFunction construct class which is a high-level abstraction of lambda.Function. By defining the script property which poins to your local shell script, on cdk deploy, this script will be bundled into a custom docker image and published as a lambda.DockerImageFunction.

If you fn.run(), a custom resource will be created and the lambda.DockerImageFunction will be executed on deployment.

Sample

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
app = cdk.App()

stack = cdk.Stack(app, "my-stack")

# bundle your Lambda function to execute the local demo.sh in container
fn = BashExecFunction(stack, "Demo",
    script=path.join(__dirname, "../demo.sh")
)

# run it as custom resource on deployment
fn.run()

In Action

See this tweet

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

cdk-lambda-bash-0.1.0.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdk_lambda_bash-0.1.0-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file cdk-lambda-bash-0.1.0.tar.gz.

File metadata

  • Download URL: cdk-lambda-bash-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.9

File hashes

Hashes for cdk-lambda-bash-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5b24128135c5ec8a62d6b2c80e2f1b0ccbae13ef5ebe0ca3036aaa33b101d08e
MD5 5b90b13dbcc3ae05588916126f9c7fa1
BLAKE2b-256 2ae4408fbdecf43712f8bc0707fa806961f9e0d2695fa4d19ec56cf6d84eda1d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cdk_lambda_bash-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.9

File hashes

Hashes for cdk_lambda_bash-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c780dddc853af23be8f179db5105ceac8e1734c7e9df6e293e8dc36f4e3effb8
MD5 7c23fd845a4f164b55025e735accc932
BLAKE2b-256 b86203a8f3387bd12cb7b60f6d1da9d0ffb23be046c45856799b8296ab0a9a60

See more details on using hashes here.

Supported by

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