Search code examples
tomcatamazon-ec2connection

GUI not loading for tomcat after successfully installing tomcat on EC2 instance


I tried installing tomcat server on an EC2 instance. After doing the setup, it got successfully installed and it got started. Please check below logs for it:

ubuntu@ip-XXX-XX-X-XXX:~/apache-tomcat-8.5.43/bin$ /home/ubuntu/apache- 
tomcat-8.5.43/bin/startup.sh
Using CATALINA_BASE:   /home/ubuntu/apache-tomcat-8.5.43
Using CATALINA_HOME:   /home/ubuntu/apache-tomcat-8.5.43
Using CATALINA_TMPDIR: /home/ubuntu/apache-tomcat-8.5.43/temp
Using JRE_HOME:        /usr/bin/java
Using CLASSPATH:       /home/ubuntu/apache-tomcat- 
8.5.43/bin/bootstrap.jar:/home/ubuntu/apache-tomcat-8.5.43/bin/tomcat- 
juli.jar
Tomcat started.

I tried taking the public DNS IP and tried hitting http://:9090 to check for the GUI but it does not loads up. I have changed the default port for tomcat to 9090 in the server.xml file. It works for me on the local but I need it to work it on EC2 instance.

can anyone assist me on this ?


Solution

  • For cloud architecture, it is best practice to implement principles of least privilege. Meaning, always only allow what is needed.

    AWS Security groups are virtual firewalls, that control inbound and outbound traffic for EC2 instances.

    To allow port 9090 into your EC2 instance:

    • In the AWS console, navigate to EC2 service (ensure you have the correct region selected, top right in the menu bar)
    • In the instances menu
    • Select the EC2 that is running your tomcat server
    • In the details section that appears at the bottom of the screen, in the Security Groups section, click the security group(s) listed there.
    • This will take you to the security group that is associated with the EC2 instance.
    • Click the 'inbound' tab, and add TCP port 9090 to the list.
    • If this is a public facing web server, the source should be 0.0.0.0/0