/aws-lambda-powertools-python

A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier

Primary LanguagePythonMIT No AttributionMIT-0

AWS Lambda Powertools for Python

Build codecov.io PythonSupport PyPI version PyPi monthly downloads Join our Discord

A suite of Python utilities for AWS Lambda functions to ease adopting best practices such as tracing, structured logging, custom metrics, and more. (AWS Lambda Powertools Java and Typescript is also available).

📜Documentation | 🐍PyPi | Roadmap | Detailed blog post

An AWS Developer Acceleration (DevAx) initiative by Specialist Solution Architects | aws-devax-open-source@amazon.com

Features

  • Tracing - Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
  • Logging - Structured logging made easier, and decorator to enrich structured logging with key Lambda context details
  • Metrics - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
  • Event handler: AppSync - AWS AppSync event handler for Lambda Direct Resolver and Amplify GraphQL Transformer function
  • Event handler: API Gateway and ALB - Amazon API Gateway REST/HTTP API and ALB event handler for Lambda functions invoked using Proxy integration
  • Bring your own middleware - Decorator factory to create your own middleware to run logic before, and after each Lambda invocation
  • Parameters utility - Retrieve and cache parameter values from Parameter Store, Secrets Manager, or DynamoDB
  • Batch processing - Handle partial failures for AWS SQS batch processing
  • Typing - Static typing classes to speedup development in your IDE
  • Validation - JSON Schema validator for inbound events and responses
  • Event source data classes - Data classes describing the schema of common Lambda event triggers
  • Parser - Data parsing and deep validation using Pydantic
  • Idempotency - Convert your Lambda functions into idempotent operations which are safe to retry
  • Feature Flags - A simple rule engine to evaluate when one or multiple features should be enabled depending on the input

Installation

With pip installed, run: pip install aws-lambda-powertools

Tutorial and Examples

Credits

Connect

Security disclosures

If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please follow the instructions here or email AWS security directly.

License

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