Skip to content

Commit 9f7a4d9

Browse files
authored
Merge branch 'main' into docs/update_roadmap
2 parents a577c1c + a5cc74f commit 9f7a4d9

File tree

23 files changed

+472
-167
lines changed

23 files changed

+472
-167
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# bootstraps new regions
2+
#
3+
# PURPOSE
4+
# Ensures new regions are deployable in future releases
5+
#
6+
# JOB 1 PROCESS
7+
#
8+
# 1. Installs CDK
9+
# 2. Bootstraps region
10+
#
11+
# JOB 2 PROCESS
12+
# 1. Sets up Go
13+
# 2. Installs the balance script
14+
# 3. Runs balance script to copy layers between aws regions
15+
16+
on:
17+
workflow_dispatch:
18+
inputs:
19+
environment:
20+
type: choice
21+
options:
22+
- beta
23+
- prod
24+
description: Deployment environment
25+
region:
26+
type: string
27+
required: true
28+
description: AWS region to bootstrap (i.e. eu-west-1)
29+
30+
name: Region Bootstrap
31+
run-name: Region Bootstrap ${{ inputs.region }}
32+
33+
permissions:
34+
contents: read
35+
36+
jobs:
37+
cdk:
38+
name: Install CDK
39+
runs-on: ubuntu-latest
40+
permissions:
41+
contents: write
42+
id-token: write
43+
environment: layer-${{ inputs.environment }}
44+
steps:
45+
- id: credentials
46+
name: AWS Credentials
47+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
48+
with:
49+
aws-region: ${{ inputs.region }}
50+
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
51+
mask-aws-account-id: true
52+
- id: workdir
53+
name: Create Workdir
54+
run: |
55+
mkdir -p build/project
56+
- id: cdk-install
57+
name: Install CDK
58+
working-directory: build
59+
run: |
60+
npm i aws-cdk@2.178.0
61+
- id: cdk-project
62+
name: CDK Project
63+
working-directory: build/project
64+
run: |
65+
npx cdk init app --language=typescript
66+
AWS_REGION="${{ inputs.region }}" npx cdk bootstrap
67+
68+
copy_layers:
69+
name: Copy Layers
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: write
73+
id-token: write
74+
environment: layer-${{ inputs.environment }}
75+
steps:
76+
- id: credentials
77+
name: AWS Credentials
78+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
79+
with:
80+
aws-region: us-east-1
81+
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
82+
mask-aws-account-id: true
83+
- id: go-setup
84+
name: Setup Go
85+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
86+
with:
87+
go-version: '>=1.23.0'
88+
- id: go-env
89+
name: Go Env
90+
run: go env
91+
- id: go-install-pkg
92+
name: Install
93+
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@latest
94+
- id: run-balance
95+
name: Run Balance
96+
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name AWSLambdaPowertoolsTypeScriptV2 -dry-run=false

.github/workflows/update_ssm.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# SSM Parameters update
2+
#
3+
# PROCESS
4+
# Creates parameters in regional AWS accounts for each layer we create, using the inputs to target specific releases
5+
# * environment: will prefix /beta/ into the parameter
6+
# * write_latest: will create a latest alias instead of a version number in the parameter
7+
# * package_version: semantic version number of the released layer (3.x.y)
8+
# * layer_version: this is sequential layer version from the ARN
9+
#
10+
# A successful parameter would look similar to:
11+
# /aws/service/powertools/python/arm64/python3.8/3.1.0
12+
# And will have a value of:
13+
# arn:aws:lambda:eu-west-1:094274105915:layer:AWSLambdaPowertoolsPythonV3-python38-arm64:4
14+
15+
on:
16+
workflow_dispatch:
17+
inputs:
18+
environment:
19+
description: Environment to deploy to
20+
type: choice
21+
options:
22+
- Beta
23+
- Prod
24+
required: true
25+
26+
write_latest:
27+
description: Write to the latest path
28+
type: boolean
29+
required: false
30+
31+
package_version:
32+
description: Semantic Version of published layer
33+
type: string
34+
required: true
35+
36+
layer_version:
37+
description: Layer version
38+
type: string
39+
required: true
40+
41+
name: SSM Parameters
42+
run-name: SSM Parameters - TypeScript
43+
44+
permissions:
45+
contents: read
46+
47+
jobs:
48+
typescript:
49+
runs-on: ubuntu-latest
50+
environment: SSM
51+
strategy:
52+
matrix:
53+
region: ["af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3",
54+
"ap-south-1", "ap-south-2", "ap-southeast-1", "ap-southeast-2", "ap-southeast-3",
55+
"ap-southeast-4", "ca-central-1", "ca-west-1", "eu-central-1", "eu-central-2",
56+
"eu-north-1", "eu-south-1", "eu-south-2", "eu-west-1", "eu-west-2", "eu-west-3",
57+
"il-central-1", "me-central-1", "me-south-1", "sa-east-1", "us-east-1",
58+
"us-east-2", "us-west-1", "us-west-2", "ap-southeast-5"
59+
]
60+
61+
permissions:
62+
contents: write
63+
id-token: write
64+
steps:
65+
- id: transform
66+
run: |
67+
echo 'CONVERTED_REGION=${{ matrix.region }}' | tr 'a-z\-' 'A-Z_' >> "$GITHUB_OUTPUT"
68+
- id: creds
69+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
70+
with:
71+
aws-region: ${{ matrix.region }}
72+
role-to-assume: ${{ secrets[format('{0}', steps.transform.outputs.CONVERTED_REGION)] }}
73+
mask-aws-account-id: true
74+
- id: write-version
75+
env:
76+
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
77+
run: |
78+
aws ssm put-parameter --name ${{ env.prefix }}/typescript/generic/all/${{ inputs.package_version }} --value "arn:aws:lambda:${{ matrix.region }}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:${{ inputs.layer_version }}" --type String --overwrite
79+
80+
- id: write-latest
81+
if: inputs.write_latest == true
82+
env:
83+
prefix: ${{ inputs.environment == 'beta' && '/aws/service/powertools/beta' || '/aws/service/powertools' }}
84+
run: |
85+
aws ssm put-parameter --name ${{ env.prefix }}/generic/all/latest --value "arn:aws:lambda:${{ matrix.region }}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:${{ inputs.layer_version }}" --type String --overwrite

docs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# version 9.5.35
2-
FROM squidfunk/mkdocs-material@sha256:7e841df1cfb6c8c4ff0968f2cfe55127fb1a2f5614e1c9bc23cbc11fe4c96644
2+
FROM squidfunk/mkdocs-material@sha256:c62453b1ba229982c6325a71165c1a3007c11bd3dd470e7a1446c5783bd145b4
33

44
COPY requirements.txt /tmp/
55
RUN pip install --require-hashes -r /tmp/requirements.txt

docs/index.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ You can use Powertools for AWS Lambda (TypeScript) by installing it with your fa
129129
- !Sub arn:aws:lambda:${AWS::Region}:094274105915:layer:AWSLambdaPowertoolsTypeScriptV2:19
130130
```
131131

132+
You can also use AWS SSM Parameter Store to dynamically add Powertools for AWS Lambda. The `{version}` placeholder is the semantic version number (e,g. 2.1.0) for a release or `_latest_`.
133+
134+
```yaml hl_lines="5"
135+
MyLambdaFunction:
136+
Type: AWS::Serverless::Function
137+
Properties:
138+
Layers:
139+
- {{resolve:ssm:/aws/service/powertools/typescript/generic/all/{version}}}
140+
```
141+
132142
If you use `esbuild` to bundle your code, make sure to exclude `@aws-lambda-powertools/*` and `@aws-sdk/*` from being bundled since the packages are already present the layer:
133143

134144
```yaml hl_lines="5-14"
@@ -195,6 +205,23 @@ You can use Powertools for AWS Lambda (TypeScript) by installing it with your fa
195205
}
196206
```
197207

208+
You can use [data sources](https://developer.hashicorp.com/terraform/language/data-sources) to resolve the SSM Parameter Store in your code, allowing you to pin to `_latest_` or a specific Powertools for AWS Lambda version.
209+
210+
```terraform
211+
data "aws_ssm_parameter" "powertools_version" {
212+
# Replace {version} with your chosen Powertools for AWS Lambda version or latest
213+
name = "/aws/service/powertools/python/generic/all/{version}"
214+
}
215+
216+
resource "aws_lambda_function" "test_lambda" {
217+
...
218+
219+
runtime = "nodejs22.x"
220+
221+
layers = [data.aws_ssm_parameter.powertools_version.value]
222+
}
223+
```
224+
198225
=== "Pulumi"
199226

200227
```typescript hl_lines="11"

docs/requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
mike==1.1.2
2-
mkdocs-material==9.6.2
2+
mkdocs-material==9.6.3
33
mkdocs-git-revision-date-plugin==0.3.2
44
mkdocs-exclude==1.0.2

docs/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,9 @@ mkdocs-get-deps==0.2.0 \
235235
mkdocs-git-revision-date-plugin==0.3.2 \
236236
--hash=sha256:2e67956cb01823dd2418e2833f3623dee8604cdf223bddd005fe36226a56f6ef
237237
# via -r requirements.in
238-
mkdocs-material==9.6.2 \
239-
--hash=sha256:71d90dbd63b393ad11a4d90151dfe3dcbfcd802c0f29ce80bebd9bbac6abc753 \
240-
--hash=sha256:a3de1c5d4c745f10afa78b1a02f917b9dce0808fb206adc0f5bb48b58c1ca21f
238+
mkdocs-material==9.6.3 \
239+
--hash=sha256:1125622067e26940806701219303b27c0933e04533560725d97ec26fd16a39cf \
240+
--hash=sha256:c87f7d1c39ce6326da5e10e232aed51bae46252e646755900f4b0fc9192fa832
241241
# via -r requirements.in
242242
mkdocs-material-extensions==1.3.1 \
243243
--hash=sha256:10c9511cea88f568257f960358a467d12b970e1f7b2c0e5fb2bb48cab1928443 \

docs/utilities/parser.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Parser comes with the following built-in schemas:
8585
| **SesSchema** | Lambda Event Source payload for Amazon Simple Email Service |
8686
| **SnsSchema** | Lambda Event Source payload for Amazon Simple Notification Service |
8787
| **SqsSchema** | Lambda Event Source payload for Amazon SQS |
88+
| **TransferFamilySchema** | Lambda Event Source payload for AWS Transfer Family events |
8889
| **VpcLatticeSchema** | Lambda Event Source payload for Amazon VPC Lattice |
8990
| **VpcLatticeV2Schema** | Lambda Event Source payload for Amazon VPC Lattice v2 payload |
9091

examples/app/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"devDependencies": {
3131
"@types/aws-lambda": "^8.10.147",
3232
"@types/node": "22.13.1",
33-
"aws-cdk-lib": "^2.177.0",
33+
"aws-cdk-lib": "^2.178.1",
3434
"constructs": "^10.4.2",
3535
"source-map-support": "^0.5.21",
3636
"tsx": "^4.19.2",
@@ -44,12 +44,12 @@
4444
"@aws-lambda-powertools/metrics": "^2.13.1",
4545
"@aws-lambda-powertools/parameters": "^2.13.1",
4646
"@aws-lambda-powertools/tracer": "^2.13.1",
47-
"@aws-sdk/client-ssm": "^3.741.0",
48-
"@aws-sdk/lib-dynamodb": "^3.741.0",
47+
"@aws-sdk/client-ssm": "^3.743.0",
48+
"@aws-sdk/lib-dynamodb": "^3.743.0",
4949
"@middy/core": "^4.7.0",
5050
"@types/aws-lambda": "^8.10.147",
5151
"@types/node": "22.13.1",
52-
"aws-cdk": "^2.177.0",
52+
"aws-cdk": "^2.178.1",
5353
"constructs": "^10.4.2",
5454
"esbuild": "^0.24.2",
5555
"typescript": "^5.7.3"

examples/snippets/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"@aws-lambda-powertools/parameters": "^2.13.1",
3333
"@aws-lambda-powertools/parser": "^2.13.1",
3434
"@aws-lambda-powertools/tracer": "^2.13.1",
35-
"@aws-sdk/client-appconfigdata": "^3.741.0",
36-
"@aws-sdk/client-dynamodb": "^3.741.0",
37-
"@aws-sdk/client-secrets-manager": "^3.741.0",
38-
"@aws-sdk/client-ssm": "^3.741.0",
39-
"@aws-sdk/util-dynamodb": "^3.741.0",
35+
"@aws-sdk/client-appconfigdata": "^3.743.0",
36+
"@aws-sdk/client-dynamodb": "^3.743.0",
37+
"@aws-sdk/client-secrets-manager": "^3.743.0",
38+
"@aws-sdk/client-ssm": "^3.743.0",
39+
"@aws-sdk/util-dynamodb": "^3.743.0",
4040
"@middy/core": "^4.7.0",
4141
"aws-sdk": "^2.1692.0",
4242
"aws-sdk-client-mock": "^4.1.0",

layers/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
"source-map-support": "^0.5.21"
4141
},
4242
"dependencies": {
43-
"aws-cdk": "^2.177.0",
44-
"aws-cdk-lib": "^2.177.0",
43+
"aws-cdk": "^2.178.1",
44+
"aws-cdk-lib": "^2.178.1",
4545
"esbuild": "^0.24.2",
4646
"tsx": "^4.19.2"
4747
}

0 commit comments

Comments
 (0)