Steps to Setup a Jenkins Build Server on AWS

AWS Banner image's picture

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.

Introduction

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

  1. 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.

  1. On the Amazon Machine Image page, select Free tier only and then, select an Amazon Linux AMI with the HVM virtualization type.
  2. On the sort page, the t2.micro instance is selected by default. You should make this instance sort to stay within the free tier.
  3. Click Next: Configure Instance Details.
  4. On the Review Instance Launch page, click Edit security teams.
  5. On the Configure Security Group page, you should select an existing security group, select the WebServerSG security group that you created.
  6. Now, you should click the Review and Launch.
  7. On the Review Instance Launch page, you should click Launch.
  8. 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.
  9. Next, click the acknowledgment checkbox, and then, click Launch Instances.
  10. 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.

Prerequisites

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

  1. From the Start menu, select All Programs > PuTTY > PuTTY.
  2. Within the class pane, choose Session, and complete the given fields.
  3. Within the class pane, expand Connection, SSH, and then select Auth.
  4. 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:

  1. To confirm that your code packages are up to date on your instance, use the command to perform a fast code update.
  2. Add the Jenkins repo.
  3. Bring in a key file from Jenkins-CI to enable installation from the package.
  4. Install Jenkins.
  5. Start Jenkins as a service.

Configure Jenkins

After the installation phase, comes the configuration phase.

Let’s see how we can configure Jenkins together!

  1. Connect to http://:8080 from your favourite browser.
  2. As prompted, you need to enter the password.
  3. The Jenkins installation script navigates you to the Customise Jenkins page. There, click on Install suggested plugins.
  4. After the installation, you need to enter Administrator Credentials, then click Save Credentials, and then click on Start Using Jenkins.
  5. On the left-hand, click on Manage Jenkins, and then, click Manage Plugins.
  6. Next, click on the Available tab, and then, enter the Amazon Elastic Compute Cloud plugin at the top right.
  7. After this, choose the checkbox next to the Amazon Elastic Compute Cloud plugin, and then, click Install without restart.
  8. Once you are done with the installation, you need to click Go back to the top page.
  9. Now, click on Manage Jenkins, and then, configure the system.
  10. You must scroll all the way down to the Cloud section.
  11. Click Add a new cloud, and select Amazon Elastic Compute Cloud. A collection of new fields appears.
  12. 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

  1. Within the Amazon EC2 console’s left-hand navigation bar, you need to select Instances.
  2. You should click on the instance you created earlier and choose Instance State > Terminate.

Finally! We are done.

Great Job!

Also Read :- How to Integrate Google Analytics for Roku Application


Conclusion

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.



4waytechnologies's picture
4waytechnologies

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.

Related Blogs

Statecraft in React Native: Redux vs. Mobx vs. Context API Explained

React Native is a superhero toolkit that has been chosen by over 42% of developers.

How To Start A Streaming Service?

4 Way Technologies, a leading custom software development company offers impeccable.

How to develop & publish Vizio App for Smart TV?

Introduction The usage of Smart Television continues to grow gradually.

Share this Article

Page Content

Introduction

Step 1: Set Up Prerequisites

Step 2: Launch an Elastic Compute Cloud Instance

Create a Security team for Your Amazon EC2 Instance

Launch Your EC2 Instance

Step 3: Install and Configure Jenkins

Connect to Your Linux Instance

Download and Install Jenkins

Configure Jenkins

Step 4: Clean Up

Delete Your EC2 Instance

Conclusion

logo