File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -76,21 +76,24 @@ You can include Lambda Powertools Lambda Layer using [AWS Lambda Console](https:
76
76
77
77
=== "CDK"
78
78
79
- ```python hl_lines="14 "
79
+ ```python hl_lines="11 16 "
80
80
from aws_cdk import core, aws_lambda
81
81
82
82
class SampleApp(core.Construct):
83
83
84
84
def __init__(self, scope: core.Construct, id_: str, env: core.Environment) -> None:
85
85
super().__init__(scope, id_)
86
86
87
+ powertools_layer = aws_lambda.LayerVersion.from_layer_version_arn(
88
+ self,
89
+ id="lambda-powertools",
90
+ layer_version_arn=f"arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPython:4"
91
+ )
87
92
aws_lambda.Function(self,
88
93
'sample-app-lambda',
89
94
runtime=aws_lambda.Runtime.PYTHON_3_9,
90
- function_name='sample-lambda',
91
- code=aws_lambda.Code.asset('./src'),
92
- handler='app.handler',
93
- layers: [f"arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPython:4"]
95
+ layers=[powertools_layer]
96
+ # other props...
94
97
)
95
98
```
96
99
You can’t perform that action at this time.
0 commit comments