From mischa at mvstg.biz Tue Nov 6 09:23:33 2018 From: mischa at mvstg.biz (mischa at mvstg.biz) Date: Tue, 6 Nov 2018 16:23:33 +0200 Subject: [Flask] AWS Lambda integration module idea Message-ID: <8B56BB65-F2AA-43E7-B696-D83C192CE4D6@mvstg.biz> Hello all, I wanted to get feedback on a proposal for a flask extension to make writing AWS Lambda web applications and services with Flask easier. AWS Lambdas are little zip files of code and dependencies that can be executed without any extra infrastructure and can be provided as HTTP services. I've found that Flask is really great for making even complex lambdas, and can be nearly as easy to maintain and manage as say a Heroku application. Except they run for basically free and you don't have to worry about having hosts to run your application or scaling web servers. I wrote about my setup here https://spiegelmock.com/2018/09/06/serverless-python-web-applications-with-aws-lambda-and-flask/ I wrote a basic Flask service hooking into AWS SSM Parameter Store to provide encrypted secrets from AWS to the application, using aws-wsgi (https://pypi.org/project/aws-lambda-wsgi/ ) to bridge lambda http proxy requests and responses with WSGI, and a small bit of tooling to vendor the application dependencies because they need to be shipped in the zip bundle. Code demonstrating all of this can be found here - https://github.com/revmischa/qanda/ . Local running and testing is handled by AWS SAM Local (https://github.com/awslabs/aws-sam-cli ). It uses flask-apispec with marshmallow to make serialization and swagger generation effortless. The project I made with integrating flask and lambda is in my opinion quite smooth and makes writing a serverless Flask application as straightforward as any other app. What I want to do now is find a way to make this pattern reusable for myself and others, but it's not so clear to me how to approach this. I think the combination is a very powerful and useful one but I realized I could use some help in designing something opinionated yet reusable with the goal of making a new Flask-based lambda web service as fast and painless as possible. I took a crack at beginning to do this with https://github.com/revmischa/flask-serverless but I'm open to different ideas. What I'd like is provide configuration via AWS SSM or lambda config vars, aws-wsgi bridge, a way to bundle dependencies along with the application, CORS, marshmallow, and apispec all in a neat little starter kit to make it possible to create little flask webserverlesses with minimal setup or copy/pasting. There do exist some third-party projects like Zappa and Serverless that provide some of these pieces, but I am trying to see how far I can get with Flask and AWS' own tooling. Thanks for your input! Mischa -------------- next part -------------- An HTML attachment was scrubbed... URL: From sneto.vicente at gmail.com Tue Nov 6 10:31:08 2018 From: sneto.vicente at gmail.com (Vicente Neto) Date: Tue, 6 Nov 2018 09:31:08 -0600 Subject: [Flask] AWS Lambda integration module idea In-Reply-To: <8B56BB65-F2AA-43E7-B696-D83C192CE4D6@mvstg.biz> References: <8B56BB65-F2AA-43E7-B696-D83C192CE4D6@mvstg.biz> Message-ID: Hi there! To be honest, I didn't have time to read all your email... but your idea looks like the Chalice Microframework. You can read more about it here . PS: I'm sorry if I didn't fully understand your idea and gave you a generic answer. :p Kind regards! On Tue, Nov 6, 2018 at 8:23 AM wrote: > Hello all, I wanted to get feedback on a proposal for a flask extension to > make writing AWS Lambda web applications and services with Flask easier. > > AWS Lambdas are little zip files of code and dependencies that can be > executed without any extra infrastructure and can be provided as HTTP > services. > > I've found that Flask is really great for making even complex lambdas, and > can be nearly as easy to maintain and manage as say a Heroku application. > Except they run for basically free and you don't have to worry about having > hosts to run your application or scaling web servers. I wrote about my > setup here > https://spiegelmock.com/2018/09/06/serverless-python-web-applications-with-aws-lambda-and-flask/ > > I wrote a basic Flask service hooking into AWS SSM Parameter Store to > provide encrypted secrets from AWS to the application, using aws-wsgi ( > https://pypi.org/project/aws-lambda-wsgi/) to bridge lambda http proxy > requests and responses with WSGI, and a small bit of tooling to vendor the > application dependencies because they need to be shipped in the zip bundle. > Code demonstrating all of this can be found here - > https://github.com/revmischa/qanda/. > Local running and testing is handled by AWS SAM Local ( > https://github.com/awslabs/aws-sam-cli). It uses flask-apispec with > marshmallow to make serialization and swagger generation effortless. > > The project I made with integrating flask and lambda is in my opinion > quite smooth and makes writing a serverless Flask application as > straightforward as any other app. What I want to do now is find a way to > make this pattern reusable for myself and others, but it's not so clear to > me how to approach this. I think the combination is a very powerful and > useful one but I realized I could use some help in designing something > opinionated yet reusable with the goal of making a new Flask-based lambda > web service as fast and painless as possible. > I took a crack at beginning to do this with > https://github.com/revmischa/flask-serverless but I'm open to different > ideas. What I'd like is provide configuration via AWS SSM or lambda config > vars, aws-wsgi bridge, a way to bundle dependencies along with the > application, CORS, marshmallow, and apispec all in a neat little starter > kit to make it possible to create little flask webserverlesses with minimal > setup or copy/pasting. > > There do exist some third-party projects like Zappa and Serverless that > provide some of these pieces, but I am trying to see how far I can get with > Flask and AWS' own tooling. > > Thanks for your input! > Mischa > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From seandavi at gmail.com Tue Nov 6 11:37:33 2018 From: seandavi at gmail.com (Sean Davis) Date: Tue, 6 Nov 2018 11:37:33 -0500 Subject: [Flask] AWS Lambda integration module idea In-Reply-To: References: <8B56BB65-F2AA-43E7-B696-D83C192CE4D6@mvstg.biz> Message-ID: There is also the zappa project that might be considered a related solution. https://github.com/Miserlou/Zappa Sean On Tue, Nov 6, 2018 at 10:31 AM Vicente Neto wrote: > Hi there! > > To be honest, I didn't have time to read all your email... but your idea > looks like the Chalice Microframework. > You can read more about it here > . > > PS: I'm sorry if I didn't fully understand your idea and gave you a > generic answer. :p > > Kind regards! > > On Tue, Nov 6, 2018 at 8:23 AM wrote: > >> Hello all, I wanted to get feedback on a proposal for a flask extension >> to make writing AWS Lambda web applications and services with Flask easier. >> >> AWS Lambdas are little zip files of code and dependencies that can be >> executed without any extra infrastructure and can be provided as HTTP >> services. >> >> I've found that Flask is really great for making even complex lambdas, >> and can be nearly as easy to maintain and manage as say a Heroku >> application. Except they run for basically free and you don't have to worry >> about having hosts to run your application or scaling web servers. I wrote >> about my setup here >> https://spiegelmock.com/2018/09/06/serverless-python-web-applications-with-aws-lambda-and-flask/ >> >> I wrote a basic Flask service hooking into AWS SSM Parameter Store to >> provide encrypted secrets from AWS to the application, using aws-wsgi ( >> https://pypi.org/project/aws-lambda-wsgi/) to bridge lambda http proxy >> requests and responses with WSGI, and a small bit of tooling to vendor the >> application dependencies because they need to be shipped in the zip bundle. >> Code demonstrating all of this can be found here - >> https://github.com/revmischa/qanda/. >> Local running and testing is handled by AWS SAM Local ( >> https://github.com/awslabs/aws-sam-cli). It uses flask-apispec with >> marshmallow to make serialization and swagger generation effortless. >> >> The project I made with integrating flask and lambda is in my opinion >> quite smooth and makes writing a serverless Flask application as >> straightforward as any other app. What I want to do now is find a way to >> make this pattern reusable for myself and others, but it's not so clear to >> me how to approach this. I think the combination is a very powerful and >> useful one but I realized I could use some help in designing something >> opinionated yet reusable with the goal of making a new Flask-based lambda >> web service as fast and painless as possible. >> I took a crack at beginning to do this with >> https://github.com/revmischa/flask-serverless but I'm open to different >> ideas. What I'd like is provide configuration via AWS SSM or lambda config >> vars, aws-wsgi bridge, a way to bundle dependencies along with the >> application, CORS, marshmallow, and apispec all in a neat little starter >> kit to make it possible to create little flask webserverlesses with minimal >> setup or copy/pasting. >> >> There do exist some third-party projects like Zappa and Serverless that >> provide some of these pieces, but I am trying to see how far I can get with >> Flask and AWS' own tooling. >> >> Thanks for your input! >> Mischa >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -- Sean Davis, MD, PhD Center for Cancer Research National Cancer Institute National Institutes of Health Bethesda, MD 20892 https://seandavi.github.io/ https://twitter.com/seandavis12 -------------- next part -------------- An HTML attachment was scrubbed... URL: From memory.yancy at gmail.com Tue Nov 20 12:47:28 2018 From: memory.yancy at gmail.com (Chenyang Yan) Date: Wed, 21 Nov 2018 01:47:28 +0800 Subject: [Flask] Flask connect different mongodb according to situation sequence Message-ID: Anyone have a good idea about connecting different mongodb in Flask according to situation sequence? Thanks in advanced ! database-A will be connected in flask app001.init_app() using pymodm.connect(), and then I can do CRUD operation. But database-B will be installed latter. That is, I use database-A record related info about installing other system app env(such as: install docker, k8s ... create another flask env named SKYAPP and start database-B to use) How to connect database-B in app001 using one better way or other idea? I googled and find one, but this method is not perfect in some way. Everytime need connect when request API: # when other sysyem finished installing, get database-B IP, port from installed system app class UserView(FlaskView): from pymodm import connect connect("mongodb://{}:{}/dbname".format(database-B_IP, database-B_port) # since will install system app env, so database-B related info can not hardcode From epandurski at gmail.com Sun Nov 25 15:28:04 2018 From: epandurski at gmail.com (Evgeni Pandurski) Date: Sun, 25 Nov 2018 22:28:04 +0200 Subject: [Flask] Introducing Flask-SignalBus Message-ID: Hello, I am working on a new Flask extension called Falsk-SignalBus. Basially, it adds to Flask-SQLAlchemy the capability to *atomically* send messages (signals) over a message bus. I'd very much like to hear what you think of it. More details here: https://github.com/epandurski/flask_signalbus Thanks! -- Evgeni Pandurski -------------- next part -------------- An HTML attachment was scrubbed... URL: