@@ -9,6 +9,8 @@ and add it to your function. The construct is an extension of the
99existing [ ` LayerVersion ` ] ( https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-lambda.LayerVersion.html ) construct
1010from the CDK library, so you have access to all fields and methods.
1111
12+ See the [ API] ( API.md ) for details.
13+
1214``` typescript
1315import { LambdaPowertoolsLayer } from ' cdk-lambda-powertools-python-layer' ;
1416
@@ -23,6 +25,8 @@ from cdk_lambda_powertools_python_layer import LambdaPowertoolsLayer
2325powertoolsLayer = LambdaPowertoolsLayer(self , ' PowertoolsLayer' )
2426```
2527
28+ The layer will be created during the CDK ` synth ` step and thus requires Docker.
29+
2630## Install
2731
2832TypeSript/JavaScript:
@@ -52,6 +56,8 @@ powertoolsLayer = LambdaPowertoolsLayer(self, 'PowertoolsLayer')
5256You can then add the layer to your funciton:
5357
5458``` python
59+ from aws_cdk import aws_lambda
60+
5561aws_lambda.Function(self , ' LambdaFunction' ,
5662 code = aws_lambda.Code.from_asset(' function' ),
5763 handler = ' app.handler' ,
@@ -80,7 +86,6 @@ Full example:
8086from aws_cdk import Stack, aws_lambda
8187from cdk_lambda_powertools_python_layer import LambdaPowertoolsLayer
8288from constructs import Construct
83- from typing_extensions import runtime
8489
8590
8691class LayerTestStack (Stack ):
@@ -101,46 +106,7 @@ class LayerTestStack(Stack):
101106
102107### TypeScript
103108
104- These examples are for TypeScript:
105-
106- Build the layer:
107-
108- ``` typescript
109- import { LambdaPowertoolsLayer } from ' cdk-lambda-powertools-python-layer' ;
110-
111- const powertoolsLayer = new LambdaPowertoolsLayer (this , ' TestLayer' , {
112- version: ' 1.22.0' ,
113- });
114- ```
115-
116- Add to your function:
117-
118- ``` typescript
119- new Function (this , ' LambdaFunction' , {
120- code: Code .fromAsset (path .join (' ./function' )),
121- handler: ' app.handler' ,
122- runtime: Runtime .PYTHON_3_9 ,
123- layers: [powertoolsLayer ],
124- });
125- ```
126-
127- You can specify the powertools version:
128-
129- ``` typescript
130- new LambdaPowertoolsLayer (this , ' PowertoolsLayer' , {
131- version: ' 1.21.0'
132- });
133- ```
134-
135- Decide if you want to incldue pydantic as extras dependencies:
136-
137- ``` typescript
138- new LambdaPowertoolsLayer (this , ' PowertoolsLayer' , {
139- includeExtras: true
140- });
141- ```
142-
143- Full example:
109+ Full example for TypeScript:
144110
145111``` typescript
146112import { Stack , StackProps } from ' aws-cdk-lib' ;
0 commit comments