Skip to content

About

A developer toolkit to implement Serverless best practices and increase developer velocity.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3.3k stars

Watchers

46 watching

Forks

Latest commit

Β 

History

6,106 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Powertools for AWS Lambda (Python)

Build codecov.io PythonSupport PyPI version PyPi monthly downloads OpenSSF Scorecard Discord

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

hero-image

Installation

pip install aws-lambda-powertools
# or
uv add aws-lambda-powertools

Or 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.

Features

Core

Utilities

  • 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 features

  • 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 examples

How to support Powertools for AWS Lambda (Python)?

Becoming a reference customer

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:

Sharing your work

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 Lambda layer

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.

Contributing

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.

Credits

Connect

Security disclosures

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.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

A developer toolkit to implement Serverless best practices and increase developer velocity.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3.3k stars

Watchers

46 watching

Forks

Releases

Used by

Contributors

Languages