Making Sure You Can Access Everything…all the time
So, we’ve come pretty far. We’ve learned what pieces were needed to install TC on our EC2 server. We’ve learned some sensible steps in configuring your deployment environment so that you can run multiple instances of TC in a sensible manner.
All we have left to do is make sure we can access TC via the web and ensure that the server comes back up after a re-boot (if so desired).
Making TC Accessible to the Outside World
Log into your EC2 management console and select the specific instance you have installed TC to. Note the Security Groups that have access to this instance. In order for the world to have access to your instance of TC, you need to enable the port you plan to run it on. In this case, we’ll enable it for the default group.

Navigate to the Security Groups in the console and select the security grouop you want to enable the port for. In this case, we’ll be enabling port 8080 for the default group.
In the Connection Method column, select Custom.
In the Protocol column, select tcp.
In the From Port and To Port columns, enter 8080.
In the Source (IP or Group) column, enter 0.0.0.0/0. This will make it available to the world.
Click the Save button.
![]()
Congratulations, you’re console should now be available at http://<url to your instance>:8080.
Getting TC to Survive a Reboot
Linux installs support a mechanism for restarting services via /etc/init.d. In order to create a startup script so that TC survives a reboot and comes back up, use your favorite editor and create a similar file
vi /etc/init.d/tomcat
Paste in the following:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
case $1 in
start)
# uncomment and supply the correct instance for default start
# we’ll only support start for this script
# sh /usr/local/tomcat/run.sh start <instance number>
;;
stop)
# No need to support this since we’ll use the run.sh stop <instance>
;;
restart)
# Ditto above
;;
esac
exit 0
Make sure the script is executable by:
chmod 755 /etc/init.d/tomcat
And finally, link the script to the startup folders with a symbolic link:
ln –s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
ln –s /etc/init.d/tomcat /etc/rc2.d/S99tomcat