aws-lambda-handler-cookbook  by ran-isenberg

AWS Serverless blueprint for rapid development

Created 5 years ago
676 stars

Top 49.3% on SourcePulse

GitHubView on GitHub
Project Summary

This repository offers a production-ready, open-source blueprint for building serverless Python services on AWS. It addresses the complexity of setting up serverless applications by providing a complete solution encompassing AWS Lambda functions, AWS CDK for infrastructure-as-code, and a robust CI/CD pipeline. The project significantly reduces the cognitive load for developers, enabling them to focus on business logic rather than boilerplate infrastructure and deployment concerns.

How It Works

The blueprint leverages AWS CDK to define and deploy serverless infrastructure, including API Gateway endpoints, Lambda functions, and DynamoDB tables. It implements a layered architecture (handler, logic, data access) and integrates AWS Lambda Powertools for enhanced observability, logging, and tracing. A key architectural choice is the use of AWS Lambda Managed Instances (LMI) for the paginated LIST endpoint, providing warm execution environments on a dedicated EC2-backed capacity provider to mitigate cold starts and manage VPC resources, while standard Lambda handles CRUD operations.

Quick Start & Requirements

Initiate a new project using Cookiecutter: cookiecutter gh:ran-isenberg/cookiecutter-serverless-python. After answering prompts, navigate to the new directory, sync dependencies with uv sync, and deploy using make deploy. The make pr command executes comprehensive checks, including linters, formatters, unit, integration, and end-to-end tests, followed by deployment. Prerequisites include cookiecutter and uv installed locally, along with configured AWS credentials. Detailed documentation is available at https://ran-isenberg.github.io/aws-lambda-handler-cookbook.

Highlighted Details

  • Comprehensive CI/CD pipeline via GitHub Actions, incorporating Python linters, complexity checks, style formatters, and automated testing.
  • Automated GitHub releases with semantic versioning based on Conventional Commits and automatic PR labeling.
  • Production API Gateway protected by AWS WAF with four AWS Managed Rules.
  • AWS Lambda Managed Instances (LMI) power the LIST endpoint for improved performance and cold-start mitigation.
  • Dynamically generated OpenAPI specification at /swagger using Pydantic schemas for request/response validation.
  • Integration with AI-Driven Development Life Cycle (AI-DLC) for assisted requirements analysis, architecture design, code generation, and testing.

Maintenance & Community

The project is maintained by Ran Isenberg. Community engagement is facilitated through email (ran.isenberg@ranthebuilder.cloud), a blog (https://ranthebuilder.cloud/), and social media platforms including Bluesky (@ranthebuilder.cloud), X (@RanBuilder), and LinkedIn (https://www.linkedin.com/in/ranbuilder/).

Licensing & Compatibility

This library is licensed under the permissive MIT License, allowing for broad use, modification, and distribution, including within commercial and closed-source applications.

Limitations & Caveats

The blueprint is heavily tailored to the AWS ecosystem, requiring specific AWS services like Lambda, API Gateway, DynamoDB, CDK, AppConfig, and WAF. The utilization of AWS Lambda Managed Instances introduces additional complexity and specific configuration requirements compared to standard Lambda functions. The AI-DLC integration is presented conceptually, with detailed implementation specifics residing within the aidlc-docs/ directory.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
7
Issues (30d)
0
Star History
2 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.