Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jordaneremieff/mangum-template
A template for developing ASGI-compatible apps deployed to AWS Lambda.
https://github.com/jordaneremieff/mangum-template
asgi aws-lambda fastapi mangum python quart starlette
Last synced: 3 days ago
JSON representation
A template for developing ASGI-compatible apps deployed to AWS Lambda.
- Host: GitHub
- URL: https://github.com/jordaneremieff/mangum-template
- Owner: jordaneremieff
- License: mit
- Created: 2022-04-24T10:41:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-25T13:15:28.000Z (over 2 years ago)
- Last Synced: 2024-11-14T16:07:04.554Z (about 1 month ago)
- Topics: asgi, aws-lambda, fastapi, mangum, python, quart, starlette
- Language: Python
- Homepage: https://github.com/jordaneremieff/mangum-template
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mangum-template
This is a template for developing [ASGI](https://asgi.readthedocs.io/en/latest/)-compatible Python web apps deployed to [AWS Lambda](https://aws.amazon.com/lambda/). It uses [Mangum](https://github.com/jordaneremieff/mangum) to adapt AWS Lambda events for an example [FastAPI](https://github.com/tiangolo/fastapi) app.
# Usage
- Create an AWS Lambda function with the handler set to `lambda_handler.handler`.
- Add your `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` secrets to the GitHub project settings.
- Change the values of `AWS_REGION` and `LAMBDA_FUNCTION` under the `env` section in the `.github/workflows/deploy.yml` file.- Push a commit to `main` to run the deployment workflow.
# Testing
- Create a local Python virtual environment.
`python -m venv .venv`
- Activate the virtual environment.`. .venv/bin/activate`
- Install the dev requirements.`python -m pip install requirements/dev.txt`
- Run the tests using `pytest`:
`python -m pytest`
The test settings can be adjusted in the `pyproject.toml` file.
# Notes
The structure of the project and choice of FastAPI as the application framework in this template are just one example and could be substituted with alternative layouts and ASGI frameworks.