Follow the steps below to copy a Java/Spring Boot jar file from your local machine to a remote EC2 Linux/Ubuntu server and run the jar file via terminal:
Open terminal on your local machine and run the following scp (secure copy) command to copy a file from your localhost to a remote ec2 server:
sudo scp -i "your-remote-server.pem" my-file.jar [email protected]:/home/destination
Open terminal and ssh to your remote server:
sudo ssh -i "your-remote-server.pem" [email protected]
Run the copied jar file in dev environment using the following command:
java -Dspring.profiles.active=dev -jar my-file.jar