-1

I have started a Flask Webserver on an Amazon Linux 2 EC2 instances

(venv) [ec2-user@ip-10-0-1-63 microblog]$ flask run
 * Serving Flask app 'microblog.py'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit

When i try to access the Web either via the below Public V4 DNS or Public V4 IP i get "Site cannot be reached"

I have successfully launched an Apache Web Server into the same EC2 & VPC instances and have no issues.

Also running curl from the same server i launched flask returns the contents

[ec2-user@ip-10-0-1-63 ~]$ curl http://localhost:7999
Hello, World![ec2-user@ip-10-0-1-63 ~]$

(tried a range of other ports also)

Any clues on what to do to get it working from my Chrome/Safari browser?

Tried so far

  • Ensured EC2 was talking to the web
  • Ensured VPC had route to the public internet
  • Ensured other webservers could be launched successfully from the same EC2 instance

1 Answers1

0

Might be your application is not allowed for the outside world (0.0.0.0). Please check the running port in your system. You can use the below command to check:

sudo netstat -tulpn | grep LISTEN

enter image description here

check if 0.0.0.0: in your case, 0.0.0.0:5000 is showing in output or not.

Then try to run with below command:

flask run --host=0.0.0.0

Let me know, if that works. #Cloudkaramchari