We have already created VMs in AWS and Microsoft Azure in Chapter 4, Cloud Computing and Configuration Management. To deploy an application in AWS and Microsoft Azure VM, we need a WAR package file. Once it is created by the Jenkins build job, we need to perform the following steps:
Let's configure the build job to execute the deployment of the WAR file in the AWS instance by executing the commands shown as follows:
- Give rights to ec2-user in the webapps directory of Tomcat so we can copy the WAR file:
ssh -i /home/mitesh/book.pem -o StrictHostKeyChecking=no -t -t
ec2-user@ec2-52-90-116-36.compute-1.amazonaws.com "sudousermod -a
-G tomcat ec2-user;
sudochmod -R g+w /var/lib/tomcat6/webapps; sudo service tomcat6
stop;"
- Copy the WAR file into the remote directory:
scp -i /home/mitesh...