Skip to content

feat(layers): add new comercial region Canada - ca-west-1 #3549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/reusable_deploy_v2_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ jobs:
has_arm64_support: "true"
- region: "ca-central-1"
has_arm64_support: "true"
- region: "ca-west-1"
has_arm64_support: "false"
- region: "eu-central-1"
has_arm64_support: "true"
- region: "eu-central-2"
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ You can include Powertools for AWS Lambda (Python) Lambda Layer using [AWS Lambd
| `ap-southeast-3` | [arn:aws:lambda:ap-southeast-3:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
| `ap-southeast-4` | [arn:aws:lambda:ap-southeast-4:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
| `ca-central-1` | [arn:aws:lambda:ca-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
| `ca-west-1` | [arn:aws:lambda:ca-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
| `eu-central-1` | [arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
| `eu-central-2` | [arn:aws:lambda:eu-central-2:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
| `eu-north-1` | [arn:aws:lambda:eu-north-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:58](#){: .copyMe}:clipboard: |
Expand Down
12 changes: 9 additions & 3 deletions layer/scripts/layer-balancer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var regions = []string{
"ap-southeast-3",
"ap-southeast-4",
"ca-central-1",
"ca-west-1",
"eu-central-1",
"eu-central-2",
"eu-north-1",
Expand All @@ -75,7 +76,7 @@ var regions = []string{
}

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

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

if currentLayerVersion == 0 {
log.Printf("[%s] No layers found in region %s, stating with version 1", layer.Name, region)
currentLayerVersion = 1
}

cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region))
if err != nil {
return err
Expand All @@ -172,7 +178,7 @@ func balanceRegionToVersion(ctx context.Context, region string, layer *LayerInfo
ZipFile: payload,
},
LayerName: aws.String(layer.Name),
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311},
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311, types.RuntimePython312},
Description: aws.String(layer.Description),
LicenseInfo: aws.String("MIT-0"),
})
Expand All @@ -183,7 +189,7 @@ func balanceRegionToVersion(ctx context.Context, region string, layer *LayerInfo
},
LayerName: aws.String(layer.Name),
CompatibleArchitectures: []types.Architecture{layer.Architecture},
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311},
CompatibleRuntimes: []types.Runtime{types.RuntimePython37, types.RuntimePython38, types.RuntimePython39, types.RuntimePython310, types.RuntimePython311, types.RuntimePython312},
Description: aws.String(layer.Description),
LicenseInfo: aws.String("MIT-0"),
})
Expand Down