{"library":"aws-lambda-powertools","title":"AWS Lambda Powertools (Python)","description":"Powertools for AWS Lambda (Python) is a developer toolkit designed to implement Serverless best practices and increase developer velocity. It offers utilities for tracing, logging, metrics, event handling, data parsing, and idempotency. The library is currently at version 3.27.0 and maintains an active development cycle with frequent releases, often shipping new features and bug fixes on a monthly basis.","status":"active","version":"3.27.0","language":"en","source_language":"en","source_url":"https://github.com/aws-powertools/powertools-lambda-python","tags":["aws","lambda","serverless","observability","utilities","event-driven","python"],"install":[{"cmd":"pip install aws-lambda-powertools","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Requires Python 3.10 or newer.","package":"python","optional":false}],"imports":[{"symbol":"Logger","correct":"from aws_lambda_powertools import Logger"},{"symbol":"Tracer","correct":"from aws_lambda_powertools import Tracer"},{"symbol":"Metrics","correct":"from aws_lambda_powertools import Metrics"},{"note":"The 'App' class for Event Handler is a sub-utility and must be imported from `aws_lambda_powertools.event_handler`.","wrong":"from aws_lambda_powertools import App","symbol":"App","correct":"from aws_lambda_powertools.event_handler import App"},{"symbol":"Parser","correct":"from aws_lambda_powertools.utilities.parser import Parser"},{"symbol":"Idempotency","correct":"from aws_lambda_powertools.utilities.idempotency import IdempotencyConfig, idempotent"}],"quickstart":{"code":"import json\nfrom aws_lambda_powertools import Logger\n\nlogger = Logger(service=\"payment_processing\")\n\n@logger.inject_lambda_context(log_event=True)\ndef handler(event, context):\n    # Accessing event data via a common pattern\n    if event and 'body' in event:\n        try:\n            body = json.loads(event['body'])\n            transaction_id = body.get('transaction_id', 'N/A')\n            logger.info(f\"Processing transaction: {transaction_id}\")\n        except json.JSONDecodeError:\n            logger.error(\"Invalid JSON in event body\")\n            return {\"statusCode\": 400, \"body\": json.dumps({\"message\": \"Invalid JSON\"})}\n    else:\n        logger.info(\"No event body provided.\")\n\n    logger.info(\"Hello from Lambda, using Powertools Logger!\")\n    return {\n        \"statusCode\": 200,\n        \"body\": json.dumps(\"Successfully processed request.\"),\n    }","lang":"python","description":"This quickstart demonstrates the `Logger` utility, automatically enriching logs with Lambda context and logging the incoming event. It's designed to run in an AWS Lambda environment."},"warnings":[{"fix":"Upgrade your AWS Lambda function's runtime to Python 3.10 or newer. Python 3.14 is also supported from v3.23.0 onwards.","message":"AWS Lambda Powertools v3.24.0 and later have dropped support for Python 3.9. Attempting to use these versions with a Python 3.9 runtime will result in errors.","severity":"breaking","affected_versions":">=3.24.0"},{"fix":"Upgrade to v3.19.0 or a later version to ensure correct behavior of Event Handler's data validation and middleware functionalities.","message":"Versions prior to v3.19.0 of AWS Lambda Powertools had critical bugs affecting Data validation and Middleware within the Event Handler utility, potentially leading to incorrect processing or validation errors.","severity":"gotcha","affected_versions":"<3.19.0"},{"fix":"If you are using Event Handler with nested metadata annotations, upgrade to v3.22.1 or a later version to resolve this regression.","message":"A regression was introduced in v3.22.0 affecting the Event Handler utility when using nested metadata annotations (e.g., `annotated_types` or `Interval`).","severity":"gotcha","affected_versions":"3.22.0"},{"fix":"Consult the Pydantic V2 migration guide and update your Pydantic models to adhere to the V2 syntax for seamless integration with Powertools.","message":"AWS Lambda Powertools v3 is compatible with Pydantic V2. Users migrating from Pydantic V1 might need to update their model syntax (e.g., `model_validator` instead of `validator`) when using models with Event Handler or Parser utilities.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-06T00:00:00.000Z","next_check":"2026-07-05T00:00:00.000Z"}