title: How to access a Python flask application running on AWS EC2 remotely?
body: <p>I have a flask app that I have cloned onto my aws ec2 instance.  I can only run it using a virtual environment (which I activate by running the following):</p>
  
  <pre><code>$ python3 -m venv venv
  $ source venv/bin/activate
  $ pip install --upgrade pip
  $ pip install flask==1.1.1
  </code></pre>
  
  <p>Below is my app:</p>
  
  <pre><code>from flask import Flask
  app = Flask(__name__)
  
  @app.route("/")
  def hello():
      return "Hello World!"
  
  if __name__ == "__main__":
      app.run() 
  </code></pre>
  
  <p>It runs just fine when executing <code>env FLASK_APP=app.py flask run</code>.  The problem is, I'd like to access the exposed routes remotely using my aws ec2's public IP or hostname.  I get a tiemout error whenever I try to access it though.  I think this is because i'm running the flask app in a virtual environment but I'm not sure.  I can't find any good tutorials on how to expose this.  Where am I going wrong here?</p>