Fastapi: [QUESTION] Will this framework work with Google Cloud Functions / AWS Lambda / Azure Functions?

Created on 24 Dec 2019  路  4Comments  路  Source: tiangolo/fastapi

First check

  • [x] I used the GitHub search to find a similar issue and didn't find it.
  • [x] I searched the FastAPI documentation, with the integrated search.
  • [x] I already searched in Google "How to X in FastAPI" and didn't find any information.

Description

How can I use this framework with some serverless solutions out there (Google Cloud Functions / AWS Lambda / Azure Functions, ...)?

Thank you.

Additional context

question

Most helpful comment

@piavgh
FastAPI supports ASGI protocol to connect a server.

The libraries are ASGI adapter which helps to run FastAPI on the services.

For AWS Lambda:
https://github.com/erm/mangum
For Azure Functions:
https://github.com/erm/bonnette
For Google Cloud Functions:
https://github.com/erm/grevillea

Example for AWS Lambda with mangum:
https://github.com/erm/mangum-examples

All 4 comments

@piavgh
FastAPI supports ASGI protocol to connect a server.

The libraries are ASGI adapter which helps to run FastAPI on the services.

For AWS Lambda:
https://github.com/erm/mangum
For Azure Functions:
https://github.com/erm/bonnette
For Google Cloud Functions:
https://github.com/erm/grevillea

Example for AWS Lambda with mangum:
https://github.com/erm/mangum-examples

@koxudaxi : thank you. I will check those repos

Zeit now supports an ASGI Interface for Python.

It was fairly easy to set this up & deploy. Doesn't require making modifications to the application structure. Not sure if this would work well for most deployments (I think WebSockets would be out of question) but may be a good solution for simple apps!

I created a demo repo showcasing what I've found. Hope it can help anyone else that looks into FastAPI + Serverless: https://github.com/paul121/fastapi-zeit-now

Thanks for the help here @koxudaxi and @paul121 ! :cake: :bowing_man:

Thanks @piavgh for reporting back and closing the issue :+1:

Was this page helpful?
0 / 5 - 0 ratings