Skip to content

Releases: aws-powertools/powertools-lambda-python

v3.9.0

25 Mar 13:44
Compare
Choose a tag to compare

This release improves the OpenAPI utility, letting customers distinguish between request and response validation errors. It also adds support for API Gateway WebSocket in the Event Source Data Class utility.

Thanks to @ericbn, we simplified the Event Source Data Class utility code, making it more readable and easier to maintain.

⭐ A huge thanks to our new contributor: @amin-farjadi.

Working with OpenAPI response validation

Docs

Customers can now customize response validation errors to be clearly identified.

Previously, both request and response validation failures triggered the same RequestValidationError, making debugging difficult. Response validation now raises a specific ResponseValidationError, helping you quickly identify validation issues. This is useful to both detect and handle these types of errors more easily.

validation

Working with API Gateway WebSocket events

Docs

You can now use the APIGatewayWebSocketEvent data class when working with WebSocket API events. This simplifies handling of API Gateway WebSocket events by providing better type completion in IDEs and easy access to event properties.

data_apigw

Changes

  • refactor(data_classes): Add base class with common code (#6297) by @ericbn
  • refactor(data_classes): remove duplicated code (#6288) by @ericbn
  • refactor(data_classes): simplify nested data classes (#6289) by @ericbn
  • refactor(tests): add LambdaContext type in tests (#6214) by @basvandriel

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

This release was made possible by the following contributors:

@ChristophrK, @amin-farjadi, @basvandriel, @dependabot[bot], @ericbn, @github-actions[bot], @leandrodamascena, dependabot[bot] and github-actions[bot]

v3.8.0

07 Mar 13:32
Compare
Choose a tag to compare

Summary

We are excited to announce a new feature in Logger: Logger buffering. This new feature allows you to buffer logs for a specific invocation, and flush them automatically on error or manually as needed.

A special thanks to Ollie Saul and James Saull from Dotelastic for their instrumental input on this new feature!

⭐ Also, huge thanks to our new contributors: @tiagohconte and @speshak.

New Log Buffering feature

Docs

You can now enable log buffering by passing buffer_config when initializing a new Logger instance. This feature allows you to:

  • Buffer logs at the WARNING, INFO, and DEBUG levels
  • Automatically flush logs on error or manually as needed
  • Reduce CloudWatch costs by decreasing the number of emitted log messages

buffer1

Configuration options

Option Description Default
max_bytes Maximum size of the buffer in bytes 20480
buffer_at_verbosity Minimum log level to buffer (more verbose levels are also buffered) DEBUG
flush_on_error_log Whether to flush buffer when an error is logged True

When log buffering is enabled, you can now pass a new opt-in flush_buffer_on_uncaught_error flag to the inject_lambda_context() decorator. When enabled, 1/ we'll intercept any raised exception, 2/ flush the buffer, and 3/ re-raise your original exception. This enables you to have detailed logs from your application when you need them the most.

buffer3

For detailed explanations with diagrams, please refer to our comprehensive documentation.

Buffering FAQs

Q: Does the buffer persist across Lambda invocations?
A: No, each Lambda invocation has its own buffer. The buffer is initialized when the Lambda function is invoked and is cleared after the function execution completes or when flushed manually.

Q: Are my logs buffered during cold starts?
A: No. We never buffer logs during cold starts to ensure all logs from this phase are immediately available for debugging.

Q: How can I prevent log buffering from consuming excessive memory?
A: You can limit the size of the buffer by setting the max_bytes option in the LoggerBufferConfig constructor parameter. This will ensure that the buffer does not grow indefinitely and consume excessive memory.

Q: What happens if the log buffer reaches its maximum size?
A: Older logs are removed from the buffer to make room for new logs. This means that if the buffer is full, you may lose some logs if they are not flushed before the buffer reaches its maximum size. When this happens, we emit a warning when flushing the buffer to indicate that some logs have been dropped.

Q: What timestamp is used when I flush the logs?
A: The timestamp preserves the original time when the log record was created. If you create a log record at 11:00:10 and flush it at 11:00:25, the log line will retain its original timestamp of 11:00:10.

Q: What happens if I try to add a log line that is bigger than max buffer size?
A: The log will be emitted directly to standard output and not buffered. When this happens, we emit a warning to indicate that the log line was too big to be buffered.

Q: What happens if Lambda times out without flushing the buffer?
A: Logs that are still in the buffer will be lost. If you are using the log buffer to log asynchronously, you should ensure that the buffer is flushed before the Lambda function times out. You can do this by calling the logger.flush_buffer() method at the end of your Lambda function.

Q: Do child loggers inherit the buffer?
A: No, child loggers do not inherit the buffer from their parent logger but only the buffer configuration. This means that if you create a child logger, it will have its own buffer and will not share the buffer with the parent logger.

Changes

  • refactor(tracer): fix capture_lambda_handler return type annotation (#6197) by @tiagohconte

🌟New features and non-breaking changes

📜 Documentation updates

  • docs(layer): Fix SSM parameter name for looking up layer ARN (#6221) by @speshak

🐛 Bug and hot fixes

🔧 Maintenance

This release was made possible by the following contr...

Read more

v3.7.0

25 Feb 12:57
Compare
Choose a tag to compare

Summary

In this release, we are thrilled to announce new features and improvements:

  • New Event Source Data Classes and Parser models for IoT Core Registry Events
  • Support for OpenAPI examples within parameters fields

We also fixed a bug in the Logger utility's custom handlers and expanded Lambda layer support to Thailand (ap-southeast-7) and Mexico Central (mx-central-1) regions.

⭐ Huge thanks to our new contributors: @basvandriel and @DKurilo

Working with IoT Core Registry Events with Parser

Docs

We have improved the Parser utility by adding support for events from IoT Core Registry Events

parser (1)

Here are all the models we have added for IoT Core Registry Events:

  • IoTCoreThingEvent - For Things Created/Updated/Deleted events
  • IoTCoreThingTypeEvent - For Thing Type Created/Updated/Deprecated/Deleted events
  • IoTCoreThingTypeAssociationEvent - For associating or disassociating a thing events
  • IoTCoreThingGroupEvent - For Thing Group Created/Updated/Deleted events
  • IoTCoreAddOrRemoveFromThingGroupEvent - For adding or removing a thing from a group events
  • IoTCoreAddOrDeleteFromThingGroupEvent - For adding or deleting a group within another group events

Adding examples to the OpenAPI schema

Docs

You can now include specific examples of parameter values directly in the schema objects. These examples are rendered in API documentation tools like SwaggerUI and provide a better experience when reading the OpenAPI schema.

openapi

Using Logger custom handlers

Docs

Customers can now rely on a correct logger handler selection in compute environments or custom setups where a standard logging logger shares the same name as a Powertools logger.

logger

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(parser): fix data types for sourceIPAddress and sequencer fields in S3RecordModel Model (#6154) by @DKurilo
  • fix(parser): fix EventBridgeModel when working with scheduled events (#6134) by @leandrodamascena
  • fix(openapi): validate response serialization when falsy (#6119) by @anafalcao
  • fix(logger): correctly pick powertools or custom handler in custom environments (#6083) by @leandrodamascena
  • fix(security): fix encryption_context handling in data masking operations (#6074) by @leandrodamascena

🔧 Maintenance

This release was made possible by the following contributors:

@DKurilo, @anafalcao, @basvandriel, @dependabot[bot], @github-actions[bot], @hjgraca, @leandrodamascena, dependabot[bot] and github-actions[bot]

v3.6.0

11 Feb 13:50
Compare
Choose a tag to compare

Summary

In this release, we are thrilled to announce new features and improvements:

  • Customizable masking capabilities with the erase method in Data Masking utility
  • Ability to disable metrics flush via environment variables
  • New Event Source Data Classes for API Gateway Authorizer Response WebSocket
  • New method to the Logger class to clear appended keys at any point during the execution of your Lambda invocation

Special thanks to @philiptzou, for improving type annotations in our OpenAPI utility! ⭐

Custom masking support for Data Masking

Docs

You can now configure advanced masking options when using erase method in the Data Masking utility. This feature provides granular control to protect sensitive information while maintaining data readability and structure.

The new options to use with erase :

  • Dynamic Mask: Preserves text length and structure by replacing characters with *
  • Custom Mask: Apply simple pattern like "XX-XX"
  • Regex Mask: Advanced pattern-based masking for complex data formats
  • Field-specific Allows different masking rules for different data fields

data_masking_new

Disable flushing metrics using environment variables

Docs

You can now set the POWERTOOLS_METRICS_DISABLES environment variable to control the metrics output. This is useful when you want to silent metrics in a non-production environment. When POWERTOOLS_DEV is enabled, the metrics are also suppressed, but you can always override it by setting POWERTOOLS_METRICS_DISABLED=false when you want to continue emitting metrics while in dev mode.

image

Support for API Gateway Authorizer Response WebSocket

Docs

You can now use the new APIGatewayAuthorizerResponseWebSocket class to handle authorization policies for WebSocket APIs.

image

Clearing all appended keys with clear_state() method

Docs

We have added a new clear_state() to Logger to easily remove any temporary keys you have added. This is useful when you add multiple custom keys conditionally or when you emit canonical or wide logs.

image

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

Read more

v3.5.0

28 Jan 17:21
Compare
Choose a tag to compare

Summary

We're excited to introduce new features and improvements in this release:

  • We have added new Event Source Data Classes for AWS Transfer Family
  • Idempotency feature with support for custom key prefixes
  • Context manager for logger keys, offering more flexible logging options

We also revamped the Data Source event class documentation and now we have more complete examples.

Thanks to @xdxindustries for helping us resolve a bug with OpenAPI and Pydantic Models' forward references.

⭐ Huge thanks to our new contributors: @kattakaha and @AlphaWong!

Working with AWS Transfer Family events

Docs

We've introduced new Event Source Data Classes to simplify custom identity provider authorizations in AWS Transfer Family, streamlining the process of constructing authorization responses for Lambda-based custom authorizers.

  • TransferFamilyAuthorizer: Converts incoming events into structured objects
  • TransferFamilyAuthorizerResponse: Facilitates building standardized authorization responses

image

Custom Idempotency Key Prefix Support

Docs

The @idempotent_function and @idempotent decorators now support an optional key_prefix parameter, allowing you to define custom prefixes for idempotency keys. With this feature, you can implement cross-function idempotency, group related operations under a common prefix, and ensure your idempotency records remain stable during code refactoring or Lambda function renaming.

It allows you to override the default idempotency key prefix, which is typically a combination of Lambda function, module, and decorated function names. By specifying a custom prefix, you gain more control over the idempotency key structure.

image

Context Manager for Logger Keys

Docs

The Logger utility now includes an append_context_keys context manager, allowing temporary addition of keys to the logger’s context within a with statement. This simplifies the process of adding contextual information to logs in specific code blocks.

image

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(event_handler): fixes typo in variable name fronzen_openapi_extensions (#5929) by @kattakaha
  • fix(event_handler): add tests for PEP 563 compatibility with OpenAPI (#5886) by @leandrodamascena
  • fix(event_handler): fix forward references resolution in OpenAPI (#5885) by @xdxindustries
  • fix(parser): make identitySource optional for ApiGatewayAuthorizerRequestV2 model (#5880) by @anafalcao

🔧 Maintenance

This release was made possible by the following contributors:

@AlphaWong, @anafalcao, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @kattakaha, @leandrodamascena and @xdxindustries

v3.4.1

14 Jan 21:59
Compare
Choose a tag to compare

Summary

In this release we fixed a bug in the Idempotency utility when using Optional types in output serialization.

🌟 ⭐ Thanks for @TonySherman for reporting this issue.

Using Optinal types in Idempotency serialization

Docs

Customers can now use Optional type when serializing Idempotency response. Previously, using Optional types in Idempotency serialization with Pydantic or Dataclasses caused serialization exception.

image

And last but not least, thanks to @aminalaee for reporting a bug in the resolver field naming in AppSync!

Changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

This release was made possible by the following contributors:

@anafalcao, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @heitorlessa and @leandrodamascena

v3.4.0

20 Dec 19:11
Compare
Choose a tag to compare

Summary

We are thrilled to announce support for querying Powertools Lambda layers ARN using SSM public parameters.

We also added support for API Gateway WebSocket events in the parser utility and added Lambda layer support in the AWS Malaysia region (ap-southeast-5).

Thanks to @tcysin, we have added deprecated flag support when working with OpenAPI operations in the Event handler.

🌟 ⭐ Congratulations to our new contributors @TurnrDev and @tcysin for getting their first PR merged!

Using Powertools SSM public parameters

Docs

Customers can now retrieve the latest Powertools for AWS Lambda (Python) layer ARN for Python versions 3.8 through 3.13 on both x86_64 and arm64 architectures using AWS Systems Manager Parameter Store.

To do this, simply use the AWS CLI command aws ssm get-parameter with the appropriate parameter name. For example, use /aws/service/powertools/python/<architecture>/<python_version>/latest , replacing with either "x86_64" or "arm64", and <python_version> with your desired Python version (e.g., "python3.8", "python3.9", etc.).

New parser models

Docs

We have improved the Parser utility by adding support for events from API Gateway WebSocket.

image

Here are all the modules we have added for EventModel:

  • APIGatewayWebSocketMessageEventModel - For WebSocket messages events
  • APIGatewayWebSocketConnectEventModel - For WebSocket $connect events
  • APIGatewayWebSocketDisconnectEventModel - For WebSocket $disconnect events

🚀 Thanks @ran-isenberg for another great contribution!

Using deprecated flag in the OpenAPI schema

Docs

You can now use the deprecated flag in your OpenAPI schema to mark operations that are no longer recommended. This helps customers clarify which parts of your API should be avoided in favor of newer options.

image

Last but not least, thanks to @junkor-1011 for catching a bug in the Parser utility.

Changes

  • refactor(event_handler): add type annotations for router decorators (#5601) by @rafrafek
  • refactor(event_handler): add type annotations for resolve function (#5602) by @rafrafek

🌟New features and non-breaking changes

  • feat(ssm): Parameters for resolving to versioned layers (#5754) by @sthulb
  • feat(event_handler): mark API operation as deprecated for OpenAPI documentation (#5732) by @tcysin
  • feat(layer): add new ap-southeast-5 region (#5769) by @sthulb
  • feat(metrics): warn when overwriting dimension (#5653) by @anafalcao
  • feat(parser): add models for API GW Websockets events (#5597) by @ran-isenberg
  • feat(event_handler): add exception handling mechanism for AppSyncResolver (#5588) by @leandrodamascena

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(parser): remove AttributeError validation from event_parser function (#5742) by @anafalcao
  • fix(ci): add overwrite to SSM workflow (#5775) by @sthulb
  • fix(parser): remove 'aws:' prefix from SelfManagedKafka model (#5584) by @anafalcao
  • fix(openapi): Allow values of any type in the examples of the Schema Object. (#5575) by @tonsho

🔧 Maintenance

  • chore(ci): adding missing region in matrix (#5777) by @leandrodamascena
  • chore(deps-dev): bump ruff from 0.8.3 to 0.8.4 (#5772) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.173.1a0 to 2.173.2a0 (#5771) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.84 to 1.35.85 (#5770) by @dependabot
  • chore(ci): disable dry run in layer balancing workflow (#5768) by @sthulb
  • chore(deps-dev): bump aws-cdk-lib from 2.173.1 to 2.173.2 (#5759) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.81 to 1.35.84 (#5765) by @dependabot
  • chore(deps): bump codecov/codecov-action from 5.1.1 to 5.1.2 (#5764) by @dependabot
  • chore(deps): bump actions/upload-artifact from 4.4.3 to 4.5.0 (#5763) by @dependabot
  • chore(deps): bump pydantic from 2.10.3 to 2.10.4 (#5760) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.173.1 to 2.173.2 (#5762) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.173.0a0 to 2.173.1a0 (#5755) by @dependabot
  • chore(ci): add workflow to balance layers per region (#5752) by @sthulb
  • chore(deps-dev): bump aws-cdk-lib from 2.173.0 to 2.173.1 (#5747) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.48 to 9.5.49 (#5748) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 3.7.1 to 3.8.0 (#5744) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.173.0 to 2.173.1 (#5745) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from d485eb6 to ba73db5 in /docs (#5746) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.17 to 3.0.18 (#5743) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.22.1 to 1.22.2 (#5749) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.80 to 1.35.81 (#5750) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.172.0a0 to 2.173.0a0 (#5736) by @dependabot
  • chore(deps): bump pydantic-settings from 2.6.1 to 2.7.0 (#5735) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.47 to 9.5.48 (#5717) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.172.0 to 2.173.0 (#5731) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.78 to 1.35.80 (#5730) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.22.0 to 1.22.1 (#5729) by @dependabot
  • chore(deps-dev): bump ruff from 0.8.2 to 0.8.3 (#5728) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.172.0 to 2.173.0 (#5727) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.171.1a0 to 2.172.0a0 (#5724) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.77 to 1.35.78 (#5723) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.21.0 to 1.22.0 (#5718) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.171.1 to 2.172.0 (#5719) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.76 to 1.35.77 (#5716) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.20.2 to 1.21.0 (#5711) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 3f571e7 to d485eb6 in /docs (#5710) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.171.1 to 2.172.0 (#5712) by @dependabot
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.3 (#5709) by @dependabot
  • chore(deps): bump codecov/codecov-action from 5.1.0 to 5.1.1 (#5703) by @dependabot
  • chore(deps-dev): bump httpx from 0.28.0 to 0.28.1 (#5702) by @dependabot
  • chore(deps): bump redis from 5.2.0 to 5.2.1 (#5701) by @dependabot
  • chore(deps-dev): bump types-python-dateutil from 2.9.0.20241003 to 2.9.0.20241206 (#5700) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.19.1 to 2.19.2 (#5699) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.285 to 0.1.287 (#5685) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.19.0 to 2.19.1 (#5694) by @dependabot
  • chore(deps-dev): bump pytest from 8.3.3 to 8.3.4 (#5695) by @dependabot
  • chore(deps): bump codecov/codecov-action from 5.0.7 to 5.1.0 (#5692) by @dependabot
  • chore(deps-dev): bump ruff from 0.8.1 to 0.8.2 (#5693) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.71 to 1.35.74 (#5691) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.20.1 to 1.20.2 (#5686) by @dependabot
  • chore(deps): bump pydantic from 2.10.2 to 2.10.3 (#5682) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.46 to 9.5.47 (#5677) by @dependabot
  • chore(deps-dev): bump ruff from 0.8.0 to 0.8.1 (#5671) by @dependabot
  • chore(deps): bump fastjsonschema from 2.20.0 to 2.21.1 (#5676) by @dependabot
  • chore(deps-dev): bump httpx from 0.27.2 to 0.28.0 (#5665) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from d063d84 to 3f571e7 in /docs (#5678) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.171.0a0 to 2.171.1a0 (#5666) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.171.0 to 2.171.1 (#5662) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.171.0 to 2.171.1 (#5661) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.69 to 1.35.71 (#5660) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.20.0 to 1.20.1 (#5659) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.284 to 0.1.285 (#5642) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.170.0a0 to 2.171.0a0 (#5655) by @dependabot
  • chore(deps): bump pydantic from 2.10.1 to 2.10.2 (#5654) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from ef0b45e to d063d84 in /docs (#5649) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.45 to 9.5.46 (#5645) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.16 to 3.0.17 (#5643) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.170.0 to 2.171.0 (#5647) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.170.0 to 2.171.0 (#5648) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.67 to 1.35.6...
Read more

v3.3.0

14 Nov 19:42
Compare
Choose a tag to compare

Summary

In this release we added support for the newly released Python 3.13 AWS Lambda managed runtime 🚀.

We’ve also revamped the Parser documentation, and added MutualTLS scheme support when working with OpenAPI schemas and Event handler.

Oh hey, please welcome Ana as our new full-time maintainer - @anafalcao 🎉

🌟 ⭐ Congrats to our new contributor @Sector95 for getting their first PR merged.

Python 3.13 support

You can now use Powertools for AWS Lambda (Python) with the new Python 3.13 runtime in AWS Lambda.

We’ve partnered with the AWS Lambda team for this launch and have been testing our toolkit for the past few weeks to ensure compatibility with no changes from your side.

To start using Powertools for AWS with the new runtime, you can upgrade to this version via PyPi or use the latest version (v4) of our Lambda layers.

Parser documentation

Docs

In this release, we have improved the Parser documentation to include comprehensive examples of using this feature.

image

Kudos to @anafalcao for this work and for her first merged PR 👏

Using MutualTLS in the OpenAPI schema

Docs

Customers now can use MutualTLS security scheme when defining their OpenAPI schema with Event Handler.

mutual

Last but not least, thanks to @xkortex for catching a bug in the Parser utility.

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

  • chore(ci): fix imports to build Lambda layer (#5557) by @leandrodamascena
  • chore(ci): Bump CDK version to build layers and fix imports (#5555) by @leandrodamascena
  • feat(runtime): add Python 3.13 support (#5527) by @leandrodamascena
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.279 to 0.1.281 (#5548) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.58 to 1.35.59 (#5549) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.18.4 to 1.19.0 (#5544) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.56 to 1.35.58 (#5540) by @dependabot
  • chore(deps-dev): bump ruff from 0.7.2 to 0.7.3 (#5532) by @dependabot
  • chore(deps): bump actions/setup-python from 5.2.0 to 5.3.0 (#5529) by @dependabot
  • chore(deps): bump actions/checkout from 4.2.0 to 4.2.2 (#5531) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.165.0a0 to 2.166.0a0 (#5533) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 2.4.1 to 3.7.1 (#5530) by @dependabot
  • chore(deps): bump docker/setup-qemu-action from 2.1.0 to 3.2.0 (#5528) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.54 to 1.35.56 (#5523) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.165.0 to 2.166.0 (#5522) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.165.0 to 2.166.0 (#5520) by @dependabot
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.12.1 to 1.12.2 (#5519) by @dependabot
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.11.0 to 1.12.1 (#5514) by @dependabot
  • chore(deps): bump datadog-lambda from 6.100.0 to 6.101.0 (#5513) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.278 to 0.1.279 (#5512) by @dependabot
  • chore(layers): add pydantic-settings package to v3 Layer (#5516) by @tkasuz
  • chore(deps): bump squidfunk/mkdocs-material from 2c2802b to ce587cb in /docs (#5507) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.43 to 9.5.44 (#5506) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.18.3 to 1.18.4 (#5501) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.164.1a0 to 2.165.0a0 (#5500) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.15 to 3.0.16 (#5499) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.17.0 to 2.18.0 (#5502) by @dependabot
  • chore(deps-dev): bump ruff from 0.7.1 to 0.7.2 (#5492) by @dependabot
  • chore(deps): bump datadog-lambda from 6.99.0 to 6.100.0 (#5491) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.164.1 to 2.165.0 (#5494) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.53 to 1.35.54 (#5493) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.164.1 to 2.165.0 (#5490) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 31eb7f7 to 2c2802b in /docs (#5487) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.42 to 9.5.43 (#5486) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.52 to 1.35.53 (#5485) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.18.2 to 1.18.3 (#5479) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.51 to 1.35.52 (#5478) by @dependabot
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 (#5477) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.49 to 1.35.51 (#5472) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.3.5 to 4.4.0 (#5469) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.18.1 to 1.18.2 (#5468) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.163.1a0 to 2.164.1a0 (#5467) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.164.0 to 2.164.1 (#5462) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.46 to 1.35.49 (#5460) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.164.0 to 2.164.1 (#5459) by @dependabot
  • chore(deps-dev): bump ruff from 0.7.0 to 0.7.1 (#5451) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.163.1 to 2.164.0 (#5453) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.163.1 to 2.164.0 (#5452) by @dependabot
  • chore(deps): bump redis from 5.1.1 to 5.2.0 (#5454) by @dependabot
  • chore(deps): bump actions/setup-python from 5.2.0 to 5.3.0 (#5449) by @dependabot
  • chore(deps): bump actions/setup-node from 4.0.4 to 4.1.0 (#5450) by @dependabot
  • chore(ci): bump minimum required pydantic version (#5446) by @leandrodamascena
  • chore(deps-dev): bump mypy from 1.11.2 to 1.13.0 (#5440) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.162.1a0 to 2.163.1a0 (#5441) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.277 to 0.1.278 (#5439) by @dependabot
  • chore(deps): bump actions/checkout from 4.2.1 to 4.2.2 (#5438) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.162.1 to 2.163.1 (#5429) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.45 to 1.35.46 (#5430) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.162.1 to 2.163.1 (#5432) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.3.4 to 4.3.5 (#5431) by @dependabot
  • chore(deps-dev): bump xenon from 0.9.1 to 0.9.3 (#5428) by @dependabot

This release was made possible by the following contributors:

@Sector95, @anafalcao, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @leandrodamascena, @sthulb and @tkasuz

v3.2.0

22 Oct 13:06
Compare
Choose a tag to compare

Summary

We are thrilled to announce that Powertools for AWS Lambda (Python) now offers AWS Lambda layers in the AWS GovCloud (US) regions.

🌟 ⭐ Thanks to @SimonBFrank's amazing work, our Logger utility is now thread-safe when handling extra keys.

New AWS GovCloud (US) Lambda Layer ARNs

You can now use Powertools for AWS Lambda (Python) Lambda layers in the AWS GovCloud (US) regions, enhancing customer experience by making our pre-packaged Lambda layers available in this AWS partition.

To take advantage of the new layers, you need to update your functions or deployment setup to include one of the new Lambda layer ARN from the table below:

AWS GovCloud (us-gov-east-1)

Architecture Layer ARN
x86_64 arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:{version}
ARM arn:aws-us-gov:lambda:us-gov-east-1:165087284144:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:{version}

AWS GovCloud (us-gov-west-1)

Architecture Layer ARN
x86_64 arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsPythonV3-{python_version}-x86_64:{version}
ARM arn:aws-us-gov:lambda:us-gov-west-1:165093116878:layer:AWSLambdaPowertoolsPythonV3-{python_version}-arm64:{version}

New thread-safe methods when working with extra keys in the Logger utility

Docs

Before this release, customers might have encountered issues when using append_keys between thread executions.

You can now use new thread-safe methods for managing extra keys in the Logger utility, ensuring safe and efficient logging in concurrent environments.

threads

Acknowledgements

Last but not least, we are thrilled to see our customers adopting v3, as it indicates we are moving in the right direction.

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

  • chore(deps-dev): bump cfn-lint from 1.17.2 to 1.18.1 (#5423) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.44 to 1.35.45 (#5421) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.41 to 9.5.42 (#5420) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.275 to 0.1.277 (#5419) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.14 to 3.0.15 (#5418) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 0d4e687 to 31eb7f7 in /docs (#5417) by @dependabot
  • chore(ci): Add dump of govcloud layer info in verify step (#5415) by @sthulb
  • chore(deps-dev): bump cfn-lint from 1.17.1 to 1.17.2 (#5408) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.43 to 1.35.44 (#5407) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.274 to 0.1.275 (#5406) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.16.1 to 1.17.1 (#5404) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.16.0 to 2.17.0 (#5400) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.42 to 1.35.43 (#5402) by @dependabot
  • chore(deps-dev): bump ruff from 0.6.9 to 0.7.0 (#5403) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.40 to 9.5.41 (#5393) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.41 to 1.35.42 (#5397) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.273 to 0.1.274 (#5394) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.39 to 1.35.41 (#5392) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from f9cb76d to 0d4e687 in /docs (#5395) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.161.1a0 to 2.162.1a0 (#5386) by @dependabot
  • chore(docs): remove layer callout from data masking docs (#5377) by @dreamorosi
  • chore(deps-dev): bump aws-cdk-lib from 2.161.1 to 2.162.1 (#5371) by @dependabot
  • chore(deps): bump actions/upload-artifact from 4.4.0 to 4.4.3 (#5373) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.161.1 to 2.162.1 (#5372) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.38 to 1.35.39 (#5370) by @dependabot
  • chore(deps): bump jsonpath-ng from 1.6.1 to 1.7.0 (#5369) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.16.0 to 1.16.1 (#5363) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.37 to 1.35.38 (#5364) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.39 to 9.5.40 (#5365) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 8e8b333 to f9cb76d in /docs (#5366) by @dependabot
  • chore(deps): bump actions/upload-artifact from 4.4.1 to 4.4.3 (#5357) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.36 to 1.35.37 (#5356) by @dependabot
  • chore(deps-dev): bump nox from 2024.4.15 to 2024.10.9 (#5355) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.161.0a0 to 2.161.1a0 (#5349) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.35 to 1.35.36 (#5350) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.15.0 to 2.16.0 (#5348) by @dependabot

This release was made possible by the following contributors:

@SimonBFrank, @dependabot, @dependabot[bot], @dreamorosi, @github-actions, @github-actions[bot], @leandrodamascena and @sthulb

v3.1.0

08 Oct 13:29
Compare
Choose a tag to compare

Summary

We are excited to announce the first release following the v3 GA release. In this release we addressed a bug in the Parser utility as well as a regression in the naming of our public Lambda layers.

Thanks to @mw-root we added support for Event Source for CodeDeploy Lifecycle Hook.

🌟 ⭐ A big thank you to our new contributors: @emmanuel-ferdman, @garysassano and @mw-root.

Correct Naming for Powertools Lambda Layer x86_64

In our initial v3 release, we mistakenly named the x86_64 Lambda layer as x86. We've corrected this issue in the current release, ensuring our Lambda layers now use the correct architecture naming convention.

For those who have already adopted the v3 Layer for this architecture, we recommend updating the ARN to use the new name using the table below as reference. The version of the Layer using the incorrect name will continue to be available but new releases, including this one, will follow the correct and updated naming convention.

Architecture Python version Layer ARN
x86_64 3.8 arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python38-x86_64:{version}
x86_64 3.9 arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python39-x86_64:{version}
x86_64 3.10 arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python310-x86_64:{version}
x86_64 3.11 arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python311-x86_64:{version}
x86_64 3.12 arn:aws:lambda:{region}:017000801446:layer:AWSLambdaPowertoolsPythonV3-python312-x86_64:{version}

New CodeDeploy Lifecycle Hook Event Source Data Class

Docs

You can now use CodeDeployLifecycleHookEvent for a better experience with type hinting and code completion support when working with AWS Lambda functions that process AWS CodeDeploy events.

dataclass_code

Parser utility is now returning ValidationError

Before this release when parsing an event failed, we were catching the ValidationError raised by Pydantic and re-raising it as an InvalidModelTypeError.

We now raise the ValidationError directly, allowing our customers to handle data validation errors more effectively.

Thanks for this important bug report @jhare-rectangle

Acknowledgements

Last but not least, we are thrilled to see our customers adopting v3, as it indicates we are moving in the right direction.

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

  • chore(deps): bump datadog-lambda from 6.98.0 to 6.99.0 (#5333) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.34 to 1.35.35 (#5334) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.161.0 to 2.161.1 (#5335) by @dependabot
  • chore(deps): bump actions/upload-artifact from 4.4.0 to 4.4.1 (#5328) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.272 to 0.1.273 (#5336) by @dependabot
  • chore(deps): bump redis from 5.1.0 to 5.1.1 (#5331) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.161.0 to 2.161.1 (#5327) by @dependabot
  • chore(deps): bump actions/checkout from 4.2.0 to 4.2.1 (#5329) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.160.0a0 to 2.161.0a0 (#5332) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.13 to 3.0.14 (#5330) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.15.2 to 1.16.0 (#5305) by @dependabot
  • chore(deps-dev): bump ruff from 0.6.8 to 0.6.9 (#5308) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.160.0 to 2.161.0 (#5309) by @dependabot
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.10.2 to 1.10.3 (#5311) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 3.7.0 to 3.7.1 (#5310) by @dependabot
  • chore(deps-dev): bump types-redis from 4.6.0.20240903 to 4.6.0.20241004 (#5307) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.33 to 1.35.34 (#5306) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.160.0 to 2.161.0 (#5304) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.271 to 0.1.272 (#5297) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 3.6.1 to 3.7.0 (#5298) by @dependabot
  • chore(deps-dev): bump types-python-dateutil from 2.9.0.20240906 to 2.9.0.20241003 (#5296) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.32 to 1.35.33 (#5295) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.31 to 1.35.32 (#5292) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 2.14.0 to 2.15.0 (#5285) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.29 to 1.35.31 (#5286) by @dependabot
  • chore(deps): bump codecov/codecov-action from 4.5.0 to 4.6.0 (#5287) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.270 to 0.1.271 (#5284) by @dependabot
  • chore(tests): fix e2e tests in Idempotency utility (#5280) by @leandrodamascena
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.12 to 3.0.13 (#5276) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.15.1 to 1.15.2 (#5274) by @dependabot
  • chore(deps-dev): bump multiprocess from 0.70.16 to 0.70.17 (#5275) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.38 to 9.5.39 (#5273) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 7aea359 to 8e8b333 in /docs (#5272) by @dependabot
  • chore(deps): bump redis from 5.0.8 to 5.1.0 (#5264) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.28 to 1.35.29 (#5263) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.37 to 9.5.38 (#5255) by @dependabot
  • chore(deps-dev): bump ruff from 0.6.7 to 0.6.8 (#5254) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.27 to 1.35.28 (#5256) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.269 to 0.1.270 (#5257) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 08fbf58 to 7aea359 in /docs (#5253) by @dependabot
  • chore(docs): recreate requirements.txt file for mkdocs container (#5246) by @leandrodamascena
  • chore(deps): bump actions/checkout from 4.1.7 to 4.2.0 (#5244) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.26 to 1.35.27 (#5242) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.36 to 9.5.37 (#5241) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 22a429f to 08fbf58 in /docs (#5243) by @dependabot
  • chore(deps-dev): bump boto3-stubs from 1.35.25 to 1.35.26 (#5234) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.159.1 to 2.160.0 (#5233) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.159.1a0 to 2.160.0a0 (#5235) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.159.1 to 2.160.0 (#5230) by @dependabot
  • chore(deps-dev): bump cfn-lint from 1.15.0 to 1.15.1 (#5232) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.158.0a0 to 2.159.1a0 (#5231) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.268 to 0.1.269 (#5229) by @dependabot
  • chore(deps): bump actions/setup-node from 4.0.3 to 4.0.4 (#5186) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.158.0 to 2.159.1 (#5208) by @dependabot
  • chore(deps-dev): bump ruff from 0.6.4 to 0.6.7 (#5207) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.157.0 to 2.159.1 (#5194) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from a2e3a31 to 22a429f in /docs (#5201) by @dependabot
  • chore(deps): bump actions/download-artifact from 4.1.7 to 4.1.8 (#5203) by @dependabot
  • chore(deps): bump docker/setup-qemu...
Read more