aws-lambda-handler-cookbook GitHub Details, Stars and Alternatives | OpenRepoFinder
ran-isenberg / repository
aws-lambda-handler-cookbook
This repository provides a working, deployable, open source-based, serverless service blueprint with an AWS Lambda function and AWS CDK Python code with all the best practices and a complete CI/CD pipeline.
A transparent discovery signal based on current public GitHub metadata.
Recent activity35% weight
100
Community adoption25% weight
54
Maintenance state20% weight
100
License clarity10% weight
100
Project information10% weight
100
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
README preview
AWS Lambda Handler Cookbook (Python)
This project provides a working, open source based, AWS Lambda handler skeleton Python code includingx DEPLOYMENT code with CDK and a pipeline.
This project can serve as a blueprint for new Serverless services - CDK deployment code, pipeline and handler are covered.
This repository provides a working, deployable, open source-based, serverless MCP server blueprint with an AWS Lambda function and AWS CDK Python code with all the best practices and a complete CI/CD pipeline.
Welcome to the repository for an ETL pipeline that extracts data from the Spotify API, transforms it, and loads it into AWS. This pipeline provides a comprehensive end-to-end solution for retrieving and analyzing music data from Spotify.
You can also run 'make pr' will run all checks, synth, file formatters , unit tests, deploy to AWS and run integration and E2E tests.
The Problem
Starting a Serverless service can be overwhelming. You need to figure out many questions and challenges that have nothing to do with your business domain:
How to deploy to the cloud? What IAC framework do you choose?
How to write a SaaS-oriented CI/CD pipeline? What does it need to contain?
How do you handle observability, logging, tracing, metrics?
How do you write a Lambda function?
How do you handle testing?
What makes an AWS Lambda handler resilient, traceable, and easy to maintain? How do you write such a code?
The Solution
This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service blueprint that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one blueprint project.
Serverless Service - The Order service
This project provides a working orders service where customers can create, get, and delete orders of items.
The project deploys an API GW with AWS Lambda integrations and stores data in a DynamoDB table:
POST /api/orders/ - Create a new order
GET /api/orders/{order_id} - Get an order by ID
DELETE /api/orders/{order_id} - Delete an order by ID
GET /api/orders/?limit={n}&next_token={cursor} - List orders with pagination, served by an AWS Lambda Managed Instances pool
flowchart LR
subgraph AWS["AWS Cloud"]
subgraph APIGW["API Gateway"]
REST["REST API<br/>POST /api/orders<br/>GET /api/orders/{id}<br/>GET /api/orders (list)<br/>DELETE /api/orders/{id}"]
end
subgraph Security["Security (Production)"]
WAF["WAF WebACL<br/>AWS Managed Rules"]
end
subgraph Compute["Compute"]
CREATE["Create Order<br/>Lambda Function"]
GET["Get Order<br/>Lambda Function"]
DELETE["Delete Order<br/>Lambda Function"]
LAYER["Lambda Layer<br/>Common Dependencies"]
end
subgraph LMI["Lambda Managed Instances (VPC)"]
LIST_ALIAS["ListOrders Alias: live"]
LIST["List Orders<br/>Lambda Function"]
CP["Capacity Provider<br/>EC2 pool, 2 AZs"]
end
subgraph Config["Configuration"]
APPCONFIG["AppConfig<br/>Feature Flags"]
end
subgraph Storage["Storage"]
DDB[("DynamoDB<br/>Orders Table")]
IDEMPOTENCY[("DynamoDB<br/>Idempotency Table")]
end
end
CLIENT((Client)) --> WAF
WAF --> REST
REST --> CREATE
REST --> GET
REST --> DELETE
REST --> LIST_ALIAS
LIST_ALIAS --> LIST
LIST -.runs on.-> CP
CREATE --> LAYER
GET --> LAYER
DELETE --> LAYER
CREATE --> APPCONFIG
CREATE --> DDB
CREATE --> IDEMPOTENCY
GET --> DDB
DELETE --> DDB
LIST --> DDB
style CLIENT fill:#f9f,stroke:#333
style WAF fill:#ff6b6b,stroke:#333
style REST fill:#4ecdc4,stroke:#333
style CREATE fill:#ffe66d,stroke:#333
style GET fill:#ffe66d,stroke:#333
style DELETE fill:#ffe66d,stroke:#333
style LAYER fill:#ffe66d,stroke:#333
style LIST fill:#ffa500,stroke:#333
style LIST_ALIAS fill:#4ecdc4,stroke:#333
style CP fill:#ff6b6b,stroke:#333
style APPCONFIG fill:#95e1d3,stroke:#333
style DDB fill:#4a90d9,stroke:#333
style IDEMPOTENCY fill:#4a90d9,stroke:#333
LIST orders via AWS Lambda Managed Instances
The GET /api/orders/ endpoint is deliberately powered by
AWS Lambda Managed Instances
(LMI) rather than standard Lambda. LMI maintains a warm pool of execution
environments on an EC2-backed capacity provider, so paginated list traffic
avoids cold starts, runs inside a private VPC with DynamoDB and observability
VPC endpoints, and can cap concurrency per environment (useful for bounding
DynamoDB Scan pressure). The CRUD endpoints stay on standard Lambda — LMI is
picked per-function, only where its extra surface area pays off.
See the
Lambda Managed Instances deep-dive
for tuning knobs (memory-to-vCPU ratio, min/max environments, per-env
concurrency), the matching CDK construct, and the gotchas around version
publishing and memory/CPU constraints.
AWS Lambda handler 3 layer architecture: handler layer, logic layer and data access layer
Features flags and configuration based on AWS AppConfig
Idempotent API
REST API protected by WAF with four AWS managed rules in production deployment
CloudWatch dashboards - High level and low level including CloudWatch alarms
Unit, infrastructure, security, integration and end to end tests.
Automatically generated OpenAPI endpoint: /swagger with Pydantic schemas for both requests and responses
CI swagger protection - fails the PR if your swagger JSON file (stored at docs/swagger/openapi.json) is out of date
Automated protection against API breaking changes
AWS Lambda Managed Instances pool powers the paginated LIST endpoint (VPC, capacity provider, warm environments)
CDK Deployment
The CDK code creates an API GW with paths /api/orders (POST) and /api/orders/{order_id} (GET, DELETE), each backed by a dedicated Lambda function.
The AWS Lambda handler uses a Lambda layer optimization which takes all the packages under the [packages] section in the Pipfile and downloads them in via a Docker instance.
This allows you to package any custom dependencies you might have, just add them to the Pipfile under the [packages] section.
Serverless Best Practices
The AWS Lambda handler will implement multiple best practice utilities.
Each utility is implemented when a new blog post is published about that utility.
The utilities cover multiple aspect of a production-ready service, including:
This project provides a comprehensive guide and Python script for setting up an AWS Lambda function using Boto3. The repository includes all necessary files to help developers automate the deployment of AWS Lambda functions using Python.
This repository contains an Ecommerce application built using AWS Cloud Development Kit (CDK) and Python. The application leverages various AWS services to provide functionalities like managing product inventory, processing orders, and handling user interactions.
This repository contains code for deploying a solution to schedule shutdown of Amazon EC2 instances. The part that sets this solution apart from others is that it provides the ability to postpone the shutdown. This helps considerably when the Amazon EC2 instance is about to be automatically be shutdown, however it is still in use. The backend is deployed using API Gateway and AWS Lambda. The solution uses AWS Serverless Application Model (SAM) to deploy resources in to an AWS Account. The AWS Lambda function is written in Python 3.7.
This repository provides a working, deployable, open source-based, serverless service template with an AWS Lambda function and AWS CDK Python code with all the best practices and a complete CI/CD pipeline.