From 7ffcf584bb82d43c3224de36ec35098e452b4096 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Tue, 25 Jul 2023 14:39:50 +0200 Subject: [PATCH 01/21] fix(parameters): make cache aware of single vs multiple calls Signed-off-by: heitorlessa --- aws_lambda_powertools/utilities/parameters/base.py | 2 +- aws_lambda_powertools/utilities/parameters/types.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/aws_lambda_powertools/utilities/parameters/base.py b/aws_lambda_powertools/utilities/parameters/base.py index 710634636d0..411a2520ae9 100644 --- a/aws_lambda_powertools/utilities/parameters/base.py +++ b/aws_lambda_powertools/utilities/parameters/base.py @@ -27,7 +27,7 @@ from aws_lambda_powertools.shared import constants, user_agent from aws_lambda_powertools.shared.functions import resolve_max_age -from aws_lambda_powertools.utilities.parameters.types import TransformOptions +from aws_lambda_powertools.utilities.parameters.types import RecursiveOptions, TransformOptions from .exceptions import GetParameterError, TransformParameterError diff --git a/aws_lambda_powertools/utilities/parameters/types.py b/aws_lambda_powertools/utilities/parameters/types.py index faa06cee89e..a916f1a344d 100644 --- a/aws_lambda_powertools/utilities/parameters/types.py +++ b/aws_lambda_powertools/utilities/parameters/types.py @@ -1,3 +1,4 @@ from aws_lambda_powertools.shared.types import Literal TransformOptions = Literal["json", "binary", "auto", None] +RecursiveOptions = Literal[True, False] From b9be4e96b0130833578f869bb2d0b5586429334c Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Tue, 25 Jul 2023 15:16:51 +0200 Subject: [PATCH 02/21] chore: cleanup, add test for single and nested Signed-off-by: heitorlessa --- aws_lambda_powertools/utilities/parameters/base.py | 2 +- aws_lambda_powertools/utilities/parameters/types.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/aws_lambda_powertools/utilities/parameters/base.py b/aws_lambda_powertools/utilities/parameters/base.py index 411a2520ae9..710634636d0 100644 --- a/aws_lambda_powertools/utilities/parameters/base.py +++ b/aws_lambda_powertools/utilities/parameters/base.py @@ -27,7 +27,7 @@ from aws_lambda_powertools.shared import constants, user_agent from aws_lambda_powertools.shared.functions import resolve_max_age -from aws_lambda_powertools.utilities.parameters.types import RecursiveOptions, TransformOptions +from aws_lambda_powertools.utilities.parameters.types import TransformOptions from .exceptions import GetParameterError, TransformParameterError diff --git a/aws_lambda_powertools/utilities/parameters/types.py b/aws_lambda_powertools/utilities/parameters/types.py index a916f1a344d..faa06cee89e 100644 --- a/aws_lambda_powertools/utilities/parameters/types.py +++ b/aws_lambda_powertools/utilities/parameters/types.py @@ -1,4 +1,3 @@ from aws_lambda_powertools.shared.types import Literal TransformOptions = Literal["json", "binary", "auto", None] -RecursiveOptions = Literal[True, False] From 9eebe720eedcaf7b840ba32da5be53c32033d92f Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 14:42:22 +0100 Subject: [PATCH 03/21] docs: key areas over themes; add launch/drop sections Signed-off-by: heitorlessa --- docs/roadmap.md | 70 ++++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index 766733c754c..496fa3b55de 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -2,17 +2,13 @@ ## Overview -Our public roadmap outlines the high level direction we are working towards, namely [Themes](#themes). We update this document when our priorities change: security and stability is our top priority. +Our public roadmap outlines the high level direction we are working towards. We update this document when our priorities change: security and stability are our top priority. -!!! info "For most up-to-date information, see our [board of activities](https://github.com/orgs/aws-powertools/projects/3/views/2?query=is%3Aopen+sort%3Aupdated-desc){target="_blank"}." +!!! info "See our [current iteration cycle](https://github.com/orgs/aws-powertools/projects/3/views/14?query=is%3Aopen+sort%3Aupdated-desc){target="_blank"} for the most up-to-date information." -## Themes +## Key areas -Operational Excellence is priority number 1. This means bug fixing, stability, security, customer's support, and governance will take precedence above all else. - -**What are themes?** - -They are key activities maintainers are focusing on. These are updated periodically and you can find the latest [under Themes in our public board](https://github.com/orgs/aws-powertools/projects/3/views/11?query=is%3Aopen+sort%3Aupdated-desc){target="_blank"}. +Security and operational excellence take precedence above all else. This means bug fixing, stability, customer's support, and internal compliance may delay one or more key areas below. ### Observability providers @@ -29,17 +25,6 @@ At launch, we will support Datadog since it's [most requested observability prov - [ ] [Extend Tracer to add support for any Provider](https://github.com/aws-powertools/powertools-lambda-python/issues/2030) - [ ] Investigate alternative solution to OpenTelemetry cold start performance -### Sensitive Data Masking - -Data Masking will be a new utility to mask/unmask sensitive data using encryption providers. It's the second most voted feature request (behind [Observability Providers](#observability-providers)). - -**Major updates** - -- [x] [RFC to agree on design and MVP](https://github.com/aws-powertools/powertools-lambda-python/issues/1858) -- [x] [POC with AWS KMS as the default provider](https://github.com/aws-powertools/powertools-lambda-python/pull/2197) -- [ ] User-guide documentation and include when not to use it (e.g., when to use SNS data policy, CloudWatch Logs data policy) -- [ ] Decide whether to use Encryption SDK to bring their own provider or a simply a contract (e.g., `ItsDangerous`) - ### Revamp Event Handler Event Handler provides lightweight routing for both [**REST**: Amazon API Gateway, Amazon Elastic Load Balancer and AWS Lambda Function URL](./core/event_handler/api_gateway.md), and [**GraphQL**: AWS AppSync](./core/event_handler/appsync.md). @@ -51,22 +36,9 @@ Based on customers feedback, we want to provide middleware authoring support for - [x] [Agree on experience for middleware support](https://github.com/aws-powertools/powertools-lambda-python/issues/953#issuecomment-1450223155) - [x] [RFC to outline initial thoughts on OpenAPI integration](https://github.com/aws-powertools/powertools-lambda-python/issues/2421) - [x] [MVP for REST middleware](./core/event_handler/api_gateway.md#middleware) -- [ ] [MVP for OpenAPI and SwaggerUI](https://github.com/aws-powertools/powertools-lambda-python/pull/3109) +- [x] [MVP for OpenAPI and SwaggerUI](https://github.com/aws-powertools/powertools-lambda-python/pull/3109) - [ ] [MVP for AppSync Batch invoke and partial failure support](https://github.com/aws-powertools/powertools-lambda-python/pull/1998) -### Lambda Layer in release notes - -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. - -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. - -**Major updates** - -- [x] Create secure mechanism to upload signed assets to GitHub Release Notes -- [ ] Create feature request to agree on JSON structure and asset name - ### Office hours We heard from [customers](https://github.com/aws-powertools/powertools-lambda-python#connect){target="_blank"} that Powertools for AWS Lambda and its community can move faster than they are able to catch up. While documentation and release notes take these into account, they notice they don't always know advanced tricks, or what other customers tend to do in similar situations. @@ -204,3 +176,35 @@ A: Because job zero is security and operational stability, we can't provide spec **Q: How can I provide feedback or ask for more information?** A: For existing features, you can directly comment on issues. For anything else, please open an issue. + +## Launched + +### Sensitive Data Masking + +> [Docs](./utilities/data_masking.md) + +Data Masking will be a new utility to mask/unmask sensitive data using encryption providers. It's the second most voted feature request (behind [Observability Providers](#observability-providers)). + +**Major updates** + +- [x] [RFC to agree on design and MVP](https://github.com/aws-powertools/powertools-lambda-python/issues/1858) +- [x] [POC with AWS KMS as the default provider](https://github.com/aws-powertools/powertools-lambda-python/pull/2197) +- [x] User-guide documentation and include when not to use it (e.g., when to use SNS data policy, CloudWatch Logs data policy) +- [x] Decide whether to use Encryption SDK to bring their own provider or a simply a contract (e.g., `ItsDangerous`) + +## Dropped + +### Lambda Layer in release notes + +> **Update**: We are looking at more accessible alternatives based on customer feedback (e.g., AWS System Manager public parameters) + +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. + +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. + +**Major updates** + +- [x] Create secure mechanism to upload signed assets to GitHub Release Notes +- [ ] Create feature request to agree on JSON structure and asset name From 7157cb01791c6f8d055c338f60c08d75be318038 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 14:45:54 +0100 Subject: [PATCH 04/21] docs: add links to launched event handler feat --- docs/roadmap.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index 496fa3b55de..9d83f065606 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -29,7 +29,9 @@ At launch, we will support Datadog since it's [most requested observability prov Event Handler provides lightweight routing for both [**REST**: Amazon API Gateway, Amazon Elastic Load Balancer and AWS Lambda Function URL](./core/event_handler/api_gateway.md), and [**GraphQL**: AWS AppSync](./core/event_handler/appsync.md). -Based on customers feedback, we want to provide middleware authoring support for cross-cutting concerns. For REST APIs, we are also looking into auto-generate OpenAPI Schemas and a SwaggerUI route. For GraphQL, we are working on supporting batch invocations (N+1 problem) along with partial failure support. + +Based on customers feedback, we want to provide [middleware authoring support](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#middleware) for cross-cutting concerns. For REST APIs, we are also looking into auto-generate [OpenAPI Schemas](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#data-validation) and a [SwaggerUI route](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/#enabling-swaggerui). For GraphQL, we are working on supporting batch invocations (N+1 problem) along with partial failure support. + **Major updates** From 95f042bc45f142cb8ec2ef600b8466f0e934ae44 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 14:49:47 +0100 Subject: [PATCH 05/21] docs: add last office hours items --- docs/roadmap.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index 9d83f065606..cbc5958103d 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -51,7 +51,11 @@ Timezones being tricky, we plan to experiment with an afternoon slot in Central **Major updates** -- [ ] Decide whether to use Amazon Chime or Zoom (we had audio setup issues on Discord) +- [x] Decide whether to use Amazon Chime or Zoom (we had audio setup issues on Discord) +- [ ] Experiment running monthly roadmap review as an open call + - [ ] Settle on monthly roadmap review agenda + - [ ] Invite Discord community + - [ ] Update roadmap page with Discord event ### Authentication (SigV4) From 8ad35a75275b44db36a36aa1861b87564bf9b34a Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 14:51:31 +0100 Subject: [PATCH 06/21] docs: link sigv4 mvp until RFC is complete --- docs/roadmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index cbc5958103d..28712a818dc 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -66,7 +66,7 @@ Since JWT is a close second, this new utility would cover higher level functions **Major updates** - [ ] RFC to outline challenges, alternative solutions and desired experience -- [ ] MVP based off RFC +- [ ] [MVP for AWS SigV4](https://github.com/aws-powertools/powertools-lambda-python/pull/2435) ### Enhanced operational metrics From a077c45805bcfc13a449496e09b52e7300106a82 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:01:11 +0100 Subject: [PATCH 07/21] docs: update feedback email Signed-off-by: heitorlessa --- .github/actions/create-pr/action.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 2 +- docs/roadmap.md | 2 +- docs/tutorial/index.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/create-pr/action.yml b/.github/actions/create-pr/action.yml index dcf2df738bd..6e40deeff66 100644 --- a/.github/actions/create-pr/action.yml +++ b/.github/actions/create-pr/action.yml @@ -64,7 +64,7 @@ runs: name: Git client setup and refresh tip run: | git config user.name "Powertools for AWS Lambda (Python) bot" - git config user.email "aws-lambda-powertools-feedback@amazon.com" + git config user.email "aws-powertools-maintainers@amazon.com" git config pull.rebase true git config remote.origin.url >&- shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fac762bdbeb..a5116d5a186 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -273,7 +273,7 @@ jobs: name: Git client setup and refresh tip run: | git config user.name "Powertools for AWS Lambda (Python) bot" - git config user.email "aws-lambda-powertools-feedback@amazon.com" + git config user.email "aws-powertools-maintainers@amazon.com" git config remote.origin.url >&- - name: Create Git Tag diff --git a/README.md b/README.md index c1ab7abaf29..bc7eb9a3dbe 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ This helps us understand who uses Powertools for AWS Lambda (Python) in a non-in ## Connect * **Powertools for AWS Lambda on Discord**: `#python` - **[Invite link](https://discord.gg/B8zZKbbyET)** -* **Email**: +* **Email**: ## Security disclosures diff --git a/docs/roadmap.md b/docs/roadmap.md index 28712a818dc..f1b8b50fed8 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -87,7 +87,7 @@ We want to make this easier by extending certain utilities to accept a `metrics` We want to investigate security and scaling requirements for these special regions, so they're in sync for every release. -!!! note "Help us prioritize it by reaching out to your AWS representatives or [via email](mailto:aws-lambda-powertools-feedback@amazon.com)." +!!! note "Help us prioritize it by reaching out to your AWS representatives or [via email](mailto:aws-powertools-maintainers@amazon.com)." **Major updates** diff --git a/docs/tutorial/index.md b/docs/tutorial/index.md index 5442a213562..c5acf22cead 100644 --- a/docs/tutorial/index.md +++ b/docs/tutorial/index.md @@ -1045,4 +1045,4 @@ This requires a change in mindset to ensure operational excellence is part of th Powertools for AWS Lambda (Python) is largely designed to make some of these practices easier to adopt from day 1. ???+ question "Have ideas for other tutorials?" - You can open up a [documentation issue](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=documentation&template=documentation-improvements.md&title=Tutorial%20Suggestion){target="_blank"}, or via e-mail [aws-lambda-powertools-feedback@amazon.com](mailto:aws-lambda-powertools-feedback@amazon.com). + You can open up a [documentation issue](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=documentation&template=documentation-improvements.md&title=Tutorial%20Suggestion){target="_blank"}, or via e-mail [aws-powertools-maintainers@amazon.com](mailto:aws-powertools-maintainers@amazon.com). From 9ad59985440c0bac7c8efae34a7eda9957011e86 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:02:32 +0100 Subject: [PATCH 08/21] docs: update govcloud items Signed-off-by: heitorlessa --- docs/roadmap.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index f1b8b50fed8..d7b875d6d0e 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -93,7 +93,9 @@ We want to investigate security and scaling requirements for these special regio - [x] Gather agencies and customers name to prioritize it - [x] Investigate security requirements for special regions -- [ ] Create additional infrastructure for special regions +- [x] Create additional infrastructure for special regions +- [ ] AppSec review +- [ ] Distribution sign-off - [ ] Update CDK Layer construct to include regions ### V3 From 0e3048cf81722f1744a3885a1e090affbeb83bc9 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:04:25 +0100 Subject: [PATCH 09/21] docs: link versioning process --- docs/roadmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index d7b875d6d0e..792a81befe9 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -100,7 +100,7 @@ We want to investigate security and scaling requirements for these special regio ### V3 -We are in the process of planning the roadmap for v3. As always, our approach includes providing sufficient advance notice, a comprehensive upgrade guide, and minimizing breaking changes to facilitate a smooth transition (e.g., it took ~7 months from v2 to surpass v1 downloads). +We are in the process of planning the roadmap for v3. As always, [our approach](./versioning.md){target="_blank"} includes providing sufficient advance notice, a comprehensive upgrade guide, and minimizing breaking changes to facilitate a smooth transition (e.g., it took ~7 months from v2 to surpass v1 downloads). For example, these are on our mind but not settled yet until we have a public tracker to discuss what these means in detail. From 14c795806e3833cbe7f26988ffc9003176b18a52 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:13:07 +0100 Subject: [PATCH 10/21] docs: add bedrock --- docs/roadmap.md | 119 +++++++++++++++++++++++++++--------------------- 1 file changed, 66 insertions(+), 53 deletions(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index 792a81befe9..fbf96dc9eb3 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -10,6 +10,19 @@ Our public roadmap outlines the high level direction we are working towards. We Security and operational excellence take precedence above all else. This means bug fixing, stability, customer's support, and internal compliance may delay one or more key areas below. +### Amazon Bedrock Agent Event Handler + +Based on [customers](https://github.com/aws-powertools/powertools-lambda-python#connect){target="_blank"} at re:Invent 2023, we will add a new Event Handler resolver to improve authoring and maintenance of Amazon Bedrock Agents. + +**Major updates** + +* [x] [Event Source Data Classes support](https://github.com/aws-powertools/powertools-lambda-python/pull/3262) +* [x] [Pydantic model _(Parser)_ support](https://github.com/aws-powertools/powertools-lambda-python/pull/3286) +* [x] [MVP Event Handler](https://github.com/aws-powertools/powertools-lambda-python/pull/3285) +* [ ] [New feature documentation](https://github.com/aws-powertools/powertools-lambda-python/pull/3602) +* [ ] Video to walkthrough use cases for anyone new to LLM Agents +* [ ] Launch amplifier (_e.g., What's New, Blog post_) + ### Observability providers We want to extend Tracer, Metrics, and Logger to support any [AWS Lambda certified observability partner](https://go.aws/3HtU6CZ){target="_blank"}, along with OpenTelemetry. @@ -20,10 +33,10 @@ At launch, we will support Datadog since it's [most requested observability prov **Major updates** -- [x] [Document how customers can use any provider with Logger](https://docs.powertools.aws.dev/lambda/python/latest/core/logger/#observability-providers) -- [x] [Extend Metrics to add support for any Provider](https://github.com/aws-powertools/powertools-lambda-python/pull/2194) -- [ ] [Extend Tracer to add support for any Provider](https://github.com/aws-powertools/powertools-lambda-python/issues/2030) -- [ ] Investigate alternative solution to OpenTelemetry cold start performance +* [x] [Document how customers can use any provider with Logger](https://docs.powertools.aws.dev/lambda/python/latest/core/logger/#observability-providers) +* [x] [Extend Metrics to add support for any Provider](https://github.com/aws-powertools/powertools-lambda-python/pull/2194) +* [ ] [Extend Tracer to add support for any Provider](https://github.com/aws-powertools/powertools-lambda-python/issues/2030) +* [ ] Investigate alternative solution to OpenTelemetry cold start performance ### Revamp Event Handler @@ -35,11 +48,11 @@ Based on customers feedback, we want to provide [middleware authoring support](h **Major updates** -- [x] [Agree on experience for middleware support](https://github.com/aws-powertools/powertools-lambda-python/issues/953#issuecomment-1450223155) -- [x] [RFC to outline initial thoughts on OpenAPI integration](https://github.com/aws-powertools/powertools-lambda-python/issues/2421) -- [x] [MVP for REST middleware](./core/event_handler/api_gateway.md#middleware) -- [x] [MVP for OpenAPI and SwaggerUI](https://github.com/aws-powertools/powertools-lambda-python/pull/3109) -- [ ] [MVP for AppSync Batch invoke and partial failure support](https://github.com/aws-powertools/powertools-lambda-python/pull/1998) +* [x] [Agree on experience for middleware support](https://github.com/aws-powertools/powertools-lambda-python/issues/953#issuecomment-1450223155) +* [x] [RFC to outline initial thoughts on OpenAPI integration](https://github.com/aws-powertools/powertools-lambda-python/issues/2421) +* [x] [MVP for REST middleware](./core/event_handler/api_gateway.md#middleware) +* [x] [MVP for OpenAPI and SwaggerUI](https://github.com/aws-powertools/powertools-lambda-python/pull/3109) +* [ ] [MVP for AppSync Batch invoke and partial failure support](https://github.com/aws-powertools/powertools-lambda-python/pull/1998) ### Office hours @@ -51,11 +64,11 @@ Timezones being tricky, we plan to experiment with an afternoon slot in Central **Major updates** -- [x] Decide whether to use Amazon Chime or Zoom (we had audio setup issues on Discord) -- [ ] Experiment running monthly roadmap review as an open call - - [ ] Settle on monthly roadmap review agenda - - [ ] Invite Discord community - - [ ] Update roadmap page with Discord event +* [x] Decide whether to use Amazon Chime or Zoom (we had audio setup issues on Discord) +* [ ] Experiment running monthly roadmap review as an open call + * [ ] Settle on monthly roadmap review agenda + * [ ] Invite Discord community + * [ ] Update roadmap page with Discord event ### Authentication (SigV4) @@ -65,8 +78,8 @@ Since JWT is a close second, this new utility would cover higher level functions **Major updates** -- [ ] RFC to outline challenges, alternative solutions and desired experience -- [ ] [MVP for AWS SigV4](https://github.com/aws-powertools/powertools-lambda-python/pull/2435) +* [ ] RFC to outline challenges, alternative solutions and desired experience +* [ ] [MVP for AWS SigV4](https://github.com/aws-powertools/powertools-lambda-python/pull/2435) ### Enhanced operational metrics @@ -78,10 +91,10 @@ We want to make this easier by extending certain utilities to accept a `metrics` **Major updates** -- [ ] RFC to outline metrics for Batch (_e.g., Failed items, Batch size_) -- [ ] RFC to outline metrics for Feature flags (_e.g., matched rules_) -- [ ] RFC to outline metrics for Event Handler (_e.g., validation errors_ ) -- [ ] RFC to outline metrics for Idempotency (_e.g., cache hit_) +* [ ] RFC to outline metrics for Batch (_e.g., Failed items, Batch size_) +* [ ] RFC to outline metrics for Feature flags (_e.g., matched rules_) +* [ ] RFC to outline metrics for Event Handler (_e.g., validation errors_ ) +* [ ] RFC to outline metrics for Idempotency (_e.g., cache hit_) ### Lambda Layer in GovCloud and China region @@ -91,12 +104,12 @@ We want to investigate security and scaling requirements for these special regio **Major updates** -- [x] Gather agencies and customers name to prioritize it -- [x] Investigate security requirements for special regions -- [x] Create additional infrastructure for special regions -- [ ] AppSec review -- [ ] Distribution sign-off -- [ ] Update CDK Layer construct to include regions +* [x] Gather agencies and customers name to prioritize it +* [x] Investigate security requirements for special regions +* [x] Create additional infrastructure for special regions +* [ ] AppSec review +* [ ] Distribution sign-off +* [ ] Update CDK Layer construct to include regions ### V3 @@ -104,19 +117,19 @@ We are in the process of planning the roadmap for v3. As always, [our approach]( For example, these are on our mind but not settled yet until we have a public tracker to discuss what these means in detail. -- **Parser**: Drop Pydantic v1 -- **Parser**: Deserialize Amazon DynamoDB data types automatically (like Event Source Data Classes) -- **Parameters**: Increase default `max_age` for `get_secret` -- **Event Source Data Classes**: Return sane defaults for any property that has `Optional[]` returns -- **Upgrade tool**: Consider building a CST (Concrete Syntax Tree) tool to ease certain upgrade actions like `pyupgrade` and `django-upgrade` -- **Batch**: Stop at first error for Amazon DynamoDB Streams and Amazon Kinesis Data Streams (e.g., `stop_on_failure=True`) +* **Parser**: Drop Pydantic v1 +* **Parser**: Deserialize Amazon DynamoDB data types automatically (like Event Source Data Classes) +* **Parameters**: Increase default `max_age` for `get_secret` +* **Event Source Data Classes**: Return sane defaults for any property that has `Optional[]` returns +* **Upgrade tool**: Consider building a CST (Concrete Syntax Tree) tool to ease certain upgrade actions like `pyupgrade` and `django-upgrade` +* **Batch**: Stop at first error for Amazon DynamoDB Streams and Amazon Kinesis Data Streams (e.g., `stop_on_failure=True`) **Major updates** -- [ ] Create an issue to track breaking changes we consider making -- [ ] Create a v3 branch to allow early experimentation -- [ ] Create workflows to allow pre-releases -- [ ] Create a mechanism to keep ideas for breaking change somewhere regardless of v3 +* [ ] Create an issue to track breaking changes we consider making +* [ ] Create a v3 branch to allow early experimentation +* [ ] Create workflows to allow pre-releases +* [ ] Create a mechanism to keep ideas for breaking change somewhere regardless of v3 ## Roadmap status definition @@ -130,11 +143,11 @@ graph LR Within our [public board](https://github.com/orgs/aws-powertools/projects/3/views/1?query=is%3Aopen+sort%3Aupdated-desc){target="_blank"}, you'll see the following values in the `Status` column: -- **Ideas**. Incoming and existing feature requests that are not being actively considered yet. These will be reviewed when bandwidth permits. -- **Backlog**. Accepted feature requests or enhancements that we want to work on. -- **Working on it**. Features or enhancements we're currently either researching or implementing it. -- **Coming soon**. Any feature, enhancement, or bug fixes that have been merged and are coming in the next release. -- **Shipped**. Features or enhancements that are now available in the most recent release. +* **Ideas**. Incoming and existing feature requests that are not being actively considered yet. These will be reviewed when bandwidth permits. +* **Backlog**. Accepted feature requests or enhancements that we want to work on. +* **Working on it**. Features or enhancements we're currently either researching or implementing it. +* **Coming soon**. Any feature, enhancement, or bug fixes that have been merged and are coming in the next release. +* **Shipped**. Features or enhancements that are now available in the most recent release. > Tasks or issues with empty `Status` will be categorized in upcoming review cycles. @@ -156,12 +169,12 @@ graph LR Our end-to-end mechanism follows four major steps: -- **Feature Request**. Ideas start with a [feature request](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=feature-request%2Ctriage&template=feature_request.yml&title=Feature+request%3A+TITLE){target="_blank"} to outline their use case at a high level. For complex use cases, maintainers might ask for/write a RFC. - - Maintainers review requests based on [project tenets](index.md#tenets){target="_blank"}, customers reaction (👍), and use cases. -- **Request-for-comments (RFC)**. Design proposals use our [RFC issue template](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=RFC%2Ctriage&template=rfc.yml&title=RFC%3A+TITLE){target="_blank"} to describe its implementation, challenges, developer experience, dependencies, and alternative solutions. - - This helps refine the initial idea with community feedback before a decision is made. -- **Decision**. After carefully reviewing and discussing them, maintainers make a final decision on whether to start implementation, defer or reject it, and update everyone with the next steps. -- **Implementation**. For approved features, maintainers give priority to the original authors for implementation unless it is a sensitive task that is best handled by maintainers. +* **Feature Request**. Ideas start with a [feature request](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=feature-request%2Ctriage&template=feature_request.yml&title=Feature+request%3A+TITLE){target="_blank"} to outline their use case at a high level. For complex use cases, maintainers might ask for/write a RFC. + * Maintainers review requests based on [project tenets](index.md#tenets){target="_blank"}, customers reaction (👍), and use cases. +* **Request-for-comments (RFC)**. Design proposals use our [RFC issue template](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=RFC%2Ctriage&template=rfc.yml&title=RFC%3A+TITLE){target="_blank"} to describe its implementation, challenges, developer experience, dependencies, and alternative solutions. + * This helps refine the initial idea with community feedback before a decision is made. +* **Decision**. After carefully reviewing and discussing them, maintainers make a final decision on whether to start implementation, defer or reject it, and update everyone with the next steps. +* **Implementation**. For approved features, maintainers give priority to the original authors for implementation unless it is a sensitive task that is best handled by maintainers. ???+ info "See [Maintainers](https://github.com/aws-powertools/powertools-lambda-python/blob/develop/MAINTAINERS.md){target="_blank"} document to understand how we triage issues and pull requests, labels and governance." @@ -195,10 +208,10 @@ Data Masking will be a new utility to mask/unmask sensitive data using encryptio **Major updates** -- [x] [RFC to agree on design and MVP](https://github.com/aws-powertools/powertools-lambda-python/issues/1858) -- [x] [POC with AWS KMS as the default provider](https://github.com/aws-powertools/powertools-lambda-python/pull/2197) -- [x] User-guide documentation and include when not to use it (e.g., when to use SNS data policy, CloudWatch Logs data policy) -- [x] Decide whether to use Encryption SDK to bring their own provider or a simply a contract (e.g., `ItsDangerous`) +* [x] [RFC to agree on design and MVP](https://github.com/aws-powertools/powertools-lambda-python/issues/1858) +* [x] [POC with AWS KMS as the default provider](https://github.com/aws-powertools/powertools-lambda-python/pull/2197) +* [x] User-guide documentation and include when not to use it (e.g., when to use SNS data policy, CloudWatch Logs data policy) +* [x] Decide whether to use Encryption SDK to bring their own provider or a simply a contract (e.g., `ItsDangerous`) ## Dropped @@ -214,5 +227,5 @@ This means we have room to include a JSON map for Lambda Layers and facilitate a **Major updates** -- [x] Create secure mechanism to upload signed assets to GitHub Release Notes -- [ ] Create feature request to agree on JSON structure and asset name +* [x] Create secure mechanism to upload signed assets to GitHub Release Notes +* [ ] Create feature request to agree on JSON structure and asset name From f1659d8e99c3d493c6a278eb4fa08cd824ce3100 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:20:09 +0100 Subject: [PATCH 11/21] docs: add py3.7 area --- docs/roadmap.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/roadmap.md b/docs/roadmap.md index fbf96dc9eb3..7dac148ffba 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -213,6 +213,16 @@ Data Masking will be a new utility to mask/unmask sensitive data using encryptio * [x] User-guide documentation and include when not to use it (e.g., when to use SNS data policy, CloudWatch Logs data policy) * [x] Decide whether to use Encryption SDK to bring their own provider or a simply a contract (e.g., `ItsDangerous`) +### Deprecate Python 3.7 support + +AWS Lambda will officially block updates to Lambda functions using Python 3.7 support. We will drop support as soon as [that is official](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html#runtime-support-policy){target="_blank"}. + +**Major updates** + +* [x] [Drop Python 3.7 support](https://github.com/aws-powertools/powertools-lambda-python/pull/3638) +* [x] [Add documentation banner](https://github.com/aws-powertools/powertools-lambda-python/pull/3618) +* [x] [Publish versioning policy docs](https://github.com/aws-powertools/powertools-lambda-python/pull/3682) + ## Dropped ### Lambda Layer in release notes From 561d59309c7cb454b93f6883e34f62a6ff5c080e Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:20:48 +0100 Subject: [PATCH 12/21] docs: update wording on why an item was dropped --- docs/roadmap.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/roadmap.md b/docs/roadmap.md index 7dac148ffba..74d031e0511 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -227,7 +227,7 @@ AWS Lambda will officially block updates to Lambda functions using Python 3.7 su ### Lambda Layer in release notes -> **Update**: We are looking at more accessible alternatives based on customer feedback (e.g., AWS System Manager public parameters) +> **Reason**: We are looking at more accessible alternatives based on customer feedback (e.g., AWS System Manager public parameters) We want to publish a JSON with a map of region and Lambda Layer ARN as a GitHub Release Note asset. From f14e3c477e0162413af934da3c3f3a3c345f2d65 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:32:53 +0100 Subject: [PATCH 13/21] docs: add parameters set area --- docs/roadmap.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/roadmap.md b/docs/roadmap.md index 74d031e0511..6395bc344de 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -23,6 +23,15 @@ Based on [customers](https://github.com/aws-powertools/powertools-lambda-python# * [ ] Video to walkthrough use cases for anyone new to LLM Agents * [ ] Launch amplifier (_e.g., What's New, Blog post_) +### Setting Parameters and Secrets + +As of today, the [Parameters](./utilities/parameters.md){target="_blank"} feature is used to retrieve data, not to create or update existing parameters. Based on community feedback, we plan to enhance Parameters to allow set operations. + +**Major updates** + +* [x] [RFC](https://github.com/aws-powertools/powertools-lambda-python/issues/3040) +* [ ] [MVP](https://github.com/aws-powertools/powertools-lambda-python/pull/2858) + ### Observability providers We want to extend Tracer, Metrics, and Logger to support any [AWS Lambda certified observability partner](https://go.aws/3HtU6CZ){target="_blank"}, along with OpenTelemetry. From 23efceec782a93acd08d4263ad0d2a1eb40364b3 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:39:37 +0100 Subject: [PATCH 14/21] docs: remove python 3.7 banner Signed-off-by: heitorlessa --- docs/overrides/main.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/overrides/main.html b/docs/overrides/main.html index 44935986883..6b741c797cf 100644 --- a/docs/overrides/main.html +++ b/docs/overrides/main.html @@ -1,8 +1,6 @@ {% extends "base.html" %} {% block announce %} -

🚨 As of February 8, 2024, AWS Lambda will no longer allow Python 3.7 functions to be updated. Inline with this, Powertools releases will stop supporting it.

-

Please ensure you update your functions to Python 3.8 or later to continue to use the latest version of Powertools for AWS Lambda (Python).

{% endblock %} {% block outdated %} From b0aba63cf44da445a669dbffd0e0f128b5213741 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Mon, 12 Feb 2024 15:48:37 +0100 Subject: [PATCH 15/21] docs: enable code tab deep linking --- mkdocs.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mkdocs.yml b/mkdocs.yml index 50fe632539c..8ecb2ab8b73 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -87,6 +87,7 @@ theme: - navigation.tabs - content.code.annotate - content.code.copy + - content.tabs.link icon: repo: fontawesome/brands/github logo: media/aws-logo-light.svg @@ -98,6 +99,9 @@ markdown_extensions: - abbr - pymdownx.tabbed: alternate_style: true + slugify: !!python/object/apply:pymdownx.slugs.slugify + kwds: + case: lower - pymdownx.highlight: linenums: true - pymdownx.details @@ -112,6 +116,7 @@ markdown_extensions: permalink: true toc_depth: 4 - attr_list + - md_in_html - pymdownx.emoji: emoji_index: !!python/name:materialx.emoji.twemoji emoji_generator: !!python/name:materialx.emoji.to_svg From 39cc89b15d31e6c6b0b49f912b9b87924a23f037 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Tue, 13 Feb 2024 09:49:31 +0100 Subject: [PATCH 16/21] docs: draft grids --- docs/index.md | 170 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 102 insertions(+), 68 deletions(-) diff --git a/docs/index.md b/docs/index.md index 41c98ab70c5..cedad967e71 100644 --- a/docs/index.md +++ b/docs/index.md @@ -7,33 +7,55 @@ description: Powertools for AWS Lambda (Python) Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverless best practices and increase developer velocity. -???+ tip - Powertools for AWS Lambda (Python) is also available for [Java](https://docs.powertools.aws.dev/lambda/java/){target="_blank"}, [TypeScript](https://docs.powertools.aws.dev/lambda/typescript/latest/){target="_blank" }, and [.NET](https://docs.powertools.aws.dev/lambda/dotnet/){target="_blank"} + +
-??? hint "Support this project by becoming a reference customer, sharing your work, or using Layers/SAR :heart:" +- :material-download-outline:{ .lg .middle } __Installation__ - You can choose to support us in three ways: + --- - 1) [**Become a reference customer**](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"}. This gives us permission to list your company in our documentation. + Install with `pip`, or our pre-packaged AWS Lambda Layer. - 2) [**Share your work**](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=community-content&template=share_your_work.yml&title=%5BI+Made+This%5D%3A+%3CTITLE%3E){target="_blank"}. Blog posts, video, sample projects you used Powertools! + :octicons-arrow-right-24: [Pip](#install), [Lambda Layer](#lambda-layer) - 3) Use [**Lambda Layers**](#lambda-layer) or [**SAR**](#sar), if possible. This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. +- :material-battery-charging:{ .lg .middle } __Features__ - When using Layers, you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. + --- + + Start with one, many, or all industry practices. + + [:octicons-arrow-right-24: All features](#features) + +- :heart:{ .lg .middle } __Support this project__ + + --- + + Become a public reference customer, share your work, or use Lambda Layers. + + [:octicons-arrow-right-24: Support](#how-to-support-powertools-for-aws-lambda-python) + +- :material-file-code:{ .lg .middle } __Available languages__ + + --- + + Powertools for AWS Lambda is also available in other languages + + :octicons-arrow-right-24: [Java](https://docs.powertools.aws.dev/lambda/java/){target="_blank"}, [TypeScript](https://docs.powertools.aws.dev/lambda/typescript/latest/){target="_blank" }, and [.NET](https://docs.powertools.aws.dev/lambda/dotnet/){target="_blank"} + +
## Install You can install Powertools for AWS Lambda (Python) using one of the following options: -* **Lambda Layer (x86_64)**: [**arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61**](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: -* **Lambda Layer (arm64)**: [**arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61**](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: -* **Pip**: **[`pip install "aws-lambda-powertools"`](#){: .copyMe}:clipboard:** +- __Lambda Layer (x86_64)__: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: +- __Lambda Layer (arm64)__: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: +- __Pip__: **[`pip install "aws-lambda-powertools"`](#){: .copyMe}:clipboard:** !!! question "Looking for Pip signed releases? [Learn more about verifying signed builds](./security.md#verifying-signed-builds)" ??? question "Using Pip? You might need to install additional dependencies." - [**Tracer**](./core/tracer.md){target="_blank"}, [**Validation**](./utilities/validation.md){target="_blank"} and [**Parser**](./utilities/parser.md){target="_blank"} require additional dependencies. If you prefer to install all of them, use [**`pip install "aws-lambda-powertools[all]"`**](#){: .copyMe}:clipboard:. + [__Tracer__](./core/tracer.md){target="_blank"}, [__Validation__](./utilities/validation.md){target="_blank"} and [__Parser__](./utilities/parser.md){target="_blank"} require additional dependencies. If you prefer to install all of them, use [**`pip install "aws-lambda-powertools[all]"`**](#){: .copyMe}:clipboard:. For example: @@ -48,21 +70,21 @@ You can install Powertools for AWS Lambda (Python) using one of the following op Powertools for AWS Lambda (Python) relies on the [AWS SDK bundled in the Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"}. This helps us achieve an optimal package size and initialization. However, when developing locally, you need to install AWS SDK as a development dependency (not as a production dependency): -* **Pip**: [**`pip install "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: -* **Poetry**: [**`poetry add "aws-lambda-powertools[aws-sdk]" --group dev`**](#){: .copyMe}:clipboard: -* **Pipenv**: [**`pipenv install --dev "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: +- __Pip__: [**`pip install "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: +- __Poetry__: [**`poetry add "aws-lambda-powertools[aws-sdk]" --group dev`**](#){: .copyMe}:clipboard: +- __Pipenv__: [**`pipenv install --dev "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: ??? question "Why is that necessary?" Powertools for AWS Lambda (Python) relies on the AWS SDK being available to use in the target runtime (AWS Lambda). As a result, it affects your favorite IDE in terms of code auto-completion, or running your tests suite locally with no Lambda emulation such as [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html){target="_blank"}. -**A word about dependency resolution** +__A word about dependency resolution__ In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependency resolution, it'll either install: -* **(A)** the SDK version available in [Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"} -* **(B)** a more up-to-date version if another package you use also depends on `boto3`, for example [Powertools for AWS Lambda (Python) Tracer](core/tracer.md){target="_blank"} +- __(A)__ the SDK version available in [Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"} +- __(B)__ a more up-to-date version if another package you use also depends on `boto3`, for example [Powertools for AWS Lambda (Python) Tracer](core/tracer.md){target="_blank"} ### Lambda Layer @@ -688,22 +710,22 @@ Core utilities such as Tracing, Logging, Metrics, and Event Handler will be avai | Utility | Description | | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [**Tracing**](./core/tracer.md){target="_blank"} | Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions | -| [**Logger**](./core/logger.md){target="_blank"} | Structured logging made easier, and decorator to enrich structured logging with key Lambda context details | -| [**Metrics**](./core/metrics.md){target="_blank"} | Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF) | -| [**Event handler: AppSync**](./core/event_handler/appsync.md){target="_blank"} | AppSync event handler for Lambda Direct Resolver and Amplify GraphQL Transformer function | -| [**Event handler: API Gateway, ALB and Lambda Function URL**](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/) | Amazon API Gateway REST/HTTP API and ALB event handler for Lambda functions invoked using Proxy integration, and Lambda Function URL | -| [**Middleware factory**](./utilities/middleware_factory.md){target="_blank"} | Decorator factory to create your own middleware to run logic before, and after each Lambda invocation | -| [**Parameters**](./utilities/parameters.md){target="_blank"} | Retrieve parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB, and cache them for a specific amount of time | -| [**Batch processing**](./utilities/batch.md){target="_blank"} | Handle partial failures for AWS SQS batch processing | -| [**Typing**](./utilities/typing.md){target="_blank"} | Static typing classes to speedup development in your IDE | -| [**Validation**](./utilities/validation.md){target="_blank"} | JSON Schema validator for inbound events and responses | -| [**Event source data classes**](./utilities/data_classes.md){target="_blank"} | Data classes describing the schema of common Lambda event triggers | -| [**Parser**](./utilities/parser.md){target="_blank"} | Data parsing and deep validation using Pydantic | -| [**Idempotency**](./utilities/idempotency.md){target="_blank"} | Idempotent Lambda handler | -| [**Data Masking**](./utilities/data_masking.md){target="_blank"} | Protect confidential data with easy removal or encryption | -| [**Feature Flags**](./utilities/feature_flags.md){target="_blank"} | A simple rule engine to evaluate when one or multiple features should be enabled depending on the input | -| [**Streaming**](./utilities/streaming.md){target="_blank"} | Streams datasets larger than the available memory as streaming data. | +| [__Tracing__](./core/tracer.md){target="_blank"} | Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions | +| [__Logger__](./core/logger.md){target="_blank"} | Structured logging made easier, and decorator to enrich structured logging with key Lambda context details | +| [__Metrics__](./core/metrics.md){target="_blank"} | Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF) | +| [__Event handler: AppSync__](./core/event_handler/appsync.md){target="_blank"} | AppSync event handler for Lambda Direct Resolver and Amplify GraphQL Transformer function | +| [__Event handler: API Gateway, ALB and Lambda Function URL__](https://docs.powertools.aws.dev/lambda/python/latest/core/event_handler/api_gateway/) | Amazon API Gateway REST/HTTP API and ALB event handler for Lambda functions invoked using Proxy integration, and Lambda Function URL | +| [__Middleware factory__](./utilities/middleware_factory.md){target="_blank"} | Decorator factory to create your own middleware to run logic before, and after each Lambda invocation | +| [__Parameters__](./utilities/parameters.md){target="_blank"} | Retrieve parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB, and cache them for a specific amount of time | +| [__Batch processing__](./utilities/batch.md){target="_blank"} | Handle partial failures for AWS SQS batch processing | +| [__Typing__](./utilities/typing.md){target="_blank"} | Static typing classes to speedup development in your IDE | +| [__Validation__](./utilities/validation.md){target="_blank"} | JSON Schema validator for inbound events and responses | +| [__Event source data classes__](./utilities/data_classes.md){target="_blank"} | Data classes describing the schema of common Lambda event triggers | +| [__Parser__](./utilities/parser.md){target="_blank"} | Data parsing and deep validation using Pydantic | +| [__Idempotency__](./utilities/idempotency.md){target="_blank"} | Idempotent Lambda handler | +| [__Data Masking__](./utilities/data_masking.md){target="_blank"} | Protect confidential data with easy removal or encryption | +| [__Feature Flags__](./utilities/feature_flags.md){target="_blank"} | A simple rule engine to evaluate when one or multiple features should be enabled depending on the input | +| [__Streaming__](./utilities/streaming.md){target="_blank"} | Streams datasets larger than the available memory as streaming data. | ## Environment variables @@ -712,19 +734,19 @@ Core utilities such as Tracing, Logging, Metrics, and Event Handler will be avai | Environment variable | Description | Utility | Default | | ----------------------------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | --------------------- | -| **POWERTOOLS_SERVICE_NAME** | Sets service name used for tracing namespace, metrics dimension and structured logging | All | `"service_undefined"` | -| **POWERTOOLS_METRICS_NAMESPACE** | Sets namespace used for metrics | [Metrics](./core/metrics.md){target="_blank"} | `None` | -| **POWERTOOLS_TRACE_DISABLED** | Explicitly disables tracing | [Tracing](./core/tracer.md){target="_blank"} | `false` | -| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Captures Lambda or method return as metadata. | [Tracing](./core/tracer.md){target="_blank"} | `true` | -| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Captures Lambda or method exception as metadata. | [Tracing](./core/tracer.md){target="_blank"} | `true` | -| **POWERTOOLS_TRACE_MIDDLEWARES** | Creates sub-segment for each custom middleware | [Middleware factory](./utilities/middleware_factory.md){target="_blank"} | `false` | -| **POWERTOOLS_LOGGER_LOG_EVENT** | Logs incoming event | [Logging](./core/logger.md){target="_blank"} | `false` | -| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logging](./core/logger.md){target="_blank"} | `0` | -| **POWERTOOLS_LOG_DEDUPLICATION_DISABLED** | Disables log deduplication filter protection to use Pytest Live Log feature | [Logging](./core/logger.md){target="_blank"} | `false` | -| **POWERTOOLS_PARAMETERS_MAX_AGE** | Adjust how long values are kept in cache (in seconds) | [Parameters](./utilities/parameters.md#adjusting-cache-ttl){target="_blank"} | `5` | -| **POWERTOOLS_PARAMETERS_SSM_DECRYPT** | Sets whether to decrypt or not values retrieved from AWS SSM Parameters Store | [Parameters](./utilities/parameters.md#ssmprovider){target="_blank"} | `false` | -| **POWERTOOLS_DEV** | Increases verbosity across utilities | Multiple; see [POWERTOOLS_DEV effect below](#optimizing-for-non-production-environments) | `false` | -| **POWERTOOLS_LOG_LEVEL** | Sets logging level | [Logging](./core/logger.md){target="_blank"} | `INFO` | +| __POWERTOOLS_SERVICE_NAME__ | Sets service name used for tracing namespace, metrics dimension and structured logging | All | `"service_undefined"` | +| __POWERTOOLS_METRICS_NAMESPACE__ | Sets namespace used for metrics | [Metrics](./core/metrics.md){target="_blank"} | `None` | +| __POWERTOOLS_TRACE_DISABLED__ | Explicitly disables tracing | [Tracing](./core/tracer.md){target="_blank"} | `false` | +| __POWERTOOLS_TRACER_CAPTURE_RESPONSE__ | Captures Lambda or method return as metadata. | [Tracing](./core/tracer.md){target="_blank"} | `true` | +| __POWERTOOLS_TRACER_CAPTURE_ERROR__ | Captures Lambda or method exception as metadata. | [Tracing](./core/tracer.md){target="_blank"} | `true` | +| __POWERTOOLS_TRACE_MIDDLEWARES__ | Creates sub-segment for each custom middleware | [Middleware factory](./utilities/middleware_factory.md){target="_blank"} | `false` | +| __POWERTOOLS_LOGGER_LOG_EVENT__ | Logs incoming event | [Logging](./core/logger.md){target="_blank"} | `false` | +| __POWERTOOLS_LOGGER_SAMPLE_RATE__ | Debug log sampling | [Logging](./core/logger.md){target="_blank"} | `0` | +| __POWERTOOLS_LOG_DEDUPLICATION_DISABLED__ | Disables log deduplication filter protection to use Pytest Live Log feature | [Logging](./core/logger.md){target="_blank"} | `false` | +| __POWERTOOLS_PARAMETERS_MAX_AGE__ | Adjust how long values are kept in cache (in seconds) | [Parameters](./utilities/parameters.md#adjusting-cache-ttl){target="_blank"} | `5` | +| __POWERTOOLS_PARAMETERS_SSM_DECRYPT__ | Sets whether to decrypt or not values retrieved from AWS SSM Parameters Store | [Parameters](./utilities/parameters.md#ssmprovider){target="_blank"} | `false` | +| __POWERTOOLS_DEV__ | Increases verbosity across utilities | Multiple; see [POWERTOOLS_DEV effect below](#optimizing-for-non-production-environments) | `false` | +| __POWERTOOLS_LOG_LEVEL__ | Sets logging level | [Logging](./core/logger.md){target="_blank"} | `INFO` | ### Optimizing for non-production environments @@ -737,9 +759,9 @@ When `POWERTOOLS_DEV` is set to a truthy value (`1`, `true`), it'll have the fol | Utility | Effect | | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **Logger** | Increase JSON indentation to 4. This will ease local debugging when running functions locally under emulators or direct calls while not affecting unit tests | -| **Event Handler** | Enable full traceback errors in the response, indent request/responses, and CORS in dev mode (`*`). | -| **Tracer** | Future-proof safety to disables tracing operations in non-Lambda environments. This already happens automatically in the Tracer utility. | +| __Logger__ | Increase JSON indentation to 4. This will ease local debugging when running functions locally under emulators or direct calls while not affecting unit tests | +| __Event Handler__ | Enable full traceback errors in the response, indent request/responses, and CORS in dev mode (`*`). | +| __Tracer__ | Future-proof safety to disables tracing operations in non-Lambda environments. This already happens automatically in the Tracer utility. | ## Debug mode @@ -749,24 +771,36 @@ When necessary, you can use `POWERTOOLS_DEBUG` environment variable to enable de ## How to support Powertools for AWS Lambda (Python)? +??? hint "Support this project by becoming a reference customer, sharing your work, or using Layers/SAR :heart:" + + You can choose to support us in three ways: + + 1) [**Become a reference customer**](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"}. This gives us permission to list your company in our documentation. + + 2) [**Share your work**](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=community-content&template=share_your_work.yml&title=%5BI+Made+This%5D%3A+%3CTITLE%3E){target="_blank"}. Blog posts, video, sample projects you used Powertools! + + 3) Use [**Lambda Layers**](#lambda-layer) or [**SAR**](#sar), if possible. This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. + + When using Layers, you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. + ### Becoming a reference customer Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Python), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (Python) (become a reference)](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"} issue. The following companies, among others, use Powertools: -* [Capital One](https://www.capitalone.com/){target="_blank" rel="nofollow"} -* [CPQi (Exadel Financial Services)](https://cpqi.com/){target="_blank" rel="nofollow"} -* [CloudZero](https://www.cloudzero.com/){target="_blank" rel="nofollow"} -* [CyberArk](https://www.cyberark.com/){target="_blank" rel="nofollow"} -* [globaldatanet](https://globaldatanet.com/){target="_blank" rel="nofollow"} -* [IMS](https://ims.tech/){target="_blank" rel="nofollow"} -* [Jit Security](https://www.jit.io/){target="_blank" rel="nofollow"} -* [Propellor.ai](https://www.propellor.ai/){target="_blank" rel="nofollow"} -* [TopSport](https://www.topsport.com.au/){target="_blank" rel="nofollow"} -* [Transformity](https://transformity.tech/){target="_blank" rel="nofollow"} -* [Trek10](https://www.trek10.com/){target="_blank" rel="nofollow"} -* [Vertex Pharmaceuticals](https://www.vrtx.com/){target="_blank" rel="nofollow"} +- [Capital One](https://www.capitalone.com/){target="_blank" rel="nofollow"} +- [CPQi (Exadel Financial Services)](https://cpqi.com/){target="_blank" rel="nofollow"} +- [CloudZero](https://www.cloudzero.com/){target="_blank" rel="nofollow"} +- [CyberArk](https://www.cyberark.com/){target="_blank" rel="nofollow"} +- [globaldatanet](https://globaldatanet.com/){target="_blank" rel="nofollow"} +- [IMS](https://ims.tech/){target="_blank" rel="nofollow"} +- [Jit Security](https://www.jit.io/){target="_blank" rel="nofollow"} +- [Propellor.ai](https://www.propellor.ai/){target="_blank" rel="nofollow"} +- [TopSport](https://www.topsport.com.au/){target="_blank" rel="nofollow"} +- [Transformity](https://transformity.tech/){target="_blank" rel="nofollow"} +- [Trek10](https://www.trek10.com/){target="_blank" rel="nofollow"} +- [Vertex Pharmaceuticals](https://www.vrtx.com/){target="_blank" rel="nofollow"} ### Sharing your work @@ -780,9 +814,9 @@ This helps us understand who uses Powertools for AWS Lambda (Python) in a non-in These are our core principles to guide our decision making. -* **AWS Lambda only**. We optimise for AWS Lambda function environments and supported runtimes only. Utilities might work with web frameworks and non-Lambda environments, though they are not officially supported. -* **Eases the adoption of best practices**. The main priority of the utilities is to facilitate best practices adoption, as defined in the AWS Well-Architected Serverless Lens; all other functionality is optional. -* **Keep it lean**. Additional dependencies are carefully considered for security and ease of maintenance, and prevent negatively impacting startup time. -* **We strive for backwards compatibility**. New features and changes should keep backwards compatibility. If a breaking change cannot be avoided, the deprecation and migration process should be clearly defined. -* **We work backwards from the community**. We aim to strike a balance of what would work best for 80% of customers. Emerging practices are considered and discussed via Requests for Comment (RFCs) -* **Progressive**. Utilities are designed to be incrementally adoptable for customers at any stage of their Serverless journey. They follow language idioms and their community’s common practices. +- __AWS Lambda only__. We optimise for AWS Lambda function environments and supported runtimes only. Utilities might work with web frameworks and non-Lambda environments, though they are not officially supported. +- __Eases the adoption of best practices__. The main priority of the utilities is to facilitate best practices adoption, as defined in the AWS Well-Architected Serverless Lens; all other functionality is optional. +- __Keep it lean__. Additional dependencies are carefully considered for security and ease of maintenance, and prevent negatively impacting startup time. +- __We strive for backwards compatibility__. New features and changes should keep backwards compatibility. If a breaking change cannot be avoided, the deprecation and migration process should be clearly defined. +- __We work backwards from the community__. We aim to strike a balance of what would work best for 80% of customers. Emerging practices are considered and discussed via Requests for Comment (RFCs) +- __Progressive__. Utilities are designed to be incrementally adoptable for customers at any stage of their Serverless journey. They follow language idioms and their community’s common practices. From 42d22a779e6c2fed28c3950e3f764f7f4d230c97 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Wed, 14 Feb 2024 14:41:19 +0100 Subject: [PATCH 17/21] docs: cleanup grids; fix warnings Signed-off-by: heitorlessa --- docs/index.md | 10 +--------- mkdocs.yml | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/index.md b/docs/index.md index cedad967e71..9d02cd4e1ea 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,19 +10,11 @@ Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverles
-- :material-download-outline:{ .lg .middle } __Installation__ - - --- - - Install with `pip`, or our pre-packaged AWS Lambda Layer. - - :octicons-arrow-right-24: [Pip](#install), [Lambda Layer](#lambda-layer) - - :material-battery-charging:{ .lg .middle } __Features__ --- - Start with one, many, or all industry practices. + Adopt one, a few, or all industry practices. **Progressively**. [:octicons-arrow-right-24: All features](#features) diff --git a/mkdocs.yml b/mkdocs.yml index 8ecb2ab8b73..fc3373b5c98 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -118,8 +118,8 @@ markdown_extensions: - attr_list - md_in_html - pymdownx.emoji: - emoji_index: !!python/name:materialx.emoji.twemoji - emoji_generator: !!python/name:materialx.emoji.to_svg + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg - pymdownx.inlinehilite - pymdownx.superfences: custom_fences: From 66eb2d833220e10321905882adf75184d13fd89e Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Wed, 14 Feb 2024 15:31:07 +0100 Subject: [PATCH 18/21] docs: cleanup support us sections Signed-off-by: heitorlessa --- docs/index.md | 98 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 27 deletions(-) diff --git a/docs/index.md b/docs/index.md index 9d02cd4e1ea..a68c99fa878 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,9 +22,9 @@ Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverles --- - Become a public reference customer, share your work, or use Lambda Layers. + Become a public reference customer, share your work, contribute, use Lambda Layers, etc. - [:octicons-arrow-right-24: Support](#how-to-support-powertools-for-aws-lambda-python) + [:octicons-arrow-right-24: Support](#support-powertools-for-aws-lambda-python) - :material-file-code:{ .lg .middle } __Available languages__ @@ -761,46 +761,90 @@ As a best practice for libraries, Powertools module logging statements are suppr When necessary, you can use `POWERTOOLS_DEBUG` environment variable to enable debugging. This will provide additional information on every internal operation. -## How to support Powertools for AWS Lambda (Python)? +## Support Powertools for AWS Lambda (Python) -??? hint "Support this project by becoming a reference customer, sharing your work, or using Layers/SAR :heart:" +There are many ways you can help us gain future investments to improve everyone's experience: - You can choose to support us in three ways: +
+ +- :heart:{ .lg .middle } __Become a public reference__ + + --- + + Add your company name and logo on our [landing page](https://powertools.aws.dev). + + [:octicons-arrow-right-24: GitHub Issue template]((https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"}) + +- :mega:{ .lg .middle } __Share your work__ - 1) [**Become a reference customer**](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"}. This gives us permission to list your company in our documentation. + --- + + Blog posts, video, and sample projects about Powertools for AWS Lambda. - 2) [**Share your work**](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=community-content&template=share_your_work.yml&title=%5BI+Made+This%5D%3A+%3CTITLE%3E){target="_blank"}. Blog posts, video, sample projects you used Powertools! + [:octicons-arrow-right-24: GitHub Issue template](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=community-content&template=share_your_work.yml&title=%5BI+Made+This%5D%3A+%3CTITLE%3E){target="_blank"} - 3) Use [**Lambda Layers**](#lambda-layer) or [**SAR**](#sar), if possible. This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. +- :partying_face:{ .lg .middle } __Join the community__ + + --- - When using Layers, you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. + Connect, ask questions, and share what features you use. + + [:octicons-arrow-right-24: Discord invite](https://discord.gg/B8zZKbbyET){target="blank"} + +
### Becoming a reference customer -Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Python), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (Python) (become a reference)](https://github.com/aws-powertools/powertools-lambda-python/issues/new?assignees=&labels=customer-reference&template=support_powertools.yml&title=%5BSupport+Lambda+Powertools%5D%3A+%3Cyour+organization+name%3E){target="_blank"} issue. +Knowing which companies are using this library is important to help prioritize the project internally. The following companies, among others, use Powertools: -The following companies, among others, use Powertools: +
-- [Capital One](https://www.capitalone.com/){target="_blank" rel="nofollow"} -- [CPQi (Exadel Financial Services)](https://cpqi.com/){target="_blank" rel="nofollow"} -- [CloudZero](https://www.cloudzero.com/){target="_blank" rel="nofollow"} -- [CyberArk](https://www.cyberark.com/){target="_blank" rel="nofollow"} -- [globaldatanet](https://globaldatanet.com/){target="_blank" rel="nofollow"} -- [IMS](https://ims.tech/){target="_blank" rel="nofollow"} -- [Jit Security](https://www.jit.io/){target="_blank" rel="nofollow"} -- [Propellor.ai](https://www.propellor.ai/){target="_blank" rel="nofollow"} -- [TopSport](https://www.topsport.com.au/){target="_blank" rel="nofollow"} -- [Transformity](https://transformity.tech/){target="_blank" rel="nofollow"} -- [Trek10](https://www.trek10.com/){target="_blank" rel="nofollow"} -- [Vertex Pharmaceuticals](https://www.vrtx.com/){target="_blank" rel="nofollow"} +[**Capital One**](https://www.capitalone.com/){target="_blank" rel="nofollow"} +{ .card } -### Sharing your work +[**CPQi (Exadel Financial Services)**](https://cpqi.com/){target="_blank" rel="nofollow"} +{ .card } + +[**CloudZero**](https://www.cloudzero.com/){target="_blank" rel="nofollow"} +{ .card } + +[**CyberArk**](https://www.cyberark.com/){target="_blank" rel="nofollow"} +{ .card } + +[**globaldatanet**](https://globaldatanet.com/){target="_blank" rel="nofollow"} +{ .card } + +[**IMS**](https://ims.tech/){target="_blank" rel="nofollow"} +{ .card } + +[**Jit Security**](https://www.jit.io/){target="_blank" rel="nofollow"} +{ .card } + +[**Propellor.ai**](https://www.propellor.ai/){target="_blank" rel="nofollow"} +{ .card } + +[**TopSport**](https://www.topsport.com.au/){target="_blank" rel="nofollow"} +{ .card } + +[**Transformity**](https://transformity.tech/){target="_blank" rel="nofollow"} +{ .card } + +[**Trek10**](https://www.trek10.com/){target="_blank" rel="nofollow"} +{ .card } + +[**Vertex Pharmaceuticals**](https://www.vrtx.com/){target="_blank" rel="nofollow"} +{ .card } + +[**Alma Media**](https://www.almamedia.fi/en/){target="_blank" rel="nofollow} +{ .card } + +
-Share what you did with Powertools for AWS Lambda (Python) 💞💞. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (Python) [here](https://docs.powertools.aws.dev/lambda/python/latest/we_made_this/){target="_blank"}. +### Using Lambda Layers -### Using Lambda Layer or SAR +!!! note "Layers help us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way." -This helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://docs.powertools.aws.dev/lambda/python/latest/#lambda-layer), you can add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process. +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. ## Tenets From 17a08efc0120a1f9bd83739e60b29801605c4783 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Wed, 14 Feb 2024 16:17:51 +0100 Subject: [PATCH 19/21] docs: cleanup install Signed-off-by: heitorlessa --- docs/index.md | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/docs/index.md b/docs/index.md index a68c99fa878..708e3ea4907 100644 --- a/docs/index.md +++ b/docs/index.md @@ -38,23 +38,40 @@ Powertools for AWS Lambda (Python) is a developer toolkit to implement Serverles ## Install -You can install Powertools for AWS Lambda (Python) using one of the following options: +You can install Powertools for AWS Lambda (Python) using your favorite dependency management, or Lambda Layers: -- __Lambda Layer (x86_64)__: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: -- __Lambda Layer (arm64)__: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: -- __Pip__: **[`pip install "aws-lambda-powertools"`](#){: .copyMe}:clipboard:** +=== "Pip" -!!! question "Looking for Pip signed releases? [Learn more about verifying signed builds](./security.md#verifying-signed-builds)" + You can install [all extra dependencies](#extra-dependencies) at once with the `[all]` extras. -??? question "Using Pip? You might need to install additional dependencies." - [__Tracer__](./core/tracer.md){target="_blank"}, [__Validation__](./utilities/validation.md){target="_blank"} and [__Parser__](./utilities/parser.md){target="_blank"} require additional dependencies. If you prefer to install all of them, use [**`pip install "aws-lambda-powertools[all]"`**](#){: .copyMe}:clipboard:. + * **pip**: [**`pip install "aws-lambda-powertools[all]"`**](#){: .copyMe} + * **poetry**: [**`poetry add "aws-lambda-powertools[all]"`**](#){: .copyMe} + * **pdm**: [**`pdm add "aws-lambda-powertools[all]"`**](#){: .copyMe} - For example: + Alternatively, see [extra dependencies](#extra-dependencies) if you want to install only what you need. - * **Tracer**: **[`pip install "aws-lambda-powertools[tracer]"`](#){: .copyMe}:clipboard:** - * **Validation**: **[`pip install "aws-lambda-powertools[validation]"`](#){: .copyMe}:clipboard:** - * **Parser**: **[`pip install "aws-lambda-powertools[parser]"`](#){: .copyMe}:clipboard:** - * **Tracer** and **Parser**: **[`pip install "aws-lambda-powertools[tracer,parser]"`](#){: .copyMe}:clipboard:** +=== "Lambda Layer" + + Make sure to replace `{region}` with your AWS region, e.g., `eu-west-1`. + + * **x86 architecture**: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: + * **ARM architecture**: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: + +### Extra dependencies + +The vast majority of [features](#features) rely on standard library and AWS SDK _(boto3)_ only. The following features however require additional dependencies: + +| Feature | Pip | Dependency | +| ------------------- | --------------------------------------------------------------------------------- | ----------------------------------- | +| Tracer | **[`pip install "aws-lambda-powertools[tracer]"`](#){: .copyMe}:clipboard:** | `aws-xray-sdk` | +| Validation | **[`pip install "aws-lambda-powertools[validation]"`](#){: .copyMe}:clipboard:** | `fastjsonschema` | +| Parser | **[`pip install "aws-lambda-powertools[parser]"`](#){: .copyMe}:clipboard:** | `pydantic` | +| Data Masking | **[`pip install "aws-lambda-powertools[datamasking]"`](#){: .copyMe}:clipboard:** | `aws-encryption-sdk`, `jsonpath-ng` | +| Idempotency (Redis) | **[`pip install "aws-lambda-powertools[redis]"`](#){: .copyMe}:clipboard:** | `redis` | + +> New to pip? + +You can use `,` delimiter to install multiple at once: [**`pip install "aws-lambda-powertools[tracer,parser,datamasking"]`**](#){: .copyMe}:clipboard: ### Local development @@ -64,7 +81,7 @@ Powertools for AWS Lambda (Python) relies on the [AWS SDK bundled in the Lambda - __Pip__: [**`pip install "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: - __Poetry__: [**`poetry add "aws-lambda-powertools[aws-sdk]" --group dev`**](#){: .copyMe}:clipboard: -- __Pipenv__: [**`pipenv install --dev "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: +- __Pdm__: [**`pdm add -dG "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: ??? question "Why is that necessary?" Powertools for AWS Lambda (Python) relies on the AWS SDK being available to use in the target runtime (AWS Lambda). From 6a72ab70c466b52c73461e647efbddb554394ac2 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Wed, 14 Feb 2024 16:45:33 +0100 Subject: [PATCH 20/21] docs: major cleanup for layer sections Signed-off-by: heitorlessa --- docs/index.md | 791 ++++++++++++++++++++++++-------------------------- 1 file changed, 383 insertions(+), 408 deletions(-) diff --git a/docs/index.md b/docs/index.md index 708e3ea4907..d31dcbf9396 100644 --- a/docs/index.md +++ b/docs/index.md @@ -52,11 +52,325 @@ You can install Powertools for AWS Lambda (Python) using your favorite dependenc === "Lambda Layer" - Make sure to replace `{region}` with your AWS region, e.g., `eu-west-1`. + You can add our layer both in the [AWS Lambda Console _(under `Layers`)_](https://eu-west-1.console.aws.amazon.com/lambda/home#/add/layer){target="_blank"}, or via your favorite infrastructure as code framework with the ARN value. + + For the latter, make sure to replace `{region}` with your AWS region, e.g., `eu-west-1`. * **x86 architecture**: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: * **ARM architecture**: [__arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61__](# "Replace {region} with your AWS region, e.g., eu-west-1"){: .copyMe}:clipboard: + ???+ note "Code snippets for popular infrastructure as code frameworks" + + === "x86_64" + + === "SAM" + + ```yaml hl_lines="5" + MyLambdaFunction: + Type: AWS::Serverless::Function + Properties: + Layers: + - !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61 + ``` + + === "Serverless framework" + + ```yaml hl_lines="5" + functions: + hello: + handler: lambda_function.lambda_handler + layers: + - arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61 + ``` + + === "CDK" + + ```python hl_lines="11 16" + from aws_cdk import core, aws_lambda + + class SampleApp(core.Construct): + + def __init__(self, scope: core.Construct, id_: str, env: core.Environment) -> None: + super().__init__(scope, id_) + + powertools_layer = aws_lambda.LayerVersion.from_layer_version_arn( + self, + id="lambda-powertools", + layer_version_arn=f"arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61" + ) + aws_lambda.Function(self, + 'sample-app-lambda', + runtime=aws_lambda.Runtime.PYTHON_3_9, + layers=[powertools_layer] + # other props... + ) + ``` + + === "Terraform" + + ```terraform hl_lines="9 38" + terraform { + required_version = "~> 1.0.5" + required_providers { + aws = "~> 3.50.0" + } + } + + provider "aws" { + region = "{region}" + } + + resource "aws_iam_role" "iam_for_lambda" { + name = "iam_for_lambda" + + assume_role_policy = < + ? Choose the runtime that you want to use: Python + ? 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:AWSLambdaPowertoolsPythonV2:61 + ❯ amplify push -y + + + # Updating an existing function and add the layer + ❯ amplify update function + ? Select the Lambda function you want to update test2 + General information + - Name: + ? 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:AWSLambdaPowertoolsPythonV2:61 + ? Do you want to edit the local lambda function now? No + ``` + + === "arm64" + + === "SAM" + + ```yaml hl_lines="6" + MyLambdaFunction: + Type: AWS::Serverless::Function + Properties: + Architectures: [arm64] + Layers: + - !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61 + ``` + + === "Serverless framework" + + ```yaml hl_lines="6" + functions: + hello: + handler: lambda_function.lambda_handler + architecture: arm64 + layers: + - arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61 + ``` + + === "CDK" + + ```python hl_lines="11 17" + from aws_cdk import core, aws_lambda + + class SampleApp(core.Construct): + + def __init__(self, scope: core.Construct, id_: str, env: core.Environment) -> None: + super().__init__(scope, id_) + + powertools_layer = aws_lambda.LayerVersion.from_layer_version_arn( + self, + id="lambda-powertools", + layer_version_arn=f"arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61" + ) + aws_lambda.Function(self, + 'sample-app-lambda', + runtime=aws_lambda.Runtime.PYTHON_3_9, + architecture=aws_lambda.Architecture.ARM_64, + layers=[powertools_layer] + # other props... + ) + ``` + + === "Terraform" + + ```terraform hl_lines="9 37" + terraform { + required_version = "~> 1.0.5" + required_providers { + aws = "~> 3.50.0" + } + } + + provider "aws" { + region = "{region}" + } + + resource "aws_iam_role" "iam_for_lambda" { + name = "iam_for_lambda" + + assume_role_policy = < + ? Choose the runtime that you want to use: Python + ? 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:AWSLambdaPowertoolsPythonV2-Arm64:61 + ❯ amplify push -y + + + # Updating an existing function and add the layer + ❯ amplify update function + ? Select the Lambda function you want to update test2 + General information + - Name: + ? 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:AWSLambdaPowertoolsPythonV2-Arm64:61 + ? Do you want to edit the local lambda function now? No + ``` + ### Extra dependencies The vast majority of [features](#features) rely on standard library and AWS SDK _(boto3)_ only. The following features however require additional dependencies: @@ -77,17 +391,12 @@ You can use `,` delimiter to install multiple at once: [**`pip install "aws-lamb !!! info "Using Lambda Layer? Simply add [**`"aws-lambda-powertools[all]"`**](#){: .copyMe}:clipboard: as a development dependency." -Powertools for AWS Lambda (Python) relies on the [AWS SDK bundled in the Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"}. This helps us achieve an optimal package size and initialization. However, when developing locally, you need to install AWS SDK as a development dependency (not as a production dependency): +Powertools for AWS Lambda (Python) relies on the [AWS SDK bundled in the Lambda runtime](https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html){target="_blank"}. This helps us achieve an optimal package size and initialization. However, when developing locally, you need to install AWS SDK as a development dependency to support IDE auto-completion and to run your tests locally: - __Pip__: [**`pip install "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: - __Poetry__: [**`poetry add "aws-lambda-powertools[aws-sdk]" --group dev`**](#){: .copyMe}:clipboard: - __Pdm__: [**`pdm add -dG "aws-lambda-powertools[aws-sdk]"`**](#){: .copyMe}:clipboard: -??? question "Why is that necessary?" - Powertools for AWS Lambda (Python) relies on the AWS SDK being available to use in the target runtime (AWS Lambda). - - As a result, it affects your favorite IDE in terms of code auto-completion, or running your tests suite locally with no Lambda emulation such as [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html){target="_blank"}. - __A word about dependency resolution__ In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependency resolution, it'll either install: @@ -97,13 +406,7 @@ In this context, `[aws-sdk]` is an alias to the `boto3` package. Due to dependen ### Lambda Layer -???+ warning "As of now, Container Image deployment (OCI) or inline Lambda functions do not support Lambda Layers." - -[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. Layers promote code sharing and separation of responsibilities so that you can iterate faster on writing business logic. - -For our Layers, we compile and optimize [all dependencies](https://github.com/aws-powertools/powertools-lambda-python/blob/develop/pyproject.toml#L98){target="_blank"}, and [remove duplicate dependencies already available in the Lambda runtime](https://github.com/awslabs/cdk-aws-lambda-powertools-layer/blob/main/layer/Python/Dockerfile#L36){target="_blank"} to achieve the most optimal size. - -You can include Powertools for AWS Lambda (Python) Lambda Layer using [AWS Lambda Console](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html#invocation-layers-using){target="_blank"}, or your preferred deployment framework. +[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](#extra-dependencies), and [remove duplicate dependencies already available in the Lambda runtime](https://github.com/awslabs/cdk-aws-lambda-powertools-layer/blob/main/layer/Python/Dockerfile#L36){target="_blank"} to achieve the most optimal size. ??? note "Note: Click to expand and copy any regional Lambda Layer ARN" @@ -173,326 +476,13 @@ You can include Powertools for AWS Lambda (Python) Lambda Layer using [AWS Lambd | `us-west-1` | [arn:aws:lambda:us-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61](#){: .copyMe}:clipboard: | | `us-west-2` | [arn:aws:lambda:us-west-2:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61](#){: .copyMe}:clipboard: | -??? note "Note: Click to expand and copy code snippets for popular frameworks" +**Want to inspect the contents of the Layer?** - === "x86_64" - - === "SAM" +Replace `{region}` with your AWS region, _e.g. `eu-west-1`_. The pre-signed URL to download this Lambda Layer will be within `Location` key in the CLI output. - ```yaml hl_lines="5" - MyLambdaFunction: - Type: AWS::Serverless::Function - Properties: - Layers: - - !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61 - ``` - - === "Serverless framework" - - ```yaml hl_lines="5" - functions: - hello: - handler: lambda_function.lambda_handler - layers: - - arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61 - ``` - - === "CDK" - - ```python hl_lines="11 16" - from aws_cdk import core, aws_lambda - - class SampleApp(core.Construct): - - def __init__(self, scope: core.Construct, id_: str, env: core.Environment) -> None: - super().__init__(scope, id_) - - powertools_layer = aws_lambda.LayerVersion.from_layer_version_arn( - self, - id="lambda-powertools", - layer_version_arn=f"arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61" - ) - aws_lambda.Function(self, - 'sample-app-lambda', - runtime=aws_lambda.Runtime.PYTHON_3_9, - layers=[powertools_layer] - # other props... - ) - ``` - - === "Terraform" - - ```terraform hl_lines="9 38" - terraform { - required_version = "~> 1.0.5" - required_providers { - aws = "~> 3.50.0" - } - } - - provider "aws" { - region = "{region}" - } - - resource "aws_iam_role" "iam_for_lambda" { - name = "iam_for_lambda" - - assume_role_policy = < - ? Choose the runtime that you want to use: Python - ? 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:AWSLambdaPowertoolsPythonV2:61 - ❯ amplify push -y - - - # Updating an existing function and add the layer - ❯ amplify update function - ? Select the Lambda function you want to update test2 - General information - - Name: - ? 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:AWSLambdaPowertoolsPythonV2:61 - ? Do you want to edit the local lambda function now? No - ``` - - === "arm64" - - === "SAM" - - ```yaml hl_lines="6" - MyLambdaFunction: - Type: AWS::Serverless::Function - Properties: - Architectures: [arm64] - Layers: - - !Sub arn:aws:lambda:${AWS::Region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61 - ``` - - === "Serverless framework" - - ```yaml hl_lines="6" - functions: - hello: - handler: lambda_function.lambda_handler - architecture: arm64 - layers: - - arn:aws:lambda:${aws:region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61 - ``` - - === "CDK" - - ```python hl_lines="11 17" - from aws_cdk import core, aws_lambda - - class SampleApp(core.Construct): - - def __init__(self, scope: core.Construct, id_: str, env: core.Environment) -> None: - super().__init__(scope, id_) - - powertools_layer = aws_lambda.LayerVersion.from_layer_version_arn( - self, - id="lambda-powertools", - layer_version_arn=f"arn:aws:lambda:{env.region}:017000801446:layer:AWSLambdaPowertoolsPythonV2-Arm64:61" - ) - aws_lambda.Function(self, - 'sample-app-lambda', - runtime=aws_lambda.Runtime.PYTHON_3_9, - architecture=aws_lambda.Architecture.ARM_64, - layers=[powertools_layer] - # other props... - ) - ``` - - === "Terraform" - - ```terraform hl_lines="9 37" - terraform { - required_version = "~> 1.0.5" - required_providers { - aws = "~> 3.50.0" - } - } - - provider "aws" { - region = "{region}" - } - - resource "aws_iam_role" "iam_for_lambda" { - name = "iam_for_lambda" - - assume_role_policy = < - ? Choose the runtime that you want to use: Python - ? 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:AWSLambdaPowertoolsPythonV2-Arm64:61 - ❯ amplify push -y - - - # Updating an existing function and add the layer - ❯ amplify update function - ? Select the Lambda function you want to update test2 - General information - - Name: - ? 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:AWSLambdaPowertoolsPythonV2-Arm64:61 - ? Do you want to edit the local lambda function now? No - ``` - -??? question "Want to inspect the contents of the Layer?" - Change {region} to your AWS region, e.g. `eu-west-1` - - ```bash title="AWS CLI" - aws lambda get-layer-version-by-arn --arn arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61 --region {region} - ``` - - The pre-signed URL to download this Lambda Layer will be within `Location` key. +```bash title="AWS CLI command to download Lambda Layer content" +aws lambda get-layer-version-by-arn --arn arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:61 --region {region} +``` #### SAR @@ -500,10 +490,10 @@ 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 | 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. | ??? note "Click to expand and copy SAR code snippets for popular frameworks" @@ -633,78 +623,63 @@ Compared with the [public Layer ARN](#lambda-layer) option, SAR allows you to ch } ``` -??? example "Example: Least-privileged IAM permissions to deploy Layer" - - > Credits to [mwarkentin](https://github.com/mwarkentin){target="_blank" rel="nofollow"} for providing the scoped down IAM permissions. - - The region and the account id for `CloudFormationTransform` and `GetCfnTemplate` are fixed. - - === "template.yml" - - ```yaml hl_lines="21-52" - AWSTemplateFormatVersion: "2010-09-09" - Resources: - PowertoolsLayerIamRole: - Type: "AWS::IAM::Role" - Properties: - AssumeRolePolicyDocument: - Version: "2012-10-17" - Statement: - - Effect: "Allow" - Principal: - Service: - - "cloudformation.amazonaws.com" - Action: - - "sts:AssumeRole" - Path: "/" - PowertoolsLayerIamPolicy: - Type: "AWS::IAM::Policy" - Properties: - PolicyName: PowertoolsLambdaLayerPolicy - PolicyDocument: - Version: "2012-10-17" - Statement: - - Sid: CloudFormationTransform - Effect: Allow - Action: cloudformation:CreateChangeSet - Resource: - - arn:aws:cloudformation:us-east-1:aws:transform/Serverless-2016-10-31 - - Sid: GetCfnTemplate - Effect: Allow - Action: - - serverlessrepo:CreateCloudFormationTemplate - - 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 - - Sid: S3AccessLayer - Effect: Allow - Action: - - s3:GetObject - Resource: - # 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-****-****-****-********* - - 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* - Roles: - - Ref: "PowertoolsLayerIamRole" - ``` - -??? note "Click to expand and copy an AWS CLI command to list all versions available in SAR" - - You can fetch available versions via SAR ListApplicationVersions API: - - ```bash title="AWS CLI example" - aws serverlessrepo list-application-versions \ - --application-id arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer + Credits to [mwarkentin](https://github.com/mwarkentin){target="_blank" rel="nofollow"} for providing the scoped down IAM permissions below. + + ```yaml hl_lines="21-52" title="Least-privileged IAM permissions SAM example" + AWSTemplateFormatVersion: "2010-09-09" + Resources: + PowertoolsLayerIamRole: + Type: "AWS::IAM::Role" + Properties: + AssumeRolePolicyDocument: + Version: "2012-10-17" + Statement: + - Effect: "Allow" + Principal: + Service: + - "cloudformation.amazonaws.com" + Action: + - "sts:AssumeRole" + Path: "/" + PowertoolsLayerIamPolicy: + Type: "AWS::IAM::Policy" + Properties: + PolicyName: PowertoolsLambdaLayerPolicy + PolicyDocument: + Version: "2012-10-17" + Statement: + - Sid: CloudFormationTransform + Effect: Allow + Action: cloudformation:CreateChangeSet + Resource: + - arn:aws:cloudformation:us-east-1:aws:transform/Serverless-2016-10-31 + - Sid: GetCfnTemplate + Effect: Allow + Action: + - serverlessrepo:CreateCloudFormationTemplate + - 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 + - Sid: S3AccessLayer + Effect: Allow + Action: + - s3:GetObject + Resource: + # 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-****-****-****-********* + - 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* + Roles: + - Ref: "PowertoolsLayerIamRole" ``` ## Quick getting started From 3138c254c5a9c0c9cf68c6c376ff1a72dfc85153 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Wed, 14 Feb 2024 16:51:02 +0100 Subject: [PATCH 21/21] chore: fixed Simon's feedback on bot email Signed-off-by: heitorlessa --- .github/actions/create-pr/action.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/create-pr/action.yml b/.github/actions/create-pr/action.yml index 6e40deeff66..39ba6f60b1f 100644 --- a/.github/actions/create-pr/action.yml +++ b/.github/actions/create-pr/action.yml @@ -64,7 +64,7 @@ runs: name: Git client setup and refresh tip run: | git config user.name "Powertools for AWS Lambda (Python) bot" - git config user.email "aws-powertools-maintainers@amazon.com" + git config user.email "151832416+aws-powertools-bot@users.noreply.github.com" git config pull.rebase true git config remote.origin.url >&- shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5116d5a186..d9c7b9d8cad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -273,7 +273,7 @@ jobs: name: Git client setup and refresh tip run: | git config user.name "Powertools for AWS Lambda (Python) bot" - git config user.email "aws-powertools-maintainers@amazon.com" + git config user.email "151832416+aws-powertools-bot@users.noreply.github.com" git config remote.origin.url >&- - name: Create Git Tag