This project demonstrates the deployment of a Java + React full-stack application on an AWS EC2 instance.
I focused on building, deploying, and running the application in a cloud environment using Gradle, SSH, and SFTP.
- Frontend: React (bundled in JAR)
- Backend: Java (Spring Boot, built with Gradle)
- Environment: AWS EC2 (Ubuntu 22.04)
- Artifact:
java-react-example.jar
Opened the project in IntelliJ IDEA and used Gradle to build:
./gradlew build
build/libs/java-react-example.jar
Launched EC2 Instance
Created an Ubuntu EC2 instance (t2.micro) on AWS and installed Java:
sudo apt update
sudo apt install openjdk-17-jdk -y
java -version
created key-gen on local machine
mkdir /.ssh/authorized_keys
copy paste key in authorized_keys
3️⃣ Transferred the JAR File
Used SFTP to transfer the built JAR file to the EC2 instance:
sftp -i ubuntu@<ec2-public-ip>
put build/libs/java-react-example.jar
4️⃣ Ran the Application
Connected via SSH and started the app:
ssh -i id_rsa ubuntu@<ec2-public-ip>
java -jar java-react-example.jar
The app started successfully and was accessible at: ip-address of ec2 instance:7071
🧰 Tools & Technologies
AWS EC2 (Ubuntu 22.04)
Java 17 / Gradle
IntelliJ IDEA
SSH / SFTP
💡 Key Takeaways
Built and packaged a Java + React application using Gradle
How to ssh passwordless into ec2 instance
Deployed the JAR to AWS EC2 and ran it successfully
Gained hands-on experience with cloud deployment,Linux server setup and ssh between two machines