EC2 graviton Connection refused on opened port in security group


I have a new instance with security group to allow connection on port 9800 from my public IP, but i just keep getting

nc -vz <domain> 9800 nc: connectx to <domain> port 9800 (tcp) failed: Connection refused

1 Answer


Thank you for posting your question. Aside from your security group, there are a few other items to check:

  1. Is there a service actually listening on the OS on port 9800? If you can access it via SSH or other means, I would recommend running commands such as netstat -tulwn | grep 9800 or ss -tulwn | grep 9800 to ensure there is a service listening. In addition, it should be listening for all traffic ( or *:9800) versus local traffic only (such as
  2. Is the nc command being run from your local PC or another instance? In the former case, you will also want to be sure your instance is within a public subnet to be accessed over the public internet and network access control lists for the relevant subnet in your VPC have rules to allow traffic in and out over 9800.
  3. Can you confirm that the domain name is pointing to the expected address via a host <domain> or dig <domain> command? Similarly is there any difference when using the IP?
  4. Are there any firewall services running on either the client side or server itself such as ufw, firewalld, or services such as iptables?

The following documentation goes over several causes of connection timed out or connection refused errors when it comes to SSH though a similar process can be followed for troubleshooting why you are unable to access ports on your instance as expected [1]. I hope that the above questions are helpful in the troubleshooting process. In the event you have AWS Support enabled for your account, you can always certainly reach out for further assistance troubleshooting through the support console [2]. Have a great rest of your day and thank you again.

[1] Connection Refused -

[2] AWS Support Console -

profile pictureAWS
answered 6 months ago
profile picture
reviewed 6 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