GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com β€” GitHub - aws-powertools/powertools-lambda-python: A developer toolkit to implement Serverless best practices and increase developer velocity.

BranchesTags
Open more actions menu

Latest commit

 

History

6,137 Commits
6,137 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents
.agents
 
 
.chglog
.chglog
 
 
.claude-plugin
.claude-plugin
 
 
.clusterfuzzlite
.clusterfuzzlite
 
 
.github
.github
 
 
aws_lambda_powertools
aws_lambda_powertools
 
 
benchmark
benchmark
 
 
docs
docs
 
 
examples
examples
 
 
includes
includes
 
 
layer_v3
layer_v3
 
 
provenance
provenance
 
 
scripts
scripts
 
 
tests
tests
 
 
.cfnlintrc.yaml
.cfnlintrc.yaml
 
 
.flake8
.flake8
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitleaks.toml
.gitleaks.toml
 
 
.gitleaksignore
.gitleaksignore
 
 
.ignore
.ignore
 
 
.markdownlint.yaml
.markdownlint.yaml
 
 
.markdownlintignore
.markdownlintignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.pylintrc
.pylintrc
 
 
404.html
404.html
 
 
AGENTS.md
AGENTS.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
MAINTAINERS.md
MAINTAINERS.md
 
 
MANIFEST.in
MANIFEST.in
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 
THIRD-PARTY-LICENSES
THIRD-PARTY-LICENSES
 
 
bandit.baseline
bandit.baseline
 
 
codecov.yml
codecov.yml
 
 
mkdocs.yml
mkdocs.yml
 
 
mypy.ini
mypy.ini
 
 
noxfile.py
noxfile.py
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
parallel_run_e2e.py
parallel_run_e2e.py
 
 
pyproject.toml
pyproject.toml
 
 
ruff.toml
ruff.toml
 
 
tox.ini
tox.ini
 
 
uv.lock
uv.lock
 
 

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.

Building with a coding agent? Install the Powertools skill so Claude Code, Codex, Cursor or Gemini CLI work from the current documentation and examples: npx skills add aws-powertools/powertools-lambda-python.

Features

Core

  • 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

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

  • 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

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:

  • 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

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

  • Structured logging initial implementation from aws-lambda-logging
  • Powertools for AWS Lambda (Python) idea DAZN Powertools

Connect

  • Powertools for AWS Lambda on Discord: #python - Invite link
  • Email: [email protected]

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.

docs.powertools.aws.dev/lambda/python/latest/

Topics

awsaws-lambdalambdapythonserverless

Resources

Readme
MIT-0 license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

3.3k stars

Watchers

46 watching

Forks

567 forks
Report repository

Releases

Used by

Contributors

Languages

Generated from amazon-archives/__template_MIT-0
You are visitor 01402503 β€” GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Γ—600. No cookies required.