AWS, Cloud Computing

4 Mins Read

How to Configure Jenkins on EC2 Instance

Voiced by Amazon Polly

Introduction

Jenkins is an open-source automation server generally meant for continuous integration (CI) and continuous delivery (CD) processes in software development. It is a platform for automating the CICD for building, testing, and deploying software applications. If the development team needs to streamline the workflow, they can use Jenkins to increase efficiency and maintain code quality through automated processes.

 

The steps to Install Jenkins on an Amazon EC2 instance comprise several steps. Here’s a general outline of the process:

  1. First, Launch an EC2 Instance, and in the security group of the instance, open port 8080.
  2. SSH into the EC2 Instance. To SSH into the instance, go to the instance and connect through EC2 Instance Connect.
  3. Next, Install Jenkins on the EC2 instance. Enter the following command to check whether all the software packages are up to date.
    $sudo yum update
  4. To add Jenkins repo, enter the below command.

sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

  1. Import a key file from Jenkins-CI to enable installation from the package:
    $ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key

    $ sudo yum upgrade
  2. Based on the AMI of the EC2 Instance, Install
    Java on the EC2 using the following Commands

    • To Install Java on EC2 with Amazon Linux 2 AMI, enter the command given below

      $ sudo amazon-linux-extras install java-openjdk11 -y
    • To Install Java on EC2 with Amazon Linux 2023 AMI, Enter the below command
      $ sudo dnf install java-11-amazon-corretto -y
      Now, after Installing Java, Install Jenkins on the EC2 Instanceec2-user ~]$ sudo yum install jenkins -y
  3. To Start Jenkins, we must first enable the Jenkins service on an EC2 Instance to Start the boot.
    $ sudo systemctl enable jenkins
  4. After enabling ‘start,’ run the Jenkins on EC2 Instance.$ sudo systemctl start jenkins
  5. To check the status of the Jenkins service, use the following command:

    $ sudo systemctl status jenkins

Configuring Jenkins on EC2

Jenkins is now installed and running on your EC2 instance. To configure Jenkins:

  1. To connect to the Jenkins server from your web browser, enter the following:
    http://:8080

    It will restart your Jenkins, as shown below.
    This step ensures you configure Jenkins on EC2 Instance.You can launch the Jenkins and access it through the management Interface.
    E.g., http://126.32.18.3:8080
    To find the Public IP of the Instance, click on the EC2 instance and copy the Public IP of the Instance. You should get this Website as shown below.

  1. Password is stored in the following path in jenkins
    /var/lib/jenkins/secrets/initialAdminPassword.
  1. To locate the password, use the command below
    $ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  1. Copy and paste the Admin Password in the Browser to log in and continue.



Install the suggested Plugins on that Jenkins that the installation script directs you to customize the Jenkins page.

  1. Now, Create an Admin user and configure the Password for your Jenkins Server. You must enter the login name and password every time you log in.
  2. Select Manage Jenkins, and then select Manage Plugins mentioned on the left-hand side of the menu.

  1. Select Plugins, and in the Available tab, search for Amazon EC2 Plugin in the Search.
  2. Next to Amazon EC2 Plugin, Select the checkbox to install the Plugin on Jenkins, then Choose Install without restart.

  1. Follow the same steps and Install the Following Plugins as shown below:
    • Amazon EC2
    • Codepipeline Plugin
    Install the Codepipeline Plugin to integrate with the AWS CICD pipeline.

  1. Select the checkbox “Restart Jenkins when Installation is complete and no jobs are Running.”


Login with your new Sign-in credentials.

Once you log in, click on the Check Box.

Conclusion

Installing Jenkins on an Amazon EC2 instance can significantly enhance your continuous integration and continuous delivery (CI/CD) processes. By leveraging the scalability and flexibility of EC2, along with Jenkins’ robust automation capabilities, you can modernize software development, testing, and deployment workflows. Several key points to be noted throughout the process are Infrastructure Choice, Security Considerations, Installation Steps, Configuration, and Plugins. You can integrate the AWS CICD pipeline with Jenkins as a build server.

By successfully installing Jenkins on an EC2 instance and incorporating it into your development cycle, you’re taking a significant step towards achieving faster, more efficient software delivery.

References

Jenkins on AWS

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, AWS EKS Service Delivery Partner, and Microsoft Solutions Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!