ccy
ccy

Reputation: 406

Running flask server on AWS EC2 with only gunicorn but no nginx

I have a simple flask application deployed on an AWS EC2 instance. The flask app accepts the incoming HTTP request, then do some (potentially heavy and lengthy) computations with the request, and then return the results.

Based on my limited understanding, it is recommended to always use nginx + gunicorn stack for a true flask app. As I try to keep things on the simple side, I just used gunicorn with 8 workers. The app works just fine, as I can query the EC2 instance, and got the result as expected. There is no (or very little) static contents for the app.

As for the traffic, I won't expect many simultaneous requests to the site (maybe ~10 requests at the same time), since it is for internal use. My question is, given my use case, will this (no nginx) harm me in the near future?

Upvotes: 0

Views: 966

Answers (1)

Harry Daniels
Harry Daniels

Reputation: 580

have you deployed using Elastic Beanstalk or EC2?

If the later, i recommend for this app using Elastic Beanstalk as it handles a lot of the configuration for you.

From AWS: Elastic Beanstalk uses nginx as the reverse proxy to map your application to your load balancer on port 80. If you want to provide your own nginx configuration, you can override the default configuration provided by Elastic Beanstalk by including the .ebextensions/nginx/nginx.conf file in your source bundle. If this file is present, Elastic Beanstalk uses it in place of the default nginx configuration file.

Otherwise, at this stage not having NGINX isn't going to affect your App performance however since it's not best practise/future proof, there's no harm in including it. There's a lot of content out there, describing how to do just that.

Cheers!

Upvotes: 1

Related Questions