Skip to content

Commit 05cb701

Browse files
committed
feat(layers): add support for the new ca-west-1 region
1 parent fa9c44c commit 05cb701

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.github/workflows/reusable_deploy_v2_layer_stack.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ jobs:
104104
has_arm64_support: "true"
105105
- region: "ca-central-1"
106106
has_arm64_support: "true"
107+
- region: "ca-west-1"
108+
has_arm64_support: "false"
107109
- region: "eu-central-1"
108110
has_arm64_support: "true"
109111
- region: "eu-central-2"

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ You can include Powertools for AWS Lambda (Python) Lambda Layer using [AWS Lambd
9292
| `ap-southeast-3` | [arn:aws:lambda:ap-southeast-3:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
9393
| `ap-southeast-4` | [arn:aws:lambda:ap-southeast-4:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
9494
| `ca-central-1` | [arn:aws:lambda:ca-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
95+
| `ca-west-1` | [arn:aws:lambda:ca-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
9596
| `eu-central-1` | [arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
9697
| `eu-central-2` | [arn:aws:lambda:eu-central-2:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
9798
| `eu-north-1` | [arn:aws:lambda:eu-north-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |

layer/scripts/layer-balancer/main.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var regions = []string{
5656
"ap-southeast-3",
5757
"ap-southeast-4",
5858
"ca-central-1",
59+
"ca-west-1",
5960
"eu-central-1",
6061
"eu-central-2",
6162
"eu-north-1",
@@ -75,7 +76,7 @@ var regions = []string{
7576
}
7677

7778
// Add regions that only support x86_64
78-
var singleArchitectureRegions = []string{}
79+
var singleArchitectureRegions = []string{"ca-west-1"}
7980

8081
// getLayerVersion returns the latest version of a layer in a region
8182
func getLayerVersion(ctx context.Context, layerName string, region string) (int64, error) {
@@ -149,6 +150,11 @@ func balanceRegionToVersion(ctx context.Context, region string, layer *LayerInfo
149150
return fmt.Errorf("error getting layer version: %w", err)
150151
}
151152

153+
if currentLayerVersion == 0 {
154+
log.Printf("[%s] No layers found in region %s, stating with version 1", layer.Name, region)
155+
currentLayerVersion = 1
156+
}
157+
152158
cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region))
153159
if err != nil {
154160
return err
@@ -172,7 +178,7 @@ func balanceRegionToVersion(ctx context.Context, region string, layer *LayerInfo
172178
ZipFile: payload,
173179
},
174180
LayerName: aws.String(layer.Name),
175-
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311},
181+
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311, types.RuntimePython312},
176182
Description: aws.String(layer.Description),
177183
LicenseInfo: aws.String("MIT-0"),
178184
})
@@ -183,7 +189,7 @@ func balanceRegionToVersion(ctx context.Context, region string, layer *LayerInfo
183189
},
184190
LayerName: aws.String(layer.Name),
185191
CompatibleArchitectures: []types.Architecture{layer.Architecture},
186-
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311},
192+
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311, types.RuntimePython312},
187193
Description: aws.String(layer.Description),
188194
LicenseInfo: aws.String("MIT-0"),
189195
})

0 commit comments

Comments
 (0)