CDK Lambda Layer Curl

raw JSON →
2.0.838 verified Fri May 01 auth: no python

AWS CDK construct that packages the curl binary as a Lambda Layer for Python 3.8+ runtimes. Current version 2.0.838. Pre-built layer version is published alongside.

pip install cdk-lambda-layer-curl
error ModuleNotFoundError: No module named 'cdk_lambda_layer_curl'
cause The library is not installed or the wrong import path used.
fix
Run pip install cdk-lambda-layer-curl and use from cdk_lambda_layer_curl import CurlLayer.
error jsii.errors.JSIIError: There is already a construct with name 'CurlLayer' in Stack [...]
cause Two CurlLayer constructs with the same logical ID in the same stack.
fix
Give each CurlLayer instance a unique second argument (e.g., 'CurlLayer1', 'CurlLayer2').
gotcha The construct uses pre-built layers for specific regions. If deploying in a region not supported, you must build the layer yourself from source.
fix Check the README for region availability or consider building from source using Docker.
breaking In version 2.0+, the import path changed from `cdk_lambda_layer_curl.curl` to `cdk_lambda_layer_curl` directly.
fix Update imports: `from cdk_lambda_layer_curl import CurlLayer`

Creates a Curl Lambda Layer in your stack.

from aws_cdk import App, Stack
from cdk_lambda_layer_curl import CurlLayer

app = App()
stack = Stack(app, "MyStack")

curl_layer = CurlLayer(stack, "CurlLayer")

# Use curl_layer.layer_version to attach to a Lambda function
app.synth()