Strange Security Groups issue

0

snapshot of events:

  • Upgraded an existing instance from tiny to medium and added 400 GB.
  • Created a new security group and attached it to the instance. An inbound rule in the security group has the following: IP Version: IPv4 Type: Custom TCP Protocol: TCP Port Range: 5000 Source: 172.x.y.z (this is the internal ip address of another instance in the same VPC--masked for this thread)
  • Ran a flask web server on the above instance that listens on port 5000.

I'm able to telnet to port 5000 on the same instance. However I get "Connection Refused" when I telnet to it from another instance in the same VPC. Even though the security group rule permits it. I even created a rule that allowed All TCP on All Ports from any instance in the same VPC and it failed. I've never had this problem before. I've setup several security group rules and they worked just fine. Any idea what I am doing wrong this time?

Sean
asked 2 months ago112 views
2 Answers
1
Accepted Answer

Even if your security group allows traffic, the instance itself might have a local firewall blocking it. Make sure the instance's firewall (iptables on Linux, Windows Firewall) has a rule allowing traffic on port 5000.

Check your Flask application to listen on 0.0.0.0 to accept connections on all interfaces.

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

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed a month ago
profile pictureAWS
EXPERT
reviewed 2 months ago
0

Which OS is this, and is there a host-based firewall?

This might be ufw on Ubuntu, or firewalld on RHEL/CentOS/Fedora. Check port 5000 is open in its config.

profile picture
EXPERT
Steve_M
answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions