github aws-powertools/powertools-lambda-python v2.11.0

latest releases: v2.43.1, v2.43.0, v2.42.0...
18 months ago

Summary

This release adds support for S3 Event Notifications via EventBridge in Event Source Data Classes, and a bug fix for Feature Flags to handle falsy context values correctly.

⭐ Huge welcome to new contributors: @ajwad-shaikh and @ivica-k

image

S3 Event Notifications via EventBridge

Docs

A new use case is to process S3 Events with the newer and faster EventBridge integration. Previously, EventBridge integration with S3 would use CloudTrail leading up to a few minutes delays.

With the new integration, there is a slightly new payload that we had to support in order to ease that integration.

Thanks to @ivica-k, you can now use S3EventBridgeNotificationEvent!

from aws_lambda_powertools.utilities.data_classes import S3EventBridgeNotificationEvent, event_source
from aws_lambda_powertools.utilities.typing import LambdaContext


@event_source(data_class=S3EventBridgeNotificationEvent)
def lambda_handler(event: S3EventBridgeNotificationEvent, context: LambdaContext):
    bucket_name = event.detail.bucket.name
    file_key = event.detail.object.key
    new_storage_class = event.detail.destination_storage_class
    ...

Fixing falsy values in Feature Flags

Thanks to @ajwad-shaikh for reporting and fixing this bug (incl. @ran-isenberg), you can now handle flag variants when their context values are falsy, e.g., empty lists, empty strings, False, 0, etc.

Example that wasn't possible before this release

Flag

{
  "sales_offer": {
    "default": false,
    "rules": {
      "unpaid_users": {
        "when_match": true,
        "conditions": [ {"action": "EQUALS", "key": "is_paid", "value": 0} ]
      }
   }
}

Context

{
   "is_paid": 0,
}

Changes

🌟New features and non-breaking changes

  • feat(event_sources): support for S3 Event Notifications through EventBridge (#2024) by @ivica-k

📜 Documentation updates

  • fix(feature_flags): make test conditions deterministic (#2059) by @ajwad-shaikh
  • docs(logger): warn append_keys on not being thread-safe (#2046) by @heitorlessa
  • feat(event_sources): support for S3 Event Notifications through EventBridge (#2024) by @ivica-k

🐛 Bug and hot fixes

🔧 Maintenance

  • chore(deps-dev): bump types-requests from 2.28.11.16 to 2.28.11.17 (#2061) by @dependabot
  • chore(deps-dev): bump filelock from 3.10.4 to 3.10.7 (#2055) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.75.1 to 0.76.1 (#2056) by @dependabot
  • chore(deps-dev): bump types-python-dateutil from 2.8.19.10 to 2.8.19.11 (#2057) by @dependabot
  • chore(deps-dev): bump mypy-boto3-s3 from 1.26.97.post2 to 1.26.99 (#2054) by @dependabot
  • chore(deps-dev): bump mkdocs-material from 9.1.3 to 9.1.4 (#2050) by @dependabot
  • chore(deps-dev): bump filelock from 3.10.2 to 3.10.4 (#2048) by @dependabot
  • chore(deps-dev): bump mypy-boto3-cloudwatch from 1.26.52 to 1.26.99 (#2049) by @dependabot
  • chore(deps-dev): bump filelock from 3.10.1 to 3.10.2 (#2045) by @dependabot
  • chore(deps-dev): bump types-requests from 2.28.11.15 to 2.28.11.16 (#2044) by @dependabot
  • chore(deps-dev): bump mypy-boto3-s3 from 1.26.97 to 1.26.97.post2 (#2043) by @dependabot
  • chore(deps-dev): bump mypy-boto3-dynamodb from 1.26.97 to 1.26.97.post1 (#2042) by @dependabot
  • chore(deps-dev): bump filelock from 3.10.0 to 3.10.1 (#2036) by @dependabot
  • chore(deps-dev): bump aws-cdk from 2.69.0 to 2.70.0 (#2039) by @dependabot
  • chore(deps-dev): bump mypy-boto3-dynamodb from 1.26.87 to 1.26.97 (#2035) by @dependabot
  • chore(deps-dev): bump mypy-boto3-s3 from 1.26.62 to 1.26.97 (#2037) by @dependabot
  • chore(deps-dev): bump aws-cdk-lib from 2.69.0 to 2.70.0 (#2038) by @dependabot
  • chore(deps): bump pydantic from 1.10.6 to 1.10.7 (#2034) by @dependabot
  • chore(deps-dev): bump mypy-boto3-ssm from 1.26.77 to 1.26.97 (#2033) by @dependabot
  • chore(deps-dev): bump flake8-comprehensions from 3.11.0 to 3.11.1 (#2029) by @dependabot
  • chore(deps-dev): bump cfn-lint from 0.75.0 to 0.75.1 (#2027) by @dependabot
  • chore(deps-dev): bump pytest-asyncio from 0.20.3 to 0.21.0 (#2026) by @dependabot
  • feat(event_sources): support for S3 Event Notifications through EventBridge (#2024) by @ivica-k

This release was made possible by the following contributors:

@ajwad-shaikh, @dependabot, @dependabot[bot], @heitorlessa, @ivica-k, @ran-isenberg and Release bot

Don't miss a new powertools-lambda-python release

NewReleases is sending notifications on new releases.