Skip to content

Commit ac10b4f

Browse files
author
Alex Melnyk
committed
add layer to docs and how to use it from SAR
1 parent 2455001 commit ac10b4f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/content/index.mdx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,18 @@ from aws_lambda_powertools.logging.logger import set_package_logger
5454

5555
set_package_logger()
5656
```
57+
## Lambda Layer
58+
59+
Powertools is also available as a layer and is distributed via the [Serverless Application Repository](https://docs.aws.amazon.com/serverlessrepo/latest/devguide/what-is-serverlessrepo.html).
60+
Create the layer via API with:
61+
62+
```
63+
aws serverlessrepo create-cloud-formation-change-set --application-id arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer --stack-name YOUR_STACK_NAME --capabilities CAPABILITY_NAMED_IAM
64+
CHANGE_SET_ID=$(aws cloudformation list-change-sets --stack-name YOUR_STACK_NAME --query 'Summaries[*].ChangeSetId' --output text)
65+
aws cloudformation wait change-set-create-complete --change-set-name $CHANGE_SET_ID
66+
aws cloudformation execute-change-set --change-set-name $CHANGE_SET_ID
67+
```
68+
69+
this will create a CloudFormation stack with the powertools layer in a specific region where you run this commands.
70+
Keep in mind that layers are regional resources and you need to create the layer in every region where you need it.
71+
Alternatively, you can deploy the layer from the AWS Console by navigating to Serverless Application Repository and search for `aws-lambda-powertools-python-layer` and follow the deploy steps from there.

0 commit comments

Comments
 (0)