0

I have created an EC2 (Amazon Linux) on Aws. I have a flask server which is running on port 8080. And have opened the same port in security group.

But the EC2 refused to connect on the 8080 port (xxx.xx.xxx.xx:8080), while the port 80 is accessible, I have Nginx running on port 80.

Rahul Gupta
  • 166
  • 3
  • 7

1 Answers1

2

I tested the setup using the flask example and works for me : https://pythonprogramminglanguage.com/flask-hello-world/

Steps:

1 Launch a new Amazon EC-2 Instance (used Amazon Linux AMI)

2 Installed Python and pip.

[3] Created a new web.py file, (modified the port from 5000 to 8080 and added rule in the security group for EC2)

[4] Ran, python3 web.py

enter image description here

enter image description here

X-Men
  • 433
  • 3
  • 9
  • have you done anything else other then adding the port in security group? and thank you for doing all this. – Rahul Gupta Jul 25 '22 at 05:15
  • 1
    No nothing, but this is just my test Environment. If you are running something in a production Environment or in a network inside your company it is possible that you may need to whitelist the port if there is any firewall. To test this you can do a curl to localhost at port 8080 to see if the application is working. – X-Men Jul 25 '22 at 22:20