AWS Lambda support for ASGI applications
Project Links
Meta
Author: Jordan Eremieff, Marcelo Trylesinski
Requires Python: >=3.9
Classifiers
License
- OSI Approved :: MIT License
Operating System
- OS Independent
Programming Language
- Python
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
- Python :: 3.14
Topic
- Internet :: WWW/HTTP
Mangum
Mangum is an adapter for running ASGI applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.
Documentation: https://mangum.fastapiexpert.com/
Features
-
Event handlers for API Gateway HTTP and REST APIs, Application Load Balancer, Function URLs, and CloudFront Lambda@Edge.
-
Compatibility with ASGI application frameworks, such as Starlette, FastAPI, Quart and Django.
-
Support for binary media types and payload compression in API Gateway using GZip or Brotli.
-
Works with existing deployment and configuration tools, including Serverless Framework and AWS SAM.
-
Startup and shutdown lifespan events.
Installation
pip install mangum
Example
from mangum import Mangum
async def app(scope, receive, send):
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain; charset=utf-8"]],
}
)
await send({"type": "http.response.body", "body": b"Hello, world!"})
handler = Mangum(app, lifespan="off")
Or using a framework:
from fastapi import FastAPI
from mangum import Mangum
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
handler = Mangum(app, lifespan="off")
0.21.0
Feb 01, 2026
0.20.0
Dec 27, 2025
0.19.0
Sep 26, 2024
0.18.0
Sep 20, 2024
0.18.0a1
Sep 20, 2024
0.17.0
Nov 27, 2022
0.16.0
Oct 26, 2022
0.15.1
Aug 07, 2022
0.15.0
Apr 24, 2022
0.14.1
Mar 07, 2022
0.14.0
Mar 03, 2022
0.13.0
Feb 25, 2022
0.12.4
Feb 07, 2022
0.12.3
Oct 06, 2021
0.12.2
Aug 11, 2021
0.12.1
Jul 23, 2021
0.12.0
Jul 16, 2021
0.11.0
Mar 19, 2021
0.10.0
Oct 03, 2020
0.10.0b1
Jun 28, 2020
0.9.2
May 19, 2020
0.9.1
May 16, 2020
0.9.0
May 09, 2020
0.9.0b1
May 03, 2020
0.8.0
Apr 18, 2020
0.7.5
Apr 12, 2020
0.7.4
Feb 14, 2020
0.7.3
Feb 08, 2020
0.7.2
Feb 08, 2020
0.7.1
Feb 08, 2020
0.7.0
Jan 07, 2020
0.6.19
Dec 02, 2019
0.6.18
Nov 22, 2019
0.6.17
Oct 20, 2019
0.6.16
Aug 21, 2019
0.6.15
Aug 07, 2019
0.6.14
Aug 01, 2019
0.6.13
Jul 31, 2019
0.6.12
Jul 31, 2019
0.6.11
Jul 23, 2019
0.6.10
Jul 21, 2019
0.6.9
Jul 20, 2019
0.6.8
Apr 22, 2019
0.6.7
Feb 03, 2019
0.6.6
Feb 02, 2019
0.6.5
Jan 30, 2019
0.6.4
Jan 29, 2019
0.6.3
Jan 28, 2019
0.6.2
Jan 28, 2019
0.6.1
Jan 28, 2019
0.6.0
Jan 28, 2019
0.5.9
Jan 28, 2019
0.5.8
Jan 28, 2019
0.5.7
Jan 28, 2019
0.5.6
Jan 28, 2019
0.5.5
Jan 28, 2019
0.5.4
Jan 28, 2019
0.5.3
Jan 27, 2019
0.5.2
Jan 27, 2019
0.5.1
Jan 27, 2019
0.5.0
Jan 26, 2019
0.4.7
Jan 26, 2019
0.4.5
Jan 26, 2019
0.4.0
Jan 26, 2019
0.3.0
Jan 20, 2019
0.2.6
Jan 20, 2019
0.2.2
Jan 20, 2019
0.2.1
Jan 20, 2019
0.2.0
Jan 20, 2019
0.1.0
Jan 19, 2019
0.0.6
Jan 19, 2019
0.0.4
Jan 17, 2019
0.0.3
Jan 16, 2019
0.0.2
Jan 16, 2019
Wheel compatibility matrix
Files in release
Extras:
None
Dependencies:
typing-extensions