I have an AWS ec2 instance. I have installed tomcat and now want to access it via the browser on port 8080. When I try to do so, the browser hangs. I HAVE ADDED 8080 TO THE DEFAULT SECURITY GROUP. I see that you can open different ports for different regions, I have added the port for every region.

Here is what I've done so far:

//install tomcat
# sudo yum install tomcat6
//open port on server

# sudo iptables -A INPUT -i eth0 -p tcp --sport 8080 -m state --state NEW,ESTABLISHED -j ACCEPT

//start tomcat

# sudo service tomcat6 start

//and rule to AWS security group for port 8080
AWS dashboard > ec2 > security groups > default group > inbound rule: 8080 (HTTP*)

//check via cli that tomcat is running on port 8080
# udo fuser -v 8080/tcp

(successful response) 8080/tcp:            tomcat    16353 F.... java

//check via browser
http://ec2-instance-dns:8080 (browser tries to load page indefinitely)
  • 1
    Have you opened the port in AWS firewall?
    – Smudge
    Oct 3, 2011 at 12:04
  • I have added the port to the default security group in AWS, as detailed in the original question.
    – waigani
    Oct 3, 2011 at 22:23
  • You added the rule, but did you remember to 'Apply Rule Changes'? Oct 5, 2011 at 7:46
  • @pguardiario yes. I went back and double checked that the rule was applied for each region.
    – waigani
    Oct 6, 2011 at 2:26
  • @waigani You've added 8080 to the default security group - can you confirm that this security group is associated with the instance in question? AWS dash > ec2 > instances > instances > (click specific instance). Is the security group listed in the 'Security Groups' section of the description? If not, it needs to be, or, add your rules to the security group listed there. I just had this problem and that was my solution, but yours may be different of course :)
    – oli
    Oct 24, 2011 at 0:51

3 Answers 3


You also need to add the port in the security group in the AWS-config-panel.

enter image description here

  • I have added the port to the default security group in AWS, as detailed in the original question.
    – waigani
    Oct 3, 2011 at 22:23

By default AWS EC2 instances have a security group that doesn't allow access other than SSH. You have to go and configure the security group to allow what traffic you want to allow into the instances. The browser hang you are experiencing is because of the AWS firewall not being configured to allow port 8080/tcp through so it is dropping the packets and your browser is just waiting for the response to the TCP handshake which will never happen.

Eliminate as many moving variables... Disable iptables firewall. If it works then your security group is configured properly and your iptables rule which has --sport 8080 rather than --dport 8080 would be at fault. Your udo ... command would have more than likely utilized the loopback interface if you ran it from the EC2 instance itself so it would have ignored any iptables rule affecting eth0 only.

  • I have added the port to the default security group in AWS, as detailed in the original question.
    – waigani
    Oct 3, 2011 at 22:23
  • OK... How about does it work if you disable iptables on the EC2 instance? I just noticed your iptables rule lists "--sport 8080" rather than "--dport 8080" when I re-read your question. Oct 4, 2011 at 1:50
  • do you mean turn disable the whole iptables firewall (# iptables stop) ?
    – waigani
    Oct 4, 2011 at 3:56
  • I ran # /etc/init.d/iptables stop then tried to reload the page, no luck. Btw url = ec2-50-19-157-107.compute-1.amazonaws.com:8080. I turned iptables back on after the test.
    – waigani
    Oct 4, 2011 at 4:01
  • what does netstat -plunta |grep :8080 show when ran on your EC2 instance. I've been using AWS EC2 instances for over 2 years and have never had this much trouble getting a service made available. Oct 4, 2011 at 10:49

I usually try to toggle SELinux to "disabled" and reboot or just do

echo 0 > /sys/fs/selinux/enforce

then if that fixed it, permit the port in SELinux

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.