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
demandé il y a 2 mois124 vues
2 réponses
1
Réponse acceptée

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
répondu il y a 2 mois
profile picture
EXPERT
vérifié il y a 2 mois
profile pictureAWS
EXPERT
vérifié il y a 2 mois
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
répondu il y a 2 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions