Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flask Webserver on Amazon Linux 2 – This site can’t be reached on browser

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading