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 a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.

CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 850k+ professionals in 600+ cloud certifications and completed 500+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training PartnerAWS Migration PartnerAWS Data and Analytics PartnerAWS DevOps Competency PartnerAWS GenAI Competency PartnerAmazon QuickSight Service Delivery PartnerAmazon EKS Service Delivery Partner AWS Microsoft Workload PartnersAmazon EC2 Service Delivery PartnerAmazon ECS Service Delivery PartnerAWS Glue Service Delivery PartnerAmazon Redshift Service Delivery PartnerAWS Control Tower Service Delivery PartnerAWS WAF Service Delivery PartnerAmazon CloudFront Service Delivery PartnerAmazon OpenSearch Service Delivery PartnerAWS DMS Service Delivery PartnerAWS Systems Manager Service Delivery PartnerAmazon RDS Service Delivery PartnerAWS CloudFormation Service Delivery PartnerAWS ConfigAmazon EMR and many more.

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!