A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/devops/how-to-deploy-flask-app-on-aws-ec2-instance/ below:

How To Deploy Flask APP On AWS EC2 Instance?

How To Deploy Flask APP On AWS EC2 Instance?

Last Updated : 23 Jul, 2025

In this article, we will study how we can deploy our existing Flask application in AWS EC2. We will also see how to use the public IP of the EC2 instance to access the flask application. For this article, you should know about setting up EC2 in AWS. So, let's begin with the deployment.

Primary Terminologies: Prerequisites: Steps to Deploy Flask Application in AWS EC2 with Ubuntu Server Step 1: Create an EC2 instance allowing HTTP traffic. Step 2: Connect to instance
ssh -i <key-file-name> username@<public-ip-address>
Step 3: Install Python Setup the enviroment.
sudo apt install python3
Step 4: Install Flask
pip install flask

Step 5: Create simple flask application.
nano hello.py
from flask import Flask
app = Flask(__name__)

@app.route("/")


def hello():
return "Hello World!"

if __name__ == "__main__":


app.run()
python hello.py

Step 6: Test the application locally.
curl http://127.0.0.1:5000
Step 7: Install and configure nginx as reverse proxy.
sudo apt install nginx

Step 8: Configure Reverse proxy.

server {
listen 80;
listen [::]:80;
server_name <YOUR INSTANCE IP>;

location / {
proxy_pass http://127.0.0.1:5000;
include proxy_params;
}
}
sudo systemctl restart nginx
sudo systemctl status nginx

Step 9: Test your application.

Conclusion:

We have successfully deployed our flask application on EC2 instance in AWS. Deploying application on EC2 makes it easier for web applications deployment. EC2 instances can be configured for more secure and upgraded web application servers.

Troubleshooting

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4