Powertools for AWS Lambda (Python) is a developer toolkit for AWS Lambda: structured logging, tracing, metrics, event handlers for API Gateway, AppSync and Bedrock Agents, idempotency, batch processing, parameters, validation, and more. Each utility is independent, follows the Lambda execution model, and is designed to add as little as possible to your cold start.
Also available in TypeScript, Java, and .NET.
π Documentation | π PyPI | π Workshop | πΊοΈ Roadmap | π Changelog
pip install aws-lambda-powertools
# or
uv add aws-lambda-powertoolsOr use the public Lambda layer, published for every supported Python version on x86_64 and arm64. Some utilities need an extra, for example aws-lambda-powertools[parser] for Pydantic; the installation guide lists them.
- Logger - Structured JSON logging with Lambda context, correlation IDs, sampling and log buffering
- Tracer - Decorators and utilities to trace Lambda function handlers and sync or async functions with AWS X-Ray
- Metrics - Custom metrics created asynchronously via CloudWatch Embedded Metric Format (EMF), with a Datadog provider
- Event Handler: REST and HTTP APIs - Routing, validation and middleware for API Gateway, ALB, Lambda Function URL and VPC Lattice, with OpenAPI schema generation and Swagger UI
- Event Handler: AppSync - Resolvers for AppSync Direct Lambda Resolvers and Amplify GraphQL Transformer functions
- Event Handler: AppSync Events - Handlers for AppSync Events real-time WebSocket APIs with pub/sub
- Event Handler: Bedrock Agents - Build Amazon Bedrock Agents action groups with automatically generated OpenAPI schemas
- Parameters - Retrieve and cache parameter values from Parameter Store, Secrets Manager, AppConfig or DynamoDB
- Idempotency - Make your Lambda functions idempotent and safe to retry, with DynamoDB, Redis or Valkey persistence
- Batch processing - Handle partial failures for SQS, Kinesis Data Streams and DynamoDB Streams batches
- Circuit Breaker - Stop calling a failing downstream and recover with a single probe across execution environments
- Kafka - Deserialize and validate Kafka events with Avro, Protocol Buffers and JSON Schema
- Event source data classes - Typed access to the payloads of common Lambda event sources
- Parser - Data parsing and deep validation with Pydantic, with models and envelopes for common event sources
- Validation - JSON Schema validation for inbound events and responses
- Feature Flags - A rule engine to evaluate when one or more features should be enabled depending on the input
- Data Masking - Erase or encrypt confidential fields in your data with AWS KMS
- Auth (alpha) - JWT access-token verification and an OAuth2 client-credentials client for downstream APIs
- Streaming - Stream S3 objects larger than the available memory, with gzip, CSV and other transforms
- Metadata - Read the Lambda Metadata Endpoint, such as the Availability Zone ID of the execution environment
- Middleware factory - Decorator factory to run your own logic before and after each invocation
- Typing - Static typing for the Lambda context object
- JMESPath Functions - Built-in JMESPath functions to deserialize common encoded JSON payloads
- Lambda Managed Instances - Using Powertools when one execution environment handles concurrent invocations
- Durable Functions - Using Powertools with Lambda Durable Functions
- Build recipes - Packaging, cross-platform builds, cold start optimization and CI/CD integration
- Tutorial and workshop
- Examples for every utility, the same code the documentation shows
- Serverless Airline, a sample application using Powertools end to end
- What the community built: blog posts, workshops, videos and sample apps
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (Python), you can request to have your name and logo added to the README file by raising a Support Powertools for AWS Lambda (Python) (become a reference) issue.
The following companies, among others, use Powertools:
- Alma Media
- Banxware
- Brsk
- BusPatrol
- Capital One
- Caylent
- CHS Inc.
- CPQi (Exadel Financial Services)
- CloudZero
- CyberArk
- EF Education First
- Flyweight
- globaldatanet
- Guild
- IMS
- Instil
- Jit Security
- LocalStack
- Propellor.ai
- Pushpay
- QuasiScience Limited
- Recast
- TopSport
- Transformity
- Trek10
- Vertex Pharmaceuticals
Share what you did with Powertools for AWS Lambda (Python) ππ. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (Python) in this link.
Using the public layer helps us understand who uses Powertools for AWS Lambda (Python) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. You can still add Powertools for AWS Lambda (Python) as a dev dependency (or as part of your virtual env) to not impact the development process.
Issues and pull requests are welcome, including the ones written with AI assistance. If you used an assistant, say so in the issue or PR and tell us how you verified the change: which tests you ran yourself, and which real AWS service or event you validated against when it applies. Read CONTRIBUTING.md for the process, AGENTS.md for the rules the CI enforces, and docs/adr for the premises behind them.
- Structured logging initial implementation from aws-lambda-logging
- Powertools for AWS Lambda (Python) idea DAZN Powertools
- Powertools for AWS Lambda on Discord:
#python- Invite link - Email: aws-powertools-maintainers@amazon.com
If you think you've found a potential security issue, please do not post it in the Issues. Instead, follow SECURITY.md: report it through the AWS vulnerability reporting page or email AWS security directly.
This library is licensed under the MIT-0 License. See the LICENSE file.
