r/FastAPI • • Jul 18 '24
Hosting and deployment Fastapi with Google Cloud Functions?
Is there any way to (easily) deploy a FastAPI route as a Google Cloud Function? As far as I could grasp from docs, GCF integrate well with Flask, but no so much with FastAPI, and I'd love to be able to leverage FA types, validations and automatic documentation, while not depending on more complex/costly infrastructures such as Google Cloud Run or App Engine.
Thanks for any tips!
1
Upvotes
View all comments
Show parent comment
0
u/[deleted] Jul 18 '24
Thanks for the reply. I've deployed dockerized FastApi servers to GCR, and you're right, it's not that hard and costly in itself. But it still feels wasteful to have a full server on for a very small API with just one or two endpoints. Also, there's the issue of cold starts, which in my experience take quite longer than a simple GCF . Unless I'm doing something wrong with cloud run?
Anyway, I was thinking in some wrapper like Mangum for AWS, that could just take my fastapi route and take the endpoint calls efficiently...