Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI App on AWS Lambda

This repository is a demo for hosting a FastAPI application on AWS Lambda using Mangum.

Project Structure

. ├── .gitignore 
  ├── main.py 
  ├── README.md 
  └── requirements.txt

Requirements

  • Python 3.9+
  • AWS Account

Installation

  1. Clone the repository:

    git clone https://github.com/rishabkumar7/fastapi-aws-lambda.git
    cd fastapi-aws-lambda
  2. Create a virtual environment and activate it:

    python -m venv .venv
    .venv\Scripts\Activate  # On Linux/Mac use `source .venv/bin/activate`
  3. Install the dependencies:

    pip install -r requirements.txt

Running Locally

You can run the FastAPI application locally using Uvicorn, but will need to install uvicorn:

pip install uvicorn
uvicorn main:app --reload

Deploying to AWS Lambda

Zip your FastAPI application and upload the zip to an AWS Lambda Function.

Zip on Windows:

Compress-Archive .\.venv\Lib\site-packages\* aws_lambda.zip
Compress-Archive .\main.py -Update aws_lambda.zip

Demo

Deploy FastAPI to AWS Lambda

About

Deploy FastAPI to AWS Lambda Function

Resources

Stars

4 stars

Watchers

1 watching

Forks

Contributors

Languages