File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 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:
7676
7777=== "CDK"
7878
79- ```python hl_lines="14 "
79+ ```python hl_lines="11 16 "
8080 from aws_cdk import core, aws_lambda
8181
8282 class SampleApp(core.Construct):
8383
8484 def __init__(self, scope: core.Construct, id_: str, env: core.Environment) -> None:
8585 super().__init__(scope, id_)
8686
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+ )
8792 aws_lambda.Function(self,
8893 'sample-app-lambda',
8994 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...
9497 )
9598 ```
9699
You can’t perform that action at this time.
0 commit comments