Skip to content

docs(homepage): add SAR documentation #6347

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
Mar 25, 2025
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
36 changes: 22 additions & 14 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc

For the latter, make sure to replace `{region}` with your AWS region, e.g., `eu-west-1`, and the `{python_version}` without the period (.), e.g., `python313` for `Python 3.13`.

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

=== "AWS Console"

Expand Down Expand Up @@ -234,12 +234,12 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc

We provide a SAR App that deploys a CloudFormation stack with a copy of our Lambda Layer in your AWS account and region.

Compared with the [public Layer ARN](#lambda-layer) option, the advantage is being able to use a semantic version.
Compared with the [public Layer ARN](#lambda-layer) option, the advantage is being able to use a semantic version. Make sure to replace `{python_version}` without the period (.), e.g., `python313` for `Python 3.13`.

| App | | | ARN |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | --- | ----------------------------------------------------------------------------------------------------------------------------- |
| [**aws-lambda-powertools-python-layer**](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer){target="_blank"} | | | __arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer__{: .copyMe}:clipboard: |
| [**aws-lambda-powertools-python-layer-arm64**](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-arm64){target="_blank"} | | | __arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-arm64__{: .copyMe}:clipboard: |
| App | ARN | Architecture |
| --- | --- | ------------ |
| aws-lambda-powertools-python-layer-v3-{python_version}-x86-64 | arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-{python_version}-x86-64 | X86_64 |
| aws-lambda-powertools-python-layer-v3-{python_version}-arm64 | arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-{python_version}-arm64 | ARM64 |

??? question "Don't have enough permissions? Expand for a least-privilege IAM policy example"

Expand Down Expand Up @@ -328,10 +328,18 @@ Serverless Application Repository (SAR) App deploys a CloudFormation stack with

Compared with the [public Layer ARN](#lambda-layer) option, SAR allows you to choose a semantic version and deploys a Layer in your target account.

| App | ARN | Description |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| [**aws-lambda-powertools-python-layer**](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer](#){: .copyMe}:clipboard: | Contains all extra dependencies (e.g: pydantic). |
| [**aws-lambda-powertools-python-layer-arm64**](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-arm64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-arm64](#){: .copyMe}:clipboard: | Contains all extra dependencies (e.g: pydantic). For arm64 functions. |
| App | ARN | Python version | Architecture |
| --- | --- | -------------- | ------------ |
| [aws-lambda-powertools-python-layer-v3-python39-x86-64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python39-x86-64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python39-x86-64](#){: .copyMe}:clipboard: | Python 3.9 | X86_64 |
| [aws-lambda-powertools-python-layer-v3-python310-x86-64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python310-x86-64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python310-x86-64](#){: .copyMe}:clipboard: | Python 3.10 | X86_64 |
| [aws-lambda-powertools-python-layer-v3-python311-x86-64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python11-x86-64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python311-x86-64](#){: .copyMe}:clipboard: | Python 3.11 | X86_64 |
| [aws-lambda-powertools-python-layer-v3-python312-x86-64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python12-x86-64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-x86-64](#){: .copyMe}:clipboard: | Python 3.12 | X86_64 |
| [aws-lambda-powertools-python-layer-v3-python313-x86-64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python313-x86-64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python313-x86-64](#){: .copyMe}:clipboard: | Python 3.13 | X86_64 |
| [aws-lambda-powertools-python-layer-v3-python39-arm64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python39-arm64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python39-arm64](#){: .copyMe}:clipboard: | Python 3.9 | ARM64 |
| [aws-lambda-powertools-python-layer-v3-python310-arm64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python310-arm64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python310-arm64](#){: .copyMe}:clipboard: | Python 3.10 | ARM64 |
| [aws-lambda-powertools-python-layer-v3-python311-arm64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python11-arm64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python311-arm64](#){: .copyMe}:clipboard: | Python 3.11 | ARM64 |
| [aws-lambda-powertools-python-layer-v3-python312-arm64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python12-arm64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python312-arm64](#){: .copyMe}:clipboard: | Python 3.12 | ARM64 |
| [aws-lambda-powertools-python-layer-v3-python313-arm64](https://serverlessrepo.aws.amazon.com/applications/eu-west-1/057560766410/aws-lambda-powertools-python-layer-v3-python313-arm64){target="_blank"} | [arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python313-arm64](#){: .copyMe}:clipboard: | Python 3.13 | ARM64 |

??? note "Click to expand and copy SAR code snippets for popular frameworks"

Expand All @@ -351,7 +359,7 @@ Compared with the [public Layer ARN](#lambda-layer) option, SAR allows you to ch

=== "CDK"

```python hl_lines="7 16-20 23-27"
```python hl_lines="8 16-20 23-27"
--8<-- "examples/homepage/install/sar/cdk_sar.py"
```

Expand Down
6 changes: 3 additions & 3 deletions examples/homepage/install/sar/cdk_sar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

POWERTOOLS_BASE_NAME = "AWSLambdaPowertools"
# Find latest from github.com/aws-powertools/powertools-lambda-python/releases
POWERTOOLS_VER = "2.43.1"
POWERTOOLS_VER = "3.0.9"
POWERTOOLS_ARN = (
"arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer"
"arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python313-x86-64"
)


Expand All @@ -31,7 +31,7 @@ def __init__(self, scope: Construct, id_: str) -> None:
aws_lambda.Function(
self,
"sample-app-lambda",
runtime=aws_lambda.Runtime.PYTHON_3_12,
runtime=aws_lambda.Runtime.PYTHON_3_13,
function_name="sample-lambda",
code=aws_lambda.Code.from_asset("lambda"),
handler="hello.handler",
Expand Down
6 changes: 3 additions & 3 deletions examples/homepage/install/sar/sam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Resources:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer
SemanticVersion: 2.43.1 # change to latest semantic version available in SAR
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python313-x86-64
SemanticVersion: 3.0.9 # change to latest semantic version available in SAR

MyLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.12
Runtime: python3.13
Handler: app.lambda_handler
Layers:
# fetch Layer ARN from SAR App stack output
Expand Down
6 changes: 3 additions & 3 deletions 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_64
- arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python313-x86-64
- Sid: S3AccessLayer
Effect: Allow
Action:
Expand All @@ -42,14 +42,14 @@
# AWS publishes to an external S3 bucket locked down to your account ID
# The below example is us publishing Powertools for AWS Lambda (Python)
# Bucket: awsserverlessrepo-changesets-plntc6bfnfj
# Key: *****/arn:aws:serverlessrepo:eu-west-1:057560766410:applications-aws-lambda-powertools-python-layer-versions-1.10.2/aeeccf50-****-****-****-*********
# Key: *****/arn:aws:serverlessrepo:eu-west-1:057560766410:applications-aws-lambda-powertools-python-layer-v3-python313-x86-64-3.0.9/aeeccf50-****-****-****-*********
- arn:aws:s3:::awsserverlessrepo-changesets-*/*
- Sid: GetLayerVersion
Effect: Allow
Action:
- lambda:PublishLayerVersion
- lambda:GetLayerVersion
Resource:
- !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:layer:aws-lambda-powertools-python-layer*
- !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:layer:aws-lambda-powertools-python-layer-v3*
Roles:
- Ref: "PowertoolsLayerIamRole"
6 changes: 3 additions & 3 deletions examples/homepage/install/sar/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ service: powertools-lambda

provider:
name: aws
runtime: python3.12
runtime: python3.13
region: us-east-1

functions:
Expand All @@ -16,5 +16,5 @@ resources:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:057560766410:applications/aws-lambda-powertools-python-layer
SemanticVersion: 2.43.1
ApplicationId: arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer-v3-python313-x86-64
SemanticVersion: 3.0.9
4 changes: 2 additions & 2 deletions examples/homepage/install/sar/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ resource "aws_serverlessapplicationrepository_cloudformation_stack" "deploy_sar_
}

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

variable "aws_powertools_version" {
type = string
default = "2.43.1"
default = "3.0.9"
description = "The Powertools for AWS Lambda (Python) release version"
}

Expand Down
Loading