Steps to Setup a Jenkins Build Server on AWS
Jenkins is a continuous integration tool. It is written in Java and offers several custom integration services for the software development processes. This server-based system is used by many software developers and development teams across the globe.
This article will help you in understanding the setup process of a Jenkins build server on AWS.
Jenkins is an automation server, which is open-source and integrates with a lot of AWS managed services like AWS CodeCommit, Amazon EC2 Spot, Amazon EC2 Fleet, and AWS CodeDeploy. You, as a developer, can also use Amazon EC2 (Elastic Compute Cloud) in order to deploy the Jenkins applications on AWS within a few minutes.
This tutorial will guide you step by step through the deploying process of a Jenkins application by:
- Launching an EC2 instance.
- Installing Jenkins on the EC2 instance.
- Configuring Jenkins.
- Cleaning up.
So, let’s hop in!
Step 1: Set Up Prerequisites
In this step, you need to ensure that you possess an Amazon Web Services account, an Amazon Web Services Identity, an Access Management user name and password, and Amazon Elastic Compute Cloud key pair, and a configured Virtual Private Cloud (VPC).
Step 2: Launch an Elastic Compute Cloud Instance
Here, we will guide you with the steps for hosting Jenkins. The virtual servers that help to host Jenkins are called Elastic Compute Cloud instances. Please feel free to follow the below-mentioned steps:
Create a Security team for Your Amazon EC2 Instance
A security team controls the traffic allowed to succeed in EC2 instances. When you launch an instance, you give it to the security teams and add rules for every security team. One thing to keep in mind is that you can just modify the principles for the security team whenever you want.
Follow the following steps to create and configure your security group:
1. Choose an IP address. To find your IP address, use the checkup service from Amazon Web Services. If you’re connecting through an ISP, you will come to know about the variety of internet protocol addresses.
2. Now, open the Amazon EC2 console.
3. Within the navigation bar, make sure that you choose the US West area.
4. In the left-hand navigation bar, select Security Groups, and then, click Create Security Group.
5. In the Security group name, enter WebServerSG and it should provide a description.
6. Next, choose your VPC from the list.
7. On the Inbound tab, add the rules.
8. And at last, click on Create.
Also Read :- 6 Amazing Mobile App Development Ideas To Fuel up the Startups!!
Launch Your EC2 Instance
- The following steps will help you in launching an Amazon EC2 instance:
In the Amazon EC2 console’s left-hand navigation bar, opt for Instances, and then, click Launch Instance.
- On the Amazon Machine Image page, select Free tier only and then, select an Amazon Linux AMI with the HVM virtualization type.
- On the sort page, the t2.micro instance is selected by default. You should make this instance sort to stay within the free tier.
- Click Next: Configure Instance Details.
- On the Review Instance Launch page, click Edit security teams.
- On the Configure Security Group page, you should select an existing security group, select the WebServerSG security group that you created.
- Now, you should click the Review and Launch.
- On the Review Instance Launch page, you should click Launch.
- In the Select an existing key pair or create a new key pair dialogue box, select an existing key pair and then, select the key pair you created while setting up Host Jenkins on Amazon Web Services.
- Next, click the acknowledgment checkbox, and then, click Launch Instances.
- In the left-hand navigation bar, you must choose Instances to see the status of your instance.
And it’s done!
Now, let’s jump to our next step, which involves installing and configuring Jenkins.
Step 3: Install and Configure Jenkins
In this step you’ll deploy Jenkins on your EC2 instance by finishing the subsequent tasks:
Connect to Your Linux Instance
After the launching phase, comes the connecting phase. But, before you connect with your instance, get the general public DNS name of the instance.
The tool that you just use to attach to your Linux instance depends on the software system running on your laptop. If your computer runs Windows, you will connect using PuTTY. If your computer runs Linux or Mac OS X, you will connect using the SSH client. These tools need the usage of your key pair. You should make sure that you just created your key pair as delineated in producing a Key Pair.
To Connect to Your Linux Instance from Windows using PuTTY
- From the Start menu, select All Programs > PuTTY > PuTTY.
- Within the class pane, choose Session, and complete the given fields.
- Within the class pane, expand Connection, SSH, and then select Auth.
- If this is the first time you have to connect with this instance, PuTTY displays a security alert dialogue box that asks whether you trust the connected host or not. You should click Yes. Then, a window will open.
To Connect to Your Instance from Linux or Macintosh OS X victimization SSH
1. Use the ssh command to connect to the instance. After that, you will see a response like the following:
Are you sure you wish to continue connecting?
2. Enter yes.
You will see a response like the following:
Warning: forevermore added ‘ec2-198-51-100-1.compute-1.amazon.
Amazon Web Services.com’ (RSA) to the list of identified hosts.
Download and Install Jenkins
In order to download and install Jenkins, follow these steps:
- To confirm that your code packages are up to date on your instance, use the command to perform a fast code update.
- Add the Jenkins repo.
- Bring in a key file from Jenkins-CI to enable installation from the package.
- Install Jenkins.
- Start Jenkins as a service.
After the installation phase, comes the configuration phase.
Let’s see how we can configure Jenkins together!
- Connect to http://:8080 from your favourite browser.
- As prompted, you need to enter the password.
- The Jenkins installation script navigates you to the Customise Jenkins page. There, click on Install suggested plugins.
- After the installation, you need to enter Administrator Credentials, then click Save Credentials, and then click on Start Using Jenkins.
- On the left-hand, click on Manage Jenkins, and then, click Manage Plugins.
- Next, click on the Available tab, and then, enter the Amazon Elastic Compute Cloud plugin at the top right.
- After this, choose the checkbox next to the Amazon Elastic Compute Cloud plugin, and then, click Install without restart.
- Once you are done with the installation, you need to click Go back to the top page.
- Now, click on Manage Jenkins, and then, configure the system.
- You must scroll all the way down to the Cloud section.
- Click Add a new cloud, and select Amazon Elastic Compute Cloud. A collection of new fields appears.
- Now, fill all the blank fields.
Congratulations! Great Job!
Step 4: Clean Up
After completing these steps, you should delete the existing AWS resources, so that, you do not continue to accrue charges.
Delete Your EC2 Instance
- Within the Amazon EC2 console’s left-hand navigation bar, you need to select Instances.
- You should click on the instance you created earlier and choose Instance State > Terminate.
Finally! We are done.
Also Read :- How to Integrate Google Analytics for Roku Application
We hope that you found this tutorial helpful. After going through the above information, you would be able to set up a Jenkins build server on Amazon Web Services and start processing your software development. Feel free to provide your valuable feedback in the comment section below.
4 Way Technologies is a premium IT services company that develops web, mobile, and SMART TV applications using cutting-edge technologies like React, Node.JS, Deno, Go lang, AWS, and AEM. We establish our thought leadership by sharing content and insights around technology.