Skip to content

Releases: aws-powertools/powertools-lambda-python

v2.37.0

18 Apr 11:53
Compare
Choose a tag to compare

Summary

This release adds Security Schemes support for generated OpenAPI / Swagger UI, and a new feature to manipulate idempotent responses. 🚀🚀 And of course, you know it, fixes in typing and documentation. 🎉

🌟 Tons of things in this release was only possible because of our community. 🌟 A huge thank you to @walmsles, @Wurstnase, @SZubarev, @Emerson-MM-Filho, @nlykkei, @amyc92 and many others for your support and collaboration!

OpenAPI Security Schemes

Docs

You can now add security scheme annotations to your generated OpenAPI documentation (HTTP headers, API keys, OAuth 2 and OpenID connect). Additionally, you can configure the built-in Swagger UI to use OAuth 2 when generating requests.

carbon (21) (1)
image (26)

🌟 Huge thanks to @nlykkei for helping us shape this feature!

Manipulating Idempotent Responses

Docs

You can now set up a response_hook in the IdempotentConfig class to manipulate the returned data when an operation is idempotent. The hook function will be called with the current deserialized response object and the idempotency record.

This can be used for changing something in the response, inject headers, emit custom metrics, and many other use cases.

carbon (23)

🌟 Thank you @walmsles for leading the design and implementation of this!

Changes

🌟New features and non-breaking changes

  • feat(event_handler): add support for OpenAPI security schemes (#4103) by @rubenfonseca
  • feat(event_sources,parser): add support for DeadLetterQueueSourceArn for SQS (#4133) by @rubenfonseca
  • feat(logger): add method to return currently configured keys (#4033) by @leandrodamascena
  • feat(idempotency): add feature for manipulating idempotent responses (#4037) by @walmsles

📜 Documentation updates

  • docs(we-made-this): new article on how to stream data with AWS Lambda & Powertools for AWS Lambda (#4068) by @leandrodamascena

🐛 Bug and hot fixes

  • fix(typing): make the case_sensitive field a boolean only (#4128) by @Wurstnase
  • fix(typing): improve overloads to ensure the return type follows the default_value type (#4114) by @Wurstnase
  • fix(docs): clarified usage of validation with fine grained responses (#4101) by @rubenfonseca
  • fix(event_source): fix typo in physicalname attribute for AmazonMQ events (#4053) by @SZubarev

🔧 Maintenance

  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.115 to 0.1.119 (#4150) by @dependabot
  • chore(deps-dev): bump types-redis from 4.6.0.20240409 to 4.6.0.20240417 (#4145) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.17 to 9.5.18 (#4143) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.113 to 0.1.115 (#4142) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 6b124e1 to 521644b in /docs (#4141) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.86.2 to 0.86.3 (#4137) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.112 to 0.1.113 (#4136) by @dependabot
  • chore(deps): bump sqlparse from 0.4.4 to 0.5.0 (#4138) by @dependabot
  • chore(deps-dev): bump black from 24.3.0 to 24.4.0 (#4135) by @dependabot
  • chore(docs): update highlighted lines on the Typing examples (#4131) by @Emerson-MM-Filho
  • chore(deps-dev): bump mypy-boto3-cloudformation from 1.34.77 to 1.34.84 in the boto-typing group (#4126) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.136.0a0 to 2.137.0a0 (#4124) by @dependabot
  • chore(deps): bump idna from 3.6 to 3.7 (#4121) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.136.1 to 2.137.0 (#4119) by @dependabot
  • chore(deps-dev): bump ruff from 0.3.5 to 0.3.7 (#4123) by @dependabot
  • chore(deps-dev): bump mypy-boto3-cloudwatch from 1.34.75 to 1.34.83 in the boto-typing group (#4116) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.136.1 to 2.137.0 (#4115) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.110 to 0.1.112 (#4109) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.44.1 to 1.45.0 (#4108) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.136.0 to 2.136.1 (#4107) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.136.0 to 2.136.1 (#4106) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.107 to 0.1.110 (#4097) by @dependabot
  • chore(deps-dev): bump filelock from 3.13.3 to 3.13.4 (#4096) by @dependabot
  • chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.3 to 3.0.4 (#4099) by @dependabot
  • chore(deps): bump codecov/codecov-action from 4.2.0 to 4.3.0 (#4098) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.135.0a0 to 2.136.0a0 (#4095) by @dependabot
  • chore(deps-dev): bump types-redis from 4.6.0.20240311 to 4.6.0.20240409 (#4094) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.135.0 to 2.136.0 (#4090) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 3.2.0 to 3.3.0 (#4091) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.135.0 to 2.136.0 (#4092) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.86.1 to 0.86.2 (#4081) by @dependabot
  • chore(deps): bump typing-extensions from 4.10.0 to 4.11.0 (#4080) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.106 to 0.1.107 (#4082) by @dependabot
  • chore(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.27.10 to 1.27.11 in /layer/scripts/layer-balancer in the layer-balancer group (#4079) by @dependabot
  • chore(ci): add monthly roadmap reminder workflow (#4075) by @heitorlessa
  • chore(deps): bump codecov/codecov-action from 4.1.1 to 4.2.0 (#4072) by @dependabot
  • chore(deps): bump golang.org/x/sync from 0.6.0 to 0.7.0 in /layer/scripts/layer-balancer in the layer-balancer group (#4071) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.44.0 to 1.44.1 (#4065) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.134.0a0 to 2.135.0a0 (#4063) by @dependabot
  • chore(deps): bump pydantic from 1.10.14 to 1.10.15 (#4064) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 2 updates (#4062) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#4066) by @dependabot
  • chore(ci): prevent deprecated custom runner from being used (#4061) by @heitorlessa
  • chore(deps-dev): bump aws-cdk from 2.134.0 to 2.135.0 (#4058) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.134.0 to 2.135.0 (#4057) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.16 to 9.5.17 (#4056) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 065f3af to 6b124e1 in /docs (#4055) by @dependabot
  • chore(deps-dev): bump ruff from 0.3.4 to 0.3.5 (#4049) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.15 to 9.5.16 (#4050) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#4047) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 3307665 to 065f3af in /docs (#4052) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.105 to 0.1.106 (#4048) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#4042) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.133.0a0 to 2.134.0a0 (#4039) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.43.0 to 1.44.0 (#4040) by @dependabot
  • chore(deps): bump datadog-lambda from 5.91.0 to 5.92.0 (#4038) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.133.0 to 2.134.0 (#4031) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.104 to 0.1.105 (#4030) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.133.0 to 2.134.0 (#4032) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#4029) by @dependabot

This release was made possible by the following contributors:

@Emerson-MM-Filho, @SZubarev, @Wurstnase, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @heitorlessa, @leandrodamascena, @rubenfonseca and @walmsles

v2.36.0

28 Mar 11:28
Compare
Choose a tag to compare

Summary

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

  • Support for creating and updating Parameters and Secrets
  • Custom timestamps are now available with the EMF Metrics Provider for creating metrics
  • New flag for optimized batch processing with SQS Fifo queues
  • Introducing the new CloudWatchAlarmEvent data class

We also made enhancements to our OpenAPI and type checking, and fixed some bugs!

⭐ Huge thanks to our new contributors: @rafrafek, @xquek, and @par6n!

Creating and updating Parameters and Secrets

Docs

In response to our customer requests, Powertools now provides an enhanced experience for effortlessly creating and updating Parameters and Secrets. Recognizing the critical importance of parameters and secrets management, we created this new feature to empower customers with a seamless experience in managing their sensitive information.

parameters

secrets

A big thank you to @stephenbawks for their dedicated effort in implementing this new feature.

EMF Metrics with custom timestamp

Docs

Some customers may need to create metrics with specific timestamps, to address this use case we've added the capability set custom metrics with specific timestamps to improve customer flexibility. Previously, this was not possible and all metrics were generated with the current timestamp.

timestamp

New flag for optimized batch processing with SQS Fifo queues

Docs

We've created a new flag to enable seamless processing of messages from different group IDs. Activating this flag ensures that messages from a failed group ID are returned to SQS, allowing uninterrupted processing of messages from subsequent group IDs.

batch

Thank you @duc00, for highlighting such an important matter and contributing to the improvement of this utility.

New CloudWatchAlarmEvent data class

Docs

Customers now have the ability to utilize CloudWatchAlarmEvent, which provides Type hinting and code completion support for this event, enhancing the development experience.

cwagent

Last but not least, we've made significant improvements to our OpenAPI utility and fixed bugs to ensure a smoother experience. See all the latest improvements and bugfix in the changes section.

Changes

  • refactor(logger): add type annotation for append_keys method (#3988) by @rafrafek
  • refactor(parameters): improve typing for get_secret method (#3910) by @TonySherman

🌟New features and non-breaking changes

  • feat(metrics): allow custom timestamps for metrics (#4006) by @leandrodamascena
  • feat(parameters): add feature for creating and updating Parameters and Secrets (#2858) by @stephenbawks
  • feat(batch): add flag in SqsFifoProcessor to enable continuous message processing (#3954) by @leandrodamascena
  • feat(tracer): auto-disable tracer when for AWS SAM and Chalice environments (#3949) by @leandrodamascena
  • feat(event_handler): define exception_handler directly from the router (#3979) by @leandrodamascena
  • feat(event-handler): add compress option when serving Swagger HTML (#3946) by @xquek
  • feat(data_classes): Add CloudWatchAlarmEvent data class (#3868) by @par6n

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

  • chore(deps-dev): bump aws-cdk-lib from 2.133.0 to 2.134.0 (#4031) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.104 to 0.1.105 (#4030) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.133.0 to 2.134.0 (#4032) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#4029) by @dependabot
  • chore(deps): bump codecov/codecov-action from 4.1.0 to 4.1.1 (#4021) by @dependabot
  • chore(deps): bump actions/setup-python from 5.0.0 to 5.1.0 (#4022) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.2.4 to 4.2.5 (#4023) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.101 to 0.1.104 (#4020) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 6c81a89 to 3307665 in /docs (#4017) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.14 to 9.5.15 (#4016) by @dependabot
  • chore(deps-dev): bump pytest-cov from 4.1.0 to 5.0.0 (#4013) by @dependabot
  • chore(deps-dev): bump filelock from 3.13.1 to 3.13.3 (#4014) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.2.3 to 4.2.4 (#4012) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.99 to 0.1.101 (#4015) by @dependabot
  • chore(deps-dev): bump pytest-mock from 3.13.0 to 3.14.0 (#4007) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.96 to 0.1.99 (#4008) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.86.0 to 0.86.1 (#3998) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.94 to 0.1.96 (#4002) by @dependabot
  • chore(deps-dev): bump pytest-mock from 3.12.0 to 3.13.0 (#3999) by @dependabot
  • chore(deps-dev): bump ruff from 0.3.3 to 0.3.4 (#3996) by @dependabot
  • chore(deps): bump slsa-framework/slsa-github-generator from 1.9.0 to 1.10.0 (#3997) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#4001) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.42.0 to 1.43.0 (#3992) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.1.3 to 4.2.3 (#3993) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3991) by @dependabot
  • chore(deps-dev): bump pytest-asyncio from 0.23.5.post1 to 0.23.6 (#3984) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.91 to 0.1.94 (#3985) by @dependabot
  • chore(deps): bump aws-encryption-sdk from 3.1.1 to 3.2.0 (#3983) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 2 updates (#3982) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.132.1a0 to 2.133.0a0 (#3976) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.13 to 9.5.14 (#3978) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.90 to 0.1.91 (#3975) by @dependabot
  • chore(deps-dev): bump types-python-dateutil from 2.9.0.20240315 to 2.9.0.20240316 (#3977) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 3678304 to 6c81a89 in /docs (#3973) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#3972) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 2 updates (#3974) by @dependabot
  • chore(deps-dev): bump ruff from 0.3.2 to 0.3.3 (#3967) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.132.1 to 2.133.0 (#3965) by @dependabot
  • chore(deps-dev): bump black from 24.2.0 to 24.3.0 (#3968) by @dependabot
  • chore(deps-dev): bump types-python-dateutil from 2.8.19.20240311 to 2.9.0.20240315 (#3966) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.132.1 to 2.133.0 (#3963) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3964) by @dependabot
  • chore(deps): bump datadog-lambda from 5.90.0 to 5.91.0 (#3958) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.89 to 0.1.90 (#3957) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3956) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 3.1.0 to 3.2.0 (#3955) by @dependabot
  • chore(deps-dev): bump coverage from 7.4.3 to 7.4.4 (#3959) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.88 to 0.1.89 (#3952) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.41.0 to 1.42.0 (#3951) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3950) by @dependabot
  • chore(deps): bump datadog-lambda from 5.89.0 to 5.90.0 (#3941) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 2 updates (#3940) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.87 to 0.1.88 (#3942) by @dependabot
  • chore(deps-dev): bump pytest from 8.0.2 to 8.1.1 (#3943) by @dependabot
  • chore(deps-dev): bump aws-cdk-aws-lambda-python-alpha from 2.131.0a0 to 2.132.1a0 (#3944) by @dependabot
  • chore(deps): bump actions/checkout from 4.1.1 to 4.1....
Read more

v2.35.1

08 Mar 10:58
Compare
Choose a tag to compare

Summary

This patch release squashes a couple of bugs:

  • Bedrock Agent Resolver: we now correctly process any request body data (e.g: on a POST request)
  • Event Handler Data Validation: any custom serializer passed to a resolver will now be used for custom objects during OpenAPI data/parameter validation
  • Data Sources: we've improved the typing on the SQSMessageAttributes data class

Huge thanks to @aitchnyu, @robk1234 and @palfrey for reporting and helping us fix these issues!

Changes

🐛 Bug and hot fixes

🔧 Maintenance

  • chore(deps): bump datadog-lambda from 5.88.0 to 5.89.0 (#3907) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.82 to 0.1.83 (#3908) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.40.6 to 1.41.0 (#3905) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#3911) by @dependabot
  • chore(deps): bump aws-xray-sdk from 2.12.1 to 2.13.0 (#3906) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3904) by @dependabot
  • chore(deps-dev): bump cdklabs-generative-ai-cdk-constructs from 0.1.81 to 0.1.82 (#3896) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.12 to 9.5.13 (#3895) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 7be068b to 3678304 in /docs (#3894) by @dependabot

This release was made possible by the following contributors:

@dependabot, @dependabot[bot], @github-actions, @github-actions[bot] and @rubenfonseca

v2.35.0

06 Mar 11:15
Compare
Choose a tag to compare

Summary

We’re super excited to introduce a brand new utility to author Agents for Amazon Bedrock! 🎉🎉

Agents for Amazon Bedrock is a feature to build and deploy conversational agents that can interact with your customers using Large Language Models (LLM) and AWS Lambda functions.

image

Agents for Amazon Bedrock Event Handler

Docs

Building on top of the Event Handler validation framework and the OpenAPI generation feature introduced in December, we created a new utility to:

  • 🛠 Drastically reduce the boilerplate to build Agents for Amazon Bedrock
  • 🚀 Automatically generate OpenAPI schemas from your business logic code
  • ✅ Built-in data validation for requests and responses
  • 🌐 Similar experience when authoring REST and HTTP APIs

Here's an agent with an action to schedule a meeting, ensuring that a valid email was passed in by the user:

image

Check out our brand new docs on the feature and let us know what you think!

Oh and we also fixed some bugs :) Thank you @kbakk and @aminalaee for your contributions!

Changes

📜 Documentation updates

🐛 Bug and hot fixes

  • fix(event_handler): OpenAPI schema version respects Pydantic version (#3860) by @rubenfonseca

🔧 Maintenance

  • chore(docs): add Bedrock Agents to feature list (#3889) by @rubenfonseca
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#3887) by @dependabot
  • docs(event_handler): add bedrock agent resolver documentation (#3602) by @rubenfonseca
  • chore(deps-dev): bump cfn-lint from 0.85.3 to 0.86.0 (#3882) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.130.0 to 2.131.0 (#3883) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#3884) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.130.0 to 2.131.0 (#3881) by @dependabot
  • chore(deps): bump actions/download-artifact from 4.1.3 to 4.1.4 (#3875) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 49d1bfd to 7be068b in /docs (#3872) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.11 to 9.5.12 (#3870) by @dependabot
  • chore(deps-dev): bump ruff from 0.2.2 to 0.3.0 (#3871) by @dependabot
  • chore(deps): bump redis from 5.0.1 to 5.0.2 (#3867) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.85.2 to 0.85.3 (#3861) by @dependabot
  • chore(deps): bump actions/download-artifact from 4.1.2 to 4.1.3 (#3862) by @dependabot
  • chore(deps): bump pypa/gh-action-pypi-publish from 1.8.11 to 1.8.12 (#3863) by @dependabot
  • chore(deps): bump docker/setup-buildx-action from 3.0.0 to 3.1.0 (#3864) by @dependabot
  • chore(deps-dev): bump black from 24.1.1 to 24.2.0 (#3760) by @dependabot
  • chore(deps): bump codecov/codecov-action from 4.0.2 to 4.1.0 (#3856) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 43b898a to 49d1bfd in /docs (#3857) by @dependabot

This release was made possible by the following contributors:

@aminalaee, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot] and @rubenfonseca

v2.34.2

26 Feb 15:15
Compare
Choose a tag to compare

Summary

This patch release removes Data Masking dependencies from our managed Lambda Layer, explicitly aws-encryption-sdk who depend on cffi. The issue is that cffi has to be compiled to each specific Python version while we didn't.

We are investigating the creation of a new layer per each Python version to bring back Data Masking dependencies. As of now, to use Data masking, you'll need to bring aws-encryption-sdk as part of your dependencies until then.

Changes

🌟New features and non-breaking changes

  • feat(event-source): add function to get multi-value query string params by name (#3846) by @TonySherman

📜 Documentation updates

  • docs(install): make minimum install the default option then extra (#3834) by @heitorlessa

🐛 Bug and hot fixes

  • fix(typing): ensure return type is a str when default_value is set (#3840) by @Wurstnase

🔧 Maintenance

  • chore(ci): remove aws-encryption-sdk from Lambda layer due to cffi being tied to python version (#3853) by @leandrodamascena
  • chore(deps-dev): bump aws-cdk from 2.129.0 to 2.130.0 (#3843) by @dependabot
  • chore(deps): bump codecov/codecov-action from 4.0.1 to 4.0.2 (#3842) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#3844) by @dependabot
  • chore(deps-dev): bump httpx from 0.26.0 to 0.27.0 (#3828) by @dependabot
  • chore(deps): bump cryptography from 42.0.2 to 42.0.4 (#3827) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.128.0 to 2.130.0 (#3838) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.128.0 to 2.129.0 (#3831) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#3835) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3836) by @dependabot

This release was made possible by the following contributors:

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

v2.34.1

21 Feb 19:20
Compare
Choose a tag to compare

Summary

Patch release to fix a regression introduced in v2.33 when running Event Handler REST API locally (unit test)...spotted by @Jonathan-Chang 🌟!

Huge thanks to Jonathan for reporting on Discord and helping triage all the way through.

Changes

🐛 Bug and hot fixes

🔧 Maintenance

This release was made possible by the following contributors:

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

v2.34.0

21 Feb 09:06
Compare
Choose a tag to compare

Summary

This release adds a new list intersection set of actions in Feature Flags, hot new community content, and tons of bugs squashed!

🌟 Huge thanks to community friends (recurring contributors): @gwlester on new feature flag list intersection, @ericbn on docs layer ARN automation bug, and @ran-isenberg on two hot new content!

Feature flags list intersection

Thanks to @Rogalek for the feature request!

You can now toggle feature flags on three new actions:

  • ALL_IN_VALUE. Toggle a given flag if all list items provided are also available in the schema.

    • Schema sample
      {
          "my_feature": {
              "default": false,
              "rules": {
                  "tenant_id is in allowed list": {
                      "when_match": true,
                      "conditions": [
                          {
                              "action": "ALL_IN_VALUE",
                              "key": "tenant_id",
                              "value": [
                                  "Łukasz",
                                  "Gerald",
                                  "Leandro",
                                  "Heitor"
                              ]
                          }
                      ]
                  }
              }
          }
      }
  • ANY_IN_VALUE. Toggle a given flag if any list item provided is also available in the schema.

    • Schema sample
      {
          "my_feature": {
              "default": false,
              "rules": {
                  "tenant_id is in allowed list": {
                      "when_match": true,
                      "conditions": [
                          {
                              "action": "NONE_IN_VALUE",
                              "key": "tenant_id",
                              "value": [
                                  "Łukasz",
                                  "Gerald",
                                  "Leandro",
                                  "Heitor"
                              ]
                          }
                      ]
                  }
              }
          }
      }
  • NONE_IN_VALUE. Toggle a given flag is no list item provided is available in the schema.

    • Schema sample
      {
          "my_feature": {
              "default": false,
              "rules": {
                  "tenant_id is in allowed list": {
                      "when_match": true,
                      "conditions": [
                          {
                              "action": "NONE_IN_VALUE",
                              "key": "tenant_id",
                              "value": [
                                  "Łukasz",
                                  "Gerald",
                                  "Leandro",
                                  "Heitor"
                              ]
                          }
                      ]
                  }
              }
          }
      }

Changes

🌟New features and non-breaking changes

  • feat(feature_flags): add intersect actions for conditions (#3692) by @gwlester

📜 Documentation updates

  • docs(we-made-this): add swagger post (#3799) by @ran-isenberg
  • chore(deps): bump squidfunk/mkdocs-material from 62d3668 to 43b898a in /docs (#3801) by @dependabot
  • docs(we-made-this): add reinvent 2023 session (#3790) by @ran-isenberg
  • docs(feature_flags): fix incorrect line markers and envelope name (#3792) by @ran-isenberg
  • docs(homepage): remove leftover announcement banner (#3783) by @dreamorosi
  • docs(home): update layer version to 62 for package version 2.33.1 (#3778) by @ericbn
  • docs(home): add note about POWERTOOLS_DEV side effects in CloudWatch Logs (#3770) by @heitorlessa
  • chore(deps): bump squidfunk/mkdocs-material from 6a72238 to 62d3668 in /docs (#3756) by @dependabot
  • docs(roadmap): latest roadmap update; use new grid to de-clutter homepage (#3755) by @heitorlessa
  • docs(homepage): discord flat badge style; remove former devax email (#3768) by @hjgraca
  • feat(feature_flags): add intersect actions for conditions (#3692) by @gwlester

🐛 Bug and hot fixes

  • fix(ci): revert layer version bump write-only back to append (#3818) by @heitorlessa
  • fix(ci): create one layer artifact per region & merge (#3808) by @heitorlessa
  • fix(event-handler): multi-value query string and validation of scalar parameters (#3795) by @rubenfonseca
  • fix(event-handler): swagger schema respects api stage (#3796) by @rubenfonseca
  • fix(event-handler): handle aliased parameters e.g., Query(alias="categoryType") (#3766) by @rubenfonseca

🔧 Maintenance

  • chore(deps-dev): bump ruff from 0.2.1 to 0.2.2 (#3802) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 2 updates (#3810) by @dependabot
  • chore(deps-dev): bump coverage from 7.4.1 to 7.4.2 (#3811) by @dependabot
  • chore(deps-dev): bump pytest from 8.0.0 to 8.0.1 (#3812) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.1.2 to 4.1.3 (#3813) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 2 updates (#3814) by @dependabot
  • chore(tests): increase idempotency coverage with nested payload tampering tests (#3809) by @heitorlessa
  • chore(deps): bump actions/dependency-review-action from 4.1.0 to 4.1.2 (#3800) by @dependabot
  • chore(deps-dev): bump types-redis from 4.6.0.20240106 to 4.6.0.20240218 (#3804) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 62d3668 to 43b898a in /docs (#3801) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.9 to 9.5.10 (#3803) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.40.4 to 1.40.5 (#3805) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.127.0 to 2.128.0 (#3777) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 2 updates (#3797) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.127.0 to 2.128.0 (#3776) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#3784) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.85.1 to 0.85.2 (#3786) by @dependabot
  • refactor(feature-flags): add intersection tests; structure refinement (#3775) by @heitorlessa
  • chore(deps-dev): bump pytest-asyncio from 0.21.1 to 0.23.5 (#3773) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.40.3 to 1.40.4 (#3765) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 6a72238 to 62d3668 in /docs (#3756) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 3 updates (#3764) by @dependabot
  • chore(deps): bump actions/dependency-review-action from 4.0.0 to 4.1.0 (#3771) by @dependabot
  • chore(deps-dev): bump the boto-typing group with 1 update (#3757) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.126.0 to 2.127.0 (#3758) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.126.0 to 2.127.0 (#3761) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.5.8 to 9.5.9 (#3759) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.40.2 to 1.40.3 (#3750) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.85.0 to 0.85.1 (#3749) by @dependabot

This release was made possible by the following contributors:

@dependabot, @dependabot[bot], @dreamorosi, @ericbn, @github-actions, @github-actions[bot], @gwlester, @heitorlessa, @hjgraca, @ran-isenberg and @rubenfonseca

v2.33.1

09 Feb 13:26
Compare
Choose a tag to compare

Summary

This release officially drops support for Python 3.7 in Powertools for AWS, followed by AWS Lambda runtime deprecation. We also published our versioning policy under Processes section to give you further transparency.

🌟 Huge thanks to a new contributor @Wurstnase (mypy fix)
🔥 Nathan Hanks's new blog post features how he used the Metrics feature to boost app engagement

Changes

📜 Documentation updates

🔧 Maintenance

This release was made possible by the following contributors:

@Wurstnase, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @heitorlessa, @leandrodamascena and @ran-isenberg

v2.33.0

02 Feb 14:11
Compare
Choose a tag to compare

Summary

We are pleased to announce our first security feature: Data Masking. You can now encrypt, decrypt, or irreversibly erase sensitive information to protect data confidentiality.

We also made enhancements to our OpenAPI utility, and fixed some bugs!

⭐ Huge thanks to our new contributor: @maauk

Data masking

Docs

You can now encrypt, decrypt, or irreversibly erase sensitive information to protect data confidentiality.

image

We partnered with the AWS Crypto team to offer a thin layer on top of the AWS Encryption SDK and Amazon KMS, optimized to run on AWS Lambda ephemeral environments.

At launch, Data Masking solves three common use cases, with a fourth one (field encryption) coming.

  1. Selectively erase confidential data. You want to remove sensitive information from one or more fields for a given payload, however nested these fields might be.
  2. Encrypt and decrypt an entire payload. You want to protect the entire payload while ensuring data integrity, and optionally add metadata to each operation for further protection.
  3. Use multiple keys for high availability. You want to use more than one Amazon KMS key to encrypt while allowing decryption with any of the keys used for encryption.

It wouldn't be awesome if we didn't mention that we spent a few months crafting several code snippets, use cases, diagrams, and a simplified terminology to help you digest common industry security practices.

Enough with the talk :) Here's a working code snippet with these use cases combined.

from __future__ import annotations

import os

from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.data_masking import DataMasking
from aws_lambda_powertools.utilities.data_masking.provider.kms.aws_encryption_sdk import (
    AWSEncryptionSDKProvider,
)
from aws_lambda_powertools.utilities.typing import LambdaContext

KEY_ONE = os.getenv("KMS_KEY_ARN", "")
KEY_TWO = os.getenv("KMS_KEY_TWO_ARN", "")

logger = Logger()

encryption_provider = AWSEncryptionSDKProvider(keys=[KEY_ONE, KEY_TWO])  # encrypt/decrypt operations
data_masker = DataMasking(provider=encryption_provider)


@logger.inject_lambda_context
def lambda_handler(event: dict, context: LambdaContext) -> dict:
    data: dict = event.get("body", {})

    logger.info("Erasing fields email, address.street, and company_address")

    erased: dict = data_masker.erase(data, fields=["email", "address.street", "company_address"])  # values become '*****'

    # tenant_id being optional metadata that must match in decrypt for further protection
    encrypted: str = data_masker.encrypt(data, tenant_id=event.get("tenant_id", ""))

    decrypted: dict = data_masker.decrypt(data, tenant_id=event.get("tenant_id", ""))

    return erased

⭐⭐ Huge thanks to @seshubaws for the extensive work on this feature!

Header parameter validation in OpenAPI schema

Docs

Our enhanced OpenAPI utility now enables you to seamlessly incorporate headers into your API specifications.

from typing import List

from aws_lambda_powertools.event_handler import APIGatewayRestResolver
from aws_lambda_powertools.event_handler.openapi.params import Header
from aws_lambda_powertools.shared.types import Annotated  
from aws_lambda_powertools.utilities.typing import LambdaContext

app = APIGatewayRestResolver(enable_validation=True)

@app.get("/hello")
def get_hello(header2: Annotated[List[str], Header()], header1: Annotated[str, Header()]):
    print(header2)

def lambda_handler(event: dict, context: LambdaContext) -> dict:
    return app.resolve(event, context)

Changes

📜 Documentation updates

  • feat(event_handler): support Header parameter validation in OpenAPI schema (#3687) by @leandrodamascena
  • docs(data-masking): add docs for data masking utility (#3186) by @seshubaws
  • docs(proccess): add versioning and maintenance policy (#3682) by @leandrodamascena
  • chore(deps): bump squidfunk/mkdocs-material from 9aad7af to a4a2029 in /docs (#3679) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 58eef6c to 9aad7af in /docs (#3670) by @dependabot
  • feat(event_handler): add support for multiValueQueryStringParameters in OpenAPI schema (#3667) by @leandrodamascena
  • docs(metrics): fix empty metric warning filter (#3660) by @maauk

🔧 Maintenance

  • chore(deps-dev): bump aws-cdk from 2.124.0 to 2.125.0 (#3693) by @dependabot
  • docs(data-masking): add docs for data masking utility (#3186) by @seshubaws
  • chore(deps-dev): bump ruff from 0.1.14 to 0.1.15 (#3685) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.39.2 to 1.40.0 (#3684) by @dependabot
  • chore(deps): bump codecov/codecov-action from 3.1.5 to 3.1.6 (#3683) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.123.0 to 2.124.0 (#3678) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 9aad7af to a4a2029 in /docs (#3679) by @dependabot
  • chore(deps): bump codecov/codecov-action from 3.1.4 to 3.1.5 (#3674) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.122.0 to 2.123.0 (#3673) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 58eef6c to 9aad7af in /docs (#3670) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#3665) by @dependabot
  • chore(deps-dev): bump ruff from 0.1.13 to 0.1.14 (#3656) by @dependabot
  • chore(deps): bump pydantic from 1.10.13 to 1.10.14 (#3655) by @dependabot

This release was made possible by the following contributors:

@dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @leandrodamascena, @maauk and @seshubaws

v2.32.0

22 Jan 09:42
Compare
Choose a tag to compare

Summary

We're excited to introduce two significant new features in our Idempotency utility:

  • Support for Redis as an Idempotency persistent storage layer
  • DynamoDB storage layer is now faster and cheaper by leveraging conditional writes

We also made enhancements to our OpenAPI and Event Sources utilities, and fixed some bugs!

⭐ Huge thanks to our new contributors: @sbailliez, @Thomas-McKanna, and @dastra!

Redis as an Idempotency persistent storage layer

Docs

You can now seamlessly switch between DynamoDB and Redis as a persistence storage layer. This allows you to leverage the Idempotency utility in previously unavailable scenarios, such as handling responses over 400kb.

We remain committed to making efforts to introduce new backends, and we would love to hear from you on which backend we should prioritize next!

redis_idempotency2

⭐ ⭐ Huge thanks to @roger-zhangg for your help!

Optimized DynamoDB storage layer with conditional writes

AWS has recently introduced support for ReturnValuesOnConditionCheckFailure, a feature designed to streamline conditional write operations and reducing costs in Amazon DynamoDB. With this enhancement, Powertools for AWS Lambda now optimistically attempts to write items to DynamoDB. If the item already exists, it seamlessly returns it from DynamoDB without requiring an additional operation.

S3 Batch Operations Event Source

Docs

S3 Batch Operations are now supported on the Event Source utility. When using S3 Batch Operations, a Lambda function can be used to execute various operations. For each task, you can choose to either:

A) Return the task as a success (default)
B) Return the task as temporarily failed (e.g., due to a timeout when connecting to other services) and enable automatic retries.
C) Return the task as permanently failed, resulting in job failure.

This example illustrates how you can return different status based on your specific execution logic.

s3_batch2

OpenAPI response models

Docs

You can now define additional response models within the OpenAPI schema utility, allowing you to leverage existing Pydantic data models and classes.

response

Last but not least, you can now effortlessly download the OpenAPI schema file directly from the SwaggerUI.

Changes

🌟New features and non-breaking changes

📜 Documentation updates

  • feat(idempotency): leverage new DynamoDB Failed conditional writes behavior with ReturnValuesOnConditionCheckFailure (#3446) by @dastra
  • feat(event_source): Add support for S3 batch operations (#3572) by @sbailliez
  • feat(event_handler): add support for additional response models in OpenAPI schema (#3591) by @rubenfonseca
  • chore(deps): bump squidfunk/mkdocs-material from 2f29d71 to 58eef6c in /docs (#3633) by @dependabot
  • docs(homepage): add banner about Python 3.7 deprecation (#3618) by @leandrodamascena
  • chore(deps): bump jinja2 from 3.1.2 to 3.1.3 in /docs (#3620) by @dependabot
  • feat(idempotency): adding redis as idempotency backend (#2567) by @roger-zhangg
  • chore(deps): bump gitpython from 3.1.37 to 3.1.41 in /docs (#3610) by @dependabot
  • refactor(event-handler): Inject CSS and JS files into SwaggerUI route when no custom CDN is used. (#3562) by @leandrodamascena
  • feat(event_handler): add support to download OpenAPI spec file (#3571) by @Thomas-McKanna
  • docs(i-made-this): added new article on how to create a serverless API with CDK and Powertools (#3605) by @leandrodamascena

🔧 Maintenance

  • chore(deps-dev): bump ruff from 0.1.13 to 0.1.14 (#3656) by @dependabot
  • chore(deps): bump pydantic from 1.10.13 to 1.10.14 (#3655) by @dependabot
  • feat(idempotency): leverage new DynamoDB Failed conditional writes behavior with ReturnValuesOnConditionCheckFailure (#3446) by @dastra
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#3649) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.121.1 to 2.122.0 (#3648) by @dependabot
  • chore(deps): bump the layer-balancer group in /layer/scripts/layer-balancer with 1 update (#3639) by @dependabot
  • chore(deps): bump squidfunk/mkdocs-material from 2f29d71 to 58eef6c in /docs (#3633) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.120.0 to 2.121.1 (#3634) by @dependabot
  • chore(ci): update boto3 library version to 1.26.164+ (#3632) by @leandrodamascena
  • chore(deps-dev): bump ruff from 0.1.11 to 0.1.13 (#3625) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.118.0 to 2.120.0 (#3627) by @dependabot
  • chore(deps): bump jinja2 from 3.1.2 to 3.1.3 in /docs (#3620) by @dependabot
  • chore(deps-dev): bump jinja2 from 3.1.2 to 3.1.3 (#3619) by @dependabot
  • chore(deps-dev): bump sentry-sdk from 1.39.1 to 1.39.2 (#3614) by @dependabot
  • chore(deps): bump redis from 4.6.0 to 5.0.1 (#3613) by @dependabot
  • feat(idempotency): adding redis as idempotency backend (#2567) by @roger-zhangg
  • chore(deps-dev): bump gitpython from 3.1.40 to 3.1.41 (#3611) by @dependabot
  • chore(deps): bump gitpython from 3.1.37 to 3.1.41 in /docs (#3610) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.83.7 to 0.83.8 (#3603) by @dependabot

This release was made possible by the following contributors:

@Thomas-McKanna, @dastra, @dependabot, @dependabot[bot], @github-actions, @github-actions[bot], @leandrodamascena, @roger-zhangg, @rubenfonseca and @sbailliez