Speed-up Lambda function deployment with dependency layers built in AWS
Project description
Turbo Layers for CDK
Speed up deployment of Lambda functions by creating dependency layers in AWS instead of locally.
- Easily separate dependency deployment from Lambda code deployment
- Never re-package dependencies just because of a small code change
- Never download another single dependency package locally again
- Never upload oversized code packages again
- Edit your code in the browser -- no more "deployment package too large to enable inline code editing" errors
- Uninstall Docker from your laptop and extend your battery life
- Take shorter coffee breaks when deploying
Supported Lambda runtimes:
- Python
- Node.js
- Ruby
API
The best way to browse API documentation is on Constructs Hub. It is available in all supported programming languages.
Installation
-
Confirm you're using CDK v2
-
Install the appropriate package
-
pip install cloudsnorkel.cdk-turbo-layers
-
npm i @cloudsnorkel/cdk-turbo-layers
-
<dependency> <groupId>com.cloudsnorkel</groupId> <artifactId>cdk.turbo-layers</artifactId> </dependency>
-
go get github.com/CloudSnorkel/cdk-turbo-layers-go/cloudsnorkelcdkturbolayers
-
dotnet add package CloudSnorkel.Cdk.TurboLayers
-
Example
const packager = new PythonDependencyPackager(this, 'Packager', {
runtime: lambda.Runtime.PYTHON_3_9,
type: DependencyPackagerType.LAMBDA,
});
new Function(this, 'Function with inline requirements', {
handler: 'index.handler',
code: lambda.Code.fromInline('def handler(event, context):\n import requests'),
runtime: lambda.Runtime.PYTHON_3_9,
// this will create a layer from with requests and Scrapy in a Lambda function instead of locally
layers: [packager.layerFromInline('inline requirements', ['requests', 'Scrapy'])],
});
new Function(this, 'Function with external source and requirements', {
handler: 'index.handler',
code: lambda.Code.fromAsset('lambda-src'),
runtime: lambda.Runtime.PYTHON_3_9,
// this will read pyproject.toml and poetry.lock and create a layer from the requirements in a Lambda function instead of locally
layers: [packager.layerFromInline('poetry requirements', 'lambda-src')],
});
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
Built Distribution
Close
Hashes for cloudsnorkel.cdk-turbo-layers-0.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05c08aef1fc3d1341b9f9e35f4a5b2528a7352f97f0d90c5c806de0ef96168cb |
|
MD5 | 2ec0e7783ca4b8dcd8aa9b421235e9bf |
|
BLAKE2b-256 | 395642ca9e44af0dbe1b15f0ff25ed47a626139e7d8e5af973565877958a8327 |
Close
Hashes for cloudsnorkel.cdk_turbo_layers-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd41f1b2bbf1adbbc5b1d1f8ea5faac0201d217abda6623b673c03e824aca251 |
|
MD5 | 6951e0f86b0ab66241a2365f9be4da9f |
|
BLAKE2b-256 | 0c5b819b3d458b236ffb30aaf90c801bcbbe922240f8f47a03149d718d7d3ff3 |