Step 1) Create EC2 instance
Step 2) Install java
# yum install java -y
Step 3) Download tomcat package
path: /opt/
#wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.87/bin/apache-tomcat-9.0.87.tar.gz
Step 4) Extract tomcat package
#cd /opt
#gunzip apache-tomcat-9.0.87.tar.gz
#tar -xvf apache-tomcat-9.0.87.tar
path: /opt/apache-tomcat-9.0.87
Step 5) Comment out below line in context.xml file
Path: /opt/apache-tomcat-9.0.87/webapps/manager/META-INF
vi context.vml
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
path: /opt/apache-tomcat-9.0.87/webapps/host-manager/META-INF
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
Step 6) Add tomcat user.
path: /opt/apache-tomcat-9.0.87/conf
#vi tomcat-users.xml --> add user configuration.
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user name="admin" password="admin" roles="admin-gui,admin-script,manager-gui,manager-status,manager-script,manager-jmx"/>
Step 7)Start tomcat
path: /opt/apache-tomcat-9.0.87/bin
#./startup.sh
Step 8)Access tomcat using below URL.
http://<public-ip>:8080