Skip to content

Commit 861ea1f

Browse files
chore(ci): update layer version for all AWS partitions in docs (#7757)
fix(ci): update layer version for all AWS partitions in docs Fixes #7650 This extends the fix from #6868 to handle all AWS partitions, not just commercial AWS. The previous fix only updated layer ARNs with specific python versions (e.g., python312) but missed the template placeholders with {python_version} for China and GovCloud partitions. Changes: - Updated hardcoded layer versions from :18 to :27 in docs/index.md - Extended update_layer_arn_v3.sh to handle AWS China (arn:aws-cn) and GovCloud (arn:aws-us-gov) layer ARNs - Added sed patterns for both specific versions and {python_version} placeholders across all AWS partitions The automation now correctly updates layer versions for: - Commercial AWS: arn:aws:lambda:{region}:017000801446:layer:... - AWS China: arn:aws-cn:lambda:cn-north-1:498634801083:layer:... - GovCloud East: arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:... - GovCloud West: arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:... Co-authored-by: Leandro Damascena <lcdama@amazon.pt>
1 parent f309012 commit 861ea1f

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

docs/index.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc
7070

7171
| Architecture | Layer ARN |
7272
| ------------ | ----------------------------------------------------------------------------------------------------------------------------- |
73-
| x86_64 | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:18__{: .copyMe} |
74-
| ARM | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:18__{: .copyMe} |
73+
| x86_64 | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:27__{: .copyMe} |
74+
| ARM | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:27__{: .copyMe} |
7575

7676
=== "AWS Console"
7777

@@ -221,8 +221,8 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc
221221

222222
| Architecture | Layer ARN |
223223
| ------------ | --------------------------------------------------------------------------------------------------------- |
224-
| x86_64 | __arn:aws-cn:lambda:cn-north-1:498634801083:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:18__{: .copyMe} |
225-
| ARM | __arn:aws-cn:lambda:cn-north-1:498634801083:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:18__{: .copyMe} |
224+
| x86_64 | __arn:aws-cn:lambda:cn-north-1:498634801083:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:27__{: .copyMe} |
225+
| ARM | __arn:aws-cn:lambda:cn-north-1:498634801083:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:27__{: .copyMe} |
226226

227227
=== "Lambda Layer (GovCloud)"
228228

@@ -234,15 +234,15 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc
234234

235235
| Architecture | Layer ARN |
236236
| ------------ | --------------------------------------------------------------------------------------------------------- |
237-
| x86_64 | __arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:18__{: .copyMe}:clipboard: |
238-
| ARM | __arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:18__{: .copyMe}:clipboard: |
237+
| x86_64 | __arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:27__{: .copyMe}:clipboard: |
238+
| ARM | __arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:27__{: .copyMe}:clipboard: |
239239

240240
**AWS GovCloud (us-gov-west-1)**
241241

242242
| Architecture | Layer ARN |
243243
| ------------ | --------------------------------------------------------------------------------------------------------- |
244-
| x86_64 | __arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:18__{: .copyMe} |
245-
| ARM | __arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:18__{: .copyMe} |
244+
| x86_64 | __arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:27__{: .copyMe} |
245+
| ARM | __arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:27__{: .copyMe} |
246246

247247
=== "Serverless Application Repository (SAR)"
248248

layer_v3/scripts/update_layer_arn_v3.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,22 @@ find ./docs ./examples -type f \( -name "*.md" -o -name "*.py" -o -name "*.yaml"
2727
# -i: edit files in-place without creating a backup
2828
# -E: use extended regular expressions
2929
# The regex matches the layer name and replaces only the version number at the end
30+
31+
# Commercial AWS (arn:aws:lambda)
3032
sed -i -E "s/(AWSLambdaPowertoolsPythonV3-python[0-9]+-((arm64)|(x86_64)):)[0-9]+/\1$new_version/g" "$file"
3133
sed -i -E "s/(AWSLambdaPowertoolsPythonV3-{python_version}-((arm64)|(x86_64)):)[0-9]+/\1$new_version/g" "$file"
34+
35+
# AWS China (arn:aws-cn:lambda)
36+
sed -i -E "s/(arn:aws-cn:lambda:[^:]+:[^:]+:layer:AWSLambdaPowertoolsPythonV3-python[0-9]+-((arm64)|(x86_64)):)[0-9]+/\1$new_version/g" "$file"
37+
sed -i -E "s/(arn:aws-cn:lambda:[^:]+:[^:]+:layer:AWSLambdaPowertoolsPythonV3-{python_version}-((arm64)|(x86_64)):)[0-9]+/\1$new_version/g" "$file"
38+
39+
# AWS GovCloud (arn:aws-us-gov:lambda)
40+
sed -i -E "s/(arn:aws-us-gov:lambda:[^:]+:[^:]+:layer:AWSLambdaPowertoolsPythonV3-python[0-9]+-((arm64)|(x86_64)):)[0-9]+/\1$new_version/g" "$file"
41+
sed -i -E "s/(arn:aws-us-gov:lambda:[^:]+:[^:]+:layer:AWSLambdaPowertoolsPythonV3-{python_version}-((arm64)|(x86_64)):)[0-9]+/\1$new_version/g" "$file"
42+
3243
if [ $? -eq 0 ]; then
3344
echo "Updated $file successfully"
34-
grep "arn:aws:lambda:" "$file"
45+
grep "arn:aws.*:lambda:" "$file" || true
3546
else
3647
echo "Error processing $file"
3748
fi

0 commit comments

Comments
 (0)