Tomcat – Unable to setup and access tomcat on EC2 with AMI

amazon-amitomcat

I attempted to start tomcat7 on an EC2 instance running AMI and could not get the web service accessed from a browser using the public IP.

  1. Created an EC2 instance with default AMI as the image
  2. Created an Elastic IP and associated it with the instance
  3. Installed tomcat7 and made sure that it is started in inet.d
  4. Created an entry in Security Group for quick-start-1 and added port 8080 to it.
  5. Verified the Security Group is properly added to the instance.
  6. Verified that the tomcat is on Port 8080

Can't access the http server from a browser using the public DNS name or the IP address.

Some of the output from the instance are shown below:

ec2-user@ip-10-202-49-142 ~$ sudo fuser -n tcp 8080
8080/tcp: 1162

 

ec2-user@ip-10-202-49-142 ~$ sudo netstat -apn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1019/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1088/sendmail
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1052/sshd
tcp 0 300 10.202.49.142:22 198.6.50.15:28002 ESTABLISHED 1253/sshd
tcp 0 0 ::1:631 :::* LISTEN 1019/cupsd
tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 1162/java
tcp 0 0 :::8009 :::* LISTEN 1162/java
tcp 0 0 :::8080 :::* LISTEN 1162/java
tcp 0 0 :::22 :::* LISTEN 1052/sshd
udp 0 0 0.0.0.0:68 0.0.0.0:* 928/dhclient
udp 0 0 0.0.0.0:631 0.0.0.0:* 1019/cupsd
udp 0 0 10.202.49.142:123 0.0.0.0:* 1073/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1073/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1073/ntpd
udp 0 0 fe80::1031:3bff:fe12:326:123 :::* 1073/ntpd
udp 0 0 ::1:123 :::* 1073/ntpd
udp 0 0 :::123 :::* 1073/ntpd
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 ACC STREAM LISTENING 3054 1237/gam_server @/tmp/fam-root-
unix 2 ACC STREAM LISTENING 1072 1/init @/com/ubuntu/upstart
unix 7 [ ] DGRAM 1882 978/rsyslogd /dev/log
unix 2 ACC STREAM LISTENING 2408 1019/cupsd /var/run/cups/cups.sock
unix 2 ACC SEQPACKET LISTENING 1139 584/udevd @/org/kernel/udev/udevd
unix 2 ACC STREAM LISTENING 1936 999/dbus-daemon /var/run/dbus/system_bus_socket
unix 2 [ ] DGRAM 3935 1318/sudo
unix 3 [ ] STREAM CONNECTED 3124 1253/sshd
unix 3 [ ] STREAM CONNECTED 3123 1256/sshd
unix 2 [ ] DGRAM 3120 1253/sshd
unix 3 [ ] STREAM CONNECTED 3057 1237/gam_server @/tmp/fam-root-
unix 3 [ ] STREAM CONNECTED 3056 1235/python
unix 3 [ ] STREAM CONNECTED 3041 999/dbus-daemon /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 3040 1235/python
unix 2 [ ] DGRAM 2780 1171/crond
unix 2 [ ] DGRAM 2663 1096/sendmail: Queu
unix 2 [ ] DGRAM 2645 1088/sendmail
unix 2 [ ] DGRAM 2566 1073/ntpd
unix 3 [ ] STREAM CONNECTED 1945 999/dbus-daemon /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 1944 1/init
unix 3 [ ] STREAM CONNECTED 1940 999/dbus-daemon
unix 3 [ ] STREAM CONNECTED 1939 999/dbus-daemon
unix 3 [ ] DGRAM 1155 584/udevd
unix 3 [ ] DGRAM 1154 584/udevd

 

ec2-user@ip-10-202-49-142 ~$ sudo iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ec2-user@ip-10-202-49-142 ~$ 

Best Answer

Looks like there is only a ipv6 tomcat socket and not an ipv4

:::8080 :::* LISTEN 1162/java