Skip to content

Commit 50ad7de

Browse files
authored
Merge pull request #129 from am29d/feat/lambda-layers
feat: add workflow to trigger external pipeline for publishing lambda layers
2 parents 041437b + 607904c commit 50ad7de

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Diff for: .github/workflows/publish.yml

+11
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ jobs:
5656
env:
5757
PYPI_USERNAME: __token__
5858
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
59+
- name: publish lambda layer in SAR by triggering the internal codepipeline
60+
run: |
61+
aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_TAG_VERSION --overwrite
62+
aws codepipeline start-pipeline-execution --name ${{ secrets.CODEPIPELINE_NAME }}
63+
env:
64+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
65+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
66+
AWS_DEFAULT_REGION: eu-west-1
67+
AWS_DEFAULT_OUTPUT: json
68+
69+
5970

6071
sync_master:
6172
needs: upload

Diff for: docs/content/index.mdx

+16
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,22 @@ from aws_lambda_powertools.logging.logger import set_package_logger
5858
set_package_logger()
5959
```
6060

61+
## Lambda Layer
62+
63+
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).
64+
Create the layer via API with:
65+
66+
```bash:title=bash-script
67+
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
68+
CHANGE_SET_ID=$(aws cloudformation list-change-sets --stack-name YOUR_STACK_NAME --query 'Summaries[*].ChangeSetId' --output text)
69+
aws cloudformation wait change-set-create-complete --change-set-name $CHANGE_SET_ID
70+
aws cloudformation execute-change-set --change-set-name $CHANGE_SET_ID
71+
```
72+
73+
this will create a CloudFormation stack with the powertools layer in a specific region where you run this commands.
74+
Keep in mind that layers are regional resources and you need to create the layer in every region where you need it.
75+
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.
76+
6177
## Tenets
6278

6379
* **AWS Lambda only** – We optimise for AWS Lambda function environments and supported runtimes only. Utilities might work with web frameworks and non-Lambda environments, though they are not officially supported.

0 commit comments

Comments
 (0)