Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29250

Flask and EC2: PermissionError: [Errno 13] Permission denied

$
0
0

pls do not mark this as duplicate as this is quite specific to a use case on AWS's EC2.

I am attempting to deploy my Flask app on AWS's EC2 and have been following this tutorial but my console has been throwing me this error:

[ec2-user@ip- flask_test]$ python3 main.py
 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Traceback (most recent call last):
  File "main.py", line 46, in <module>
    app.run(host= '0.0.0.0', port=80)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/flask/app.py", line 990, in run
    run_simple(host, port, self, **options)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 1010, in run_simple
    inner()
  File "/home/ec2-user/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 963, in inner
    fd=fd,
  File "/home/ec2-user/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 806, in make_server
    host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
  File "/home/ec2-user/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 699, in __init__
    HTTPServer.__init__(self, server_address, handler)
  File "/usr/lib64/python3.6/socketserver.py", line 456, in __init__
    self.server_bind()
  File "/usr/lib64/python3.6/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib64/python3.6/socketserver.py", line 470, in server_bind
    self.socket.bind(self.server_address)
PermissionError: [Errno 13] Permission denied

I have read here that port 80 could be a privileged port, but on EC2, I specified inbound traffic to port 80 like so in the tutorial: enter image description here

I have also attempted using sudo python3 main.py but it throws me another ImportError: No module named flask error instead. What am I missing?


Viewing all articles
Browse latest Browse all 29250

Trending Articles