Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 893bfdc

Browse files
author
Alexander Melnyk
committed
docs: adjust readme
1 parent 97d6abf commit 893bfdc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44

55
This is a custom construct that will create AWS Lambda Layer with AWS Powertools for Python or NodeJS library. There are different
66
ways how to create a layer and when working with CDK you need to install the library, create a zip file and wire it
7-
correctly. With this construct you don't have to care about packaging and dependency management, create a construct
7+
correctly. With this construct you don't have to care about packaging and dependency management. Create a construct
88
and add it to your function. The construct is an extension of the
99
existing [`LayerVersion`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.LayerVersion.html) construct
1010
from the CDK library, so you have access to all fields and methods.
1111

12+
> ⚠️ **This construct uses docker to build and bundle the dependencies!**
13+
1214
See the [API](API.md) for details.
1315

1416
```typescript
15-
import { LambdaPowertoolsLayer } from 'cdk-aws=lambda-powertools-python-layer';
17+
import {LambdaPowertoolsLayer} from 'cdk-aws-lambda-powertools-layer';
18+
import {RuntimeFamily } from "aws-cdk-lib/aws-lambda";
1619

17-
const powertoolsLayer = new LambdaPowertoolsLayer(this, 'TestLayer');
20+
const powertoolsLayerPython = new LambdaPowertoolsLayer(this, 'TestLayer', {runtimeFamily: RuntimeFamily.PYTHON});
21+
const powertoolsLayerNodeJS = new LambdaPowertoolsLayer(this, 'TestLayer', {runtimeFamily: RuntimeFamily.NODEJS});
1822
```
1923

2024
Python
@@ -45,7 +49,7 @@ pip install cdk-aws-lambda-powertools-layer
4549

4650
### Python
4751

48-
A single line will create a layer with powertools for python:
52+
A single line will create a layer with powertools for python. For NodeJS you need to specifically set the `runtimeFamily: Runtime.NODEJS` property.
4953

5054
```python
5155
from cdk_aws_lambda_powertools_layer import LambdaPowertoolsLayer
@@ -61,7 +65,6 @@ from aws_cdk import aws_lambda
6165
aws_lambda.Function(self, 'LambdaFunction',
6266
code=aws_lambda.Code.from_asset('function'),
6367
handler='app.handler',
64-
runtime=aws_lambda.Runtime.PYTHON_3_9,
6568
layers=[powertoolsLayer])
6669
```
6770

@@ -99,7 +102,6 @@ class LayerTestStack(Stack):
99102
aws_lambda.Function(self, 'LambdaFunction',
100103
code=aws_lambda.Code.from_asset('function'),
101104
handler='app.handler',
102-
runtime=aws_lambda.Runtime.PYTHON_3_9,
103105
layers=[powertoolsLayer])
104106

105107
```
@@ -127,7 +129,6 @@ export class CdkPowertoolsExampleStack extends Stack {
127129
new Function(this, 'LambdaFunction', {
128130
code: Code.fromAsset(path.join('./function')),
129131
handler: 'app.handler',
130-
runtime: Runtime.PYTHON_3_9,
131132
layers: [powertoolsLayer],
132133
});
133134
}

0 commit comments

Comments
 (0)