Bob Lee
Bob Lee

Reputation: 27

How to start/use a Jenkins in data volume attached to AWS EC2

  1. Create an EC2 Instance_A with default root volume VOL_A.
  2. Install Jenkins by yum install, start it, make it auto-started and create many Jenkins jobs.
  3. Because the AMI to start Instance_A is not secure, I need to create a new EC2 Instance_B with default root volume VOL_B.
  4. Attach VOL_A as data volume to Instance_B.

The question is how do I start/use the Jenkins in the data volume?

Upvotes: 0

Views: 1097

Answers (1)

Badala Prashanth
Badala Prashanth

Reputation: 142

Following steps may solve your issue.

  1. Create instance_A with root volume vol_A, For reference can use documentation https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/launching-instance.html

  2. Connect to instance_A and install Jenkins as service and create required jobs. For reference documentation is at: https://www.jenkins.io/doc/tutorials/tutorial-for-installing-jenkins-on-AWS/

  3. Launch instance_B with vol_B as root volume by following the steps mentioned on step 1 and install Jenkins by referring step 2

  4. Now attach vol_A to instance_B as /jenkinsmount by using snapshot method or detach from instance_A by stopping instance and attach it to instance_B as add on volume.For reference documentation is at: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html

  5. After attaching volume stop Jenkins and change home directory in /etc/default/jenkins as shown below JENKINS_HOME=/jenkinsmount/var/lib/jenkins

  6. Start Jenkins in instance_B now. The jobs created in instance_A should be shown in instance_B along with job_history.

Upvotes: 2

Related Questions