Manual deployment through Apache tomcat

In this blog, I’ll walk you through the manual deployment of a Java .war application using Apache Tomcat on an AWS EC2 instance. This helps you understand how things work behind the scenes before diving into automation tools like Jenkins or Ansible.
Prerequisites
AWS account
EC2 instance (Amazon Linux 2 or Ubuntu)
Java .war file
SSH access
Step 1: Launch EC2 Instance
Go to AWS Console > EC2 > Launch Instance
Choose OS: Amazon Linux 2 or Ubuntu
Allow ports: 22 (SSH) and 8080 (Tomcat)
Download the .pem key
Step 2: Connect to EC2 via SSH
chmod 400 your-key.pem ssh -i "your-key.pem" ec2-user@your-ec2-ip
Step 3: Install Java
Amazon Linux: sudo yum update -y sudo amazon-linux-extras enable java-openjdk11 sudo yum install java-11-openjdk -y
ubuntu: sudo apt update sudo apt install openjdk-11-jdk -y
Step 4: Install Apache Tomcat
cd /opt sudo curl -O https://downloads.apache.org/tomcat/tomcat-9/v9.0.85/bin/apache-tomcat-9.0.85.tar.gz sudo tar -xvzf apache-tomcat-9.0.85.tar.gz sudo mv apache-tomcat-9.0.85 tomcat cd /opt/tomcat/bin sudo chmod +x *.sh sudo ./startup.sh
Visit: http://your-ec2-ip:8080
Step 5: Deploy WAR File
From local to EC2:scp -i your-key.pem yourapp.war ec2-user@your-ec2-ip:/home/ec2-user/
On EC2:
sudo mv /home/ec2-user/yourapp.war /opt/tomcat/webapps/
Visit your app: http://your-ec2-ip:8080/yourap
Done 🎉
You’ve successfully deployed your Java app using Tomcat on an EC2 instance. Later, you can automate this with CI/CD tools, but understanding the manual process is a great first ste
Subscribe to my newsletter
Read articles from akash rawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
