Skip to content

fix(layers): rename Lambda layer name from x86 to x86_64 #5226

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 3 commits into from
Oct 1, 2024
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: 1 addition & 1 deletion .github/workflows/publish_v2_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy v2 layer to all regions

# PROCESS
#
# 1. Compile Layer using cdk-aws-lambda-powertools-layer CDK construct for x86 and ARM (uses custom runner as it's CPU heavy)
# 1. Compile Layer using cdk-aws-lambda-powertools-layer CDK construct for x86_64 and ARM (uses custom runner as it's CPU heavy)
# 2. Kick off pipeline for beta, prod, and canary releases
# 3. Create PR to update trunk so staged docs also point to the latest Layer ARN, when merged
# 4. Builds and publishes docs with latest Layer ARN using given version (generally coming from release)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_v3_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy v3 layer to all regions

# PROCESS
#
# 1. Compile Layer using cdk-aws-lambda-powertools-layer CDK construct for Python3.8-3.12 and x86/ARM architectures (uses custom runner as it's CPU heavy)
# 1. Compile Layer using cdk-aws-lambda-powertools-layer CDK construct for Python3.8-3.12 and x86_64/ARM architectures (uses custom runner as it's CPU heavy)
# 2. Kick off pipeline for beta, prod, and canary releases
# 3. Create PR to update trunk so staged docs also point to the latest Layer ARN, when merged
# 4. Builds and publishes docs with latest Layer ARN using given version (generally coming from release)
Expand Down
2 changes: 1 addition & 1 deletion docs/diagram_src/cicd_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ timeline
: Create PR

Lambda Layers : Fetch PyPi release
: Build x86 architecture
: Build x86_64 architecture
: Build ARM architecture
: Deploy Beta
: Canary testing
Expand Down
290 changes: 145 additions & 145 deletions docs/includes/_layer_homepage_x86.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc

| Architecture | Layer ARN |
| ------------ | --------------------------------------------------------------------------------------------------------- |
| x86 | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86:1__{: .copyMe}:clipboard: |
| x86_64 | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:1__{: .copyMe}:clipboard: |
| ARM | __arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:1__{: .copyMe}:clipboard: |

=== "AWS Console"
Expand Down Expand Up @@ -166,7 +166,7 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc
You can use AWS CLI to generate a pre-signed URL to download the contents of our Lambda Layer.

```bash title="AWS CLI command to download Lambda Layer content"
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1 --region eu-west-1
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1 --region eu-west-1
```

You'll find the pre-signed URL under `Location` key as part of the CLI command output.
Expand Down Expand Up @@ -247,7 +247,7 @@ In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependen

### Lambda Layer

[Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html){target="_blank"} is a .zip file archive that can contain additional code, pre-packaged dependencies, data, or configuration files. We compile and optimize [all dependencies](#install) for Python versions from **3.8 to 3.12**, as well as for both **arm64 and x86** architectures, to ensure compatibility. We also remove duplicate dependencies [already available in the Lambda runtime](https://github.com/aws-powertools/powertools-lambda-layer-cdk/blob/d24716744f7d1f37617b4998c992c4c067e19e64/layer/Python/Dockerfile#L36){target="_blank"} to achieve the most optimal size.
[Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html){target="_blank"} is a .zip file archive that can contain additional code, pre-packaged dependencies, data, or configuration files. We compile and optimize [all dependencies](#install) for Python versions from **3.8 to 3.12**, as well as for both **arm64 and x86_64** architectures, to ensure compatibility. We also remove duplicate dependencies [already available in the Lambda runtime](https://github.com/aws-powertools/powertools-lambda-layer-cdk/blob/d24716744f7d1f37617b4998c992c4c067e19e64/layer/Python/Dockerfile#L36){target="_blank"} to achieve the most optimal size.

=== "x86_64"
--8<-- "docs/includes/_layer_homepage_x86.md"
Expand All @@ -260,7 +260,7 @@ In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependen
The pre-signed URL to download this Lambda Layer will be within `Location` key in the CLI output. The CLI output will also contain the Powertools for AWS Lambda version it contains.

```bash title="AWS CLI command to download Lambda Layer content"
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1 --region eu-west-1
aws lambda get-layer-version-by-arn --arn arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1 --region eu-west-1
```

#### SAR
Expand Down Expand Up @@ -489,7 +489,7 @@ Knowing which companies are using this library is important to help prioritize t

<!-- markdownlint-disable MD051 -->

When [using Layers](#lambda-layer), you can add Powertools for AWS Lambda (Python) as a dev dependency to not impact the development process. For Layers, we pre-package all dependencies, compile and optimize for storage and both x86 and ARM architecture.
When [using Layers](#lambda-layer), you can add Powertools for AWS Lambda (Python) as a dev dependency to not impact the development process. For Layers, we pre-package all dependencies, compile and optimize for storage and both x86_64 and ARM architecture.

<!-- markdownlint-enable MD051 -->

Expand Down
2 changes: 1 addition & 1 deletion docs/maintainers.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ section Git release
Upload attestation : active, 8s

section Layer release
Build (x86+ARM) : active, layer_build, 10:08, 6m
Build (x86_64+ARM) : active, layer_build, 10:08, 6m
Deploy Beta : active, layer_beta, after layer_build, 6.3m
Deploy Prod : active, layer_prod, after layer_beta, 6.3m

Expand Down
2 changes: 1 addition & 1 deletion docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ AWS Lambda will officially block updates to Lambda functions using Python 3.7 su

We want to publish a JSON with a map of region and Lambda Layer ARN as a GitHub Release Note asset.

As of V2, we prioritize Lambda Layers being available before release notes are out. This is due to X86 and ARM64 compilation for smaller binaries and extra speed.
As of V2, we prioritize Lambda Layers being available before release notes are out. This is due to x86_64 and ARM64 compilation for smaller binaries and extra speed.

This means we have room to include a JSON map for Lambda Layers and facilitate automation for customers wanting the latest version as soon as it's available.

Expand Down
2 changes: 1 addition & 1 deletion examples/homepage/install/sar/cdk_sar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Find latest from github.com/aws-powertools/powertools-lambda-python/releases
POWERTOOLS_VER = "3.0.0"
POWERTOOLS_ARN = (
"arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86"
"arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86_64"
)


Expand Down
2 changes: 1 addition & 1 deletion examples/homepage/install/sar/sam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Resources:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86_64
SemanticVersion: 3.0.0 # change to latest semantic version available in SAR

MyLambdaFunction:
Expand Down
2 changes: 1 addition & 1 deletion examples/homepage/install/sar/scoped_down_iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- serverlessrepo:GetCloudFormationTemplate
Resource:
# this is arn of the Powertools for AWS Lambda (Python) SAR app
- arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86
- arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86_64
- Sid: S3AccessLayer
Effect: Allow
Action:
Expand Down
2 changes: 1 addition & 1 deletion examples/homepage/install/sar/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ resources:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86_64
SemanticVersion: 2.0.0
2 changes: 1 addition & 1 deletion examples/homepage/install/sar/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "aws_serverlessapplicationrepository_cloudformation_stack" "deploy_sar_
}

data "aws_serverlessapplicationrepository_application" "sar_app" {
application_id = "arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86"
application_id = "arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86_64"
semantic_version = var.aws_powertools_version
}

Expand Down
4 changes: 2 additions & 2 deletions examples/homepage/install/x86_64/amplify.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
? Do you want to configure advanced settings? Yes
...
? Do you want to enable Lambda layers for this function? Yes
? Enter up to 5 existing Lambda layer ARNs (comma-separated): arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
? Enter up to 5 existing Lambda layer ARNs (comma-separated): arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1
❯ amplify push -y


Expand All @@ -17,5 +17,5 @@ General information
- Name: <NAME-OF-FUNCTION>
? Which setting do you want to update? Lambda layers configuration
? Do you want to enable Lambda layers for this function? Yes
? Enter up to 5 existing Lambda layer ARNs (comma-separated): arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
? Enter up to 5 existing Lambda layer ARNs (comma-separated): arn:aws:lambda:eu-central-1:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1
? Do you want to edit the local lambda function now? No
2 changes: 1 addition & 1 deletion examples/homepage/install/x86_64/cdk_x86.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
powertools_layer = aws_lambda.LayerVersion.from_layer_version_arn(
self,
id="lambda-powertools",
layer_version_arn=f"arn:aws:lambda:{Aws.REGION}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1",
layer_version_arn=f"arn:aws:lambda:{Aws.REGION}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1",
)
aws_lambda.Function(
self,
Expand Down
2 changes: 1 addition & 1 deletion examples/homepage/install/x86_64/pulumi_x86.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
pulumi.Output.concat(
"arn:aws:lambda:",
aws.get_region_output().name,
":017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1",
":017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1",
),
],
tracing_config={"mode": "Active"},
Expand Down
2 changes: 1 addition & 1 deletion examples/homepage/install/x86_64/sam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Resources:
Runtime: python3.12
Handler: app.lambda_handler
Layers:
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1
2 changes: 1 addition & 1 deletion examples/homepage/install/x86_64/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ functions:
handler: lambda_function.lambda_handler
architecture: arm64
layers:
- arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
- arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1
2 changes: 1 addition & 1 deletion examples/homepage/install/x86_64/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ resource "aws_lambda_function" "test_lambda" {
role = aws_iam_role.iam_for_lambda.arn
handler = "index.test"
runtime = "python3.12"
layers = ["arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1"]
layers = ["arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1"]

source_code_hash = filebase64sha256("lambda_function_payload.zip")
}
2 changes: 1 addition & 1 deletion examples/logger/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1

Resources:
LoggerLambdaHandlerExample:
Expand Down
2 changes: 1 addition & 1 deletion examples/metrics/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1

Resources:
CaptureLambdaHandlerExample:
Expand Down
2 changes: 1 addition & 1 deletion examples/metrics_datadog/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1
# Find the latest Layer version in the Datadog official documentation

# Datadog SDK
Expand Down
2 changes: 1 addition & 1 deletion examples/tracer/sam/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Globals:
Layers:
# Find the latest Layer version in the official documentation
# https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86:1
- !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:1

Resources:
CaptureLambdaHandlerExample:
Expand Down
2 changes: 1 addition & 1 deletion layer_v3/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
POWERTOOLS_VERSION: str = app.node.try_get_context("version")
PYTHON_VERSION: str = app.node.try_get_context("pythonVersion")
PYTHON_VERSION_NORMALIZED = PYTHON_VERSION.replace(".", "")
SSM_PARAM_LAYER_ARN: str = f"/layers/powertools-layer-v3-{PYTHON_VERSION_NORMALIZED}-x86-arn"
SSM_PARAM_LAYER_ARN: str = f"/layers/powertools-layer-v3-{PYTHON_VERSION_NORMALIZED}-x86_64-arn"
SSM_PARAM_LAYER_ARM64_ARN: str = f"/layers/powertools-layer-v3-{PYTHON_VERSION_NORMALIZED}-arm64-arn"

# Validate context variables
Expand Down
6 changes: 3 additions & 3 deletions layer_v3/layer/layer_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(
super().__init__(scope, construct_id, **kwargs)

python_version_normalized = python_version.replace(".", "")
layer_name_x86 = f"AWSLambdaPowertoolsPythonV3-{python_version_normalized}-x86"
layer_name_x86_64 = f"AWSLambdaPowertoolsPythonV3-{python_version_normalized}-x86_64"
layer_name_arm64 = f"AWSLambdaPowertoolsPythonV3-{python_version_normalized}-arm64"

if python_version == "python3.8":
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(
layer_single = Layer(
self,
f"LayerSingle-{python_version_normalized}",
layer_version_name=layer_name_x86,
layer_version_name=layer_name_x86_64,
python_version=python_version,
powertools_version=powertools_version,
)
Expand All @@ -142,7 +142,7 @@ def __init__(
layer = Layer(
self,
f"Layer-{python_version_normalized}",
layer_version_name=layer_name_x86,
layer_version_name=layer_name_x86_64,
powertools_version=powertools_version,
python_version=python_version,
architecture=Architecture.X86_64,
Expand Down