I want to deploy a Flask API on AWS using Docker. A common way seems to be using a combination of Nginx + app server (e.g Gunicorn) + Flask app.

The reason to use app server seems obvious to me. However, since I plan to use AWS ALB I'm not sure if there's a need for Nginx anymore? From my understanding Nginx is used for connection handling and serving static resources. In my case I don't need any of these: the connection is handled already by ALB (AFAIK) and I won't have to serve static resources.

Are there any other advantages of using Nginx for a low latency API service?

1 Answer 1


Unless you are using the AWS API Gateway, you'll still need some way of "serving" your Flask API. You will also need to provision an EC2 instance and run something to serve your API. Instead of running a windows EC2 instance with IIS you can save about 50% operating cost and use Nginx on a linux EC2 instance. Additionally, Nginx can be used as a reverse proxy, and supports caching which you may find beneficial.

However, because you are using an Application Load Balancer and are looking into Gunicorn to serve the API you probably don't need Nginx, and it would just require more overhead for deployments if you are not going to setup any of the features in Nginx.

  • Should have mentioned earlier, I will be using ECS + Fargate to run the container. The reverse proxy capability is already handled by ALB. Caching, however, might be a good point.
    – Domen P
    Sep 20, 2019 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.