4 ms·
Is it possible to host an app like Django inside container on lambda? This could help the Django/postgres apps to scale horizontally easily.
by scottydelta 4y ago
Is it possible to host an app like Django inside container on lambda? This could help the Django/postgres apps to scale horizontally easily.
- alksjdalkj 4y agoPretty sure Zappa does this: https://github.com/zappa/Zappa https://github.com/zappa/Zappa
- adamgordonbell 4y agoYes, but is the startup time of Django an issue? Besides that you'd have to return your data in the shape that the API gateway expects from lambdas. Returning a 500 would look something like this: { "statusCode" : 500, "headers" : { "content-type": "text/plain; charset=utf-8" }, "body" : "Some error fetching the content" }
- throwaway2016a 4y agoNot sure about Django but on the Node.js side there are Express.js compatible libraries that let you write your app like you would Express but it's exposed via Lambda and API gateway. Good chance Python has something similar. Biggest difference is you're not dealing with HTTP (directly) but it can be abstracted to -- from a framework perspective -- act like HTTP.
- dsanchez97 4y agoI am actually working on a python library that works like you described at https://cdevframework.io https://cdevframework.io! The goal is the provided a developer experience like Django that then deploys onto Serverless Infrastructure. It is a long way from that goal, but one day it will get there!
- klohto 4y agoNot Django, but AWS has a product focusing on this - Chalice https://github.com/aws/chalice https://github.com/aws/chalice
- gatvol 4y agoYes it absolutely is possible. I have been considering doing this in combination with PG Aurora v2
- ralusek 4y agoIs Aurora v2 still inaccessible from outside the VPC? The fact that I have to set up some kind of proxy EC2 in order to view the database from my machine is a non-starter for me.
- zokier 4y agoYou can run any wsgi application in lambda with libraries like https://pypi.org/project/apig-wsgi/ https://pypi.org/project/apig-wsgi/
- manfre 4y agoYes, it's possible to wrap any asgi app to run in a lambda. Check out Mangum https://github.com/jordaneremieff/mangum https://github.com/jordaneremieff/mangum