0

I'm using this Python code to see if I can view the simple AWS server however, I'm still not able to load the webpage properly.

from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "It works!"

if __name__ == '__main__':
    app.run(port=80, host='0.0.0.0')

In AWS, inbound:

HTTP TCP port 80 with a source of: 0.0.0.0/0
SSH TCP port 22 with a source of: 0.0.0.0/0

Outbound - everything is allowed.

I'm seeing no errors on terminal when I start the program. The console says Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) so I'm trying to load http://[email protected]:5000

2 Answers 2

1

Flask defaults to binding to 127.0.0.1:5000.

If you're trying to access http://[email protected]:5000 , you'll need to have port 5000 opened in the inbound firewall rules and bind to 0.0.0.0 instead of 127.0.0.1.

Sign up to request clarification or add additional context in comments.

3 Comments

I did a custom TCP rule for port 5000 but also opened all TCP for all ports but it's still not loading.
@user1883614 I edited the post to take the binding host into account.
added that in my post above, same issue though.
0

You can not use port 80 for your web application. Let it run on default port then host your web application by mod_wsgi or uWSGI... Check the deployment options here: http://flask.pocoo.org/docs/0.12/deploying/ .

Imo: better if you deploy your application on AWS Elastic Beanstalk. Give me a shout if you need a sample project.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.