Airzero Cloud

Next Generation Cloud !

How To Process Jenkins Application On AWS?

- Posted in Hosting by

enter image description here

Jenkins is an open-source automation server that combines with a number of AWS Services, before-mentioned as AWS CodeCommit, AWS CodeDeploy, Amazon EC2 Spot, and Amazon EC2 Fleet. You can use Amazon Elastic Compute Cloud to extend a Jenkins application on AWS in a matter of minutes.

This tutorial steps you through the method of deploying a Jenkins application. You will begin an EC2 instance, install Jenkins on that instance, and configure Jenkins to automatically turn up Jenkins agents if build techniques want to be augmented on the instance.

What are the prerequisites needed?

  1. An AWS account, if you don’t have one, please register.
  2. An Amazon EC2 key pair, if you don’t have one, see the segment.

How to create a key pair?

To create your key pair:

  1. Open the Amazon EC2 console and sign in.
  2. In the exploration pane, under NETWORK & SECURITY, choose Key Pairs.
  3. Select Generate key pair.
  4. For Name, start a detailed name for the key pair. Amazon EC2 joins the public key with the name that you define as the key name. A key name can add up to 255 ASCII characters. It can’t add leading or tracking spaces.
  5. For File format, choose the format in which to store the private key. To protect the private key in a composition that can be done with OpenSSH, choose pem. To protect the private key in a format that can be done with PuTTY, choose ppk.
  6. Choose Generate key pair.
  7. The private key data is automatically downloaded by your browser. The first file name is the name you designated as the name of your key pair, and the file name expansion is limited by the file format you desired. Save the private key file in a protected place.
  8. If you will use an SSH client on a macOS or Linux computer to attach to your Linux instance, use the subsequent command to set the acceptance of your private key file so that only you can read it.

    $ chmod 400 <key_pair_name>.pem

How to create a security group?

A security group acts as a firewall that examines the traffic left to join one or more EC2 instances. When you start an instance, you can select one or more safety groups. You add controls to each security group that controls the traffic permitted to reach the instances in the security group. Note that you can transform the practices for a security group at any time.

For this blog, you will make a security group and join the subsequent rules.

To make and configure your security group:

  • Choose who may enter your instance, for example, a personal computer or all advanced computers on a system. In this blog, you can use the free IP address of your computer. To expose your IP address, use the checkip services from AWS3 or seek the phrase "what is my IP address" in any Internet search engine. If you are combining through an ISP or from following your firewall outdoors a static IP address, you will require to find the range of IP addresses used by client computers. If you don’t understand this address range, you can use 0.0.0.0/0 for this blog. However, this is risky for making conditions because it enables everyone to transfer your instance using SSH.
  • Sign in to the AWS management console.
  • Start the Amazon EC2 console by taking EC2 under Compute.
  • In the left-hand navigation bar, want Security Groups, and then match Create Security Group.
  • In the Security, group title enter WebServerSG or any favoured name of your choosing and present a description.
  • Want your VPC from the list, you can use the want VPC.
  • On the Inbound tab, add the commands as follows:
  • Match Add Rule, and then accept SSH from the Type list. Under Source, picked Custom and in the text box enter /32 i.e 172.23.23.165/32.
  • Match Add Rule, and then take HTTP from the Type list.
  • Agree on Add Rule, and then choose Custom TCP Rule from the Type list. Below Port Range enter 8080.
  • select Create.

How to launch an Amazon EC2 instance?

To launch an EC2 instance:

  • Sign in to the AWS management console.
  • Start the Amazon EC2 console by taking EC2 under Compute.
  • From the Amazon EC2 dashboard, Select publish Instance.
  • The Like an Amazon Machine Image page presents a list of essential shapes called Amazon Machine Images that work as templates for your situation. Select the HVM version of the Amazon Linux AMI. Notice that this arrangement is marked Free tier available.
  • On the Choose an Instance Type page, the t2.micro situation is chosen by default. Keep this example type to visit within the free tier. Report and Launch.
  • On the Survey Instance Launch page, agree to Edit security groups.
  • On the Configure Security Group page:
  • Choose an existing security group.
  • Choose the WebServerSG security group that you built.
  • Click Review and Launch.
  • On the Survey Instance Launch page, agree on Launch.
  • In the Select, an existent key pair or generate a new key pair dialogue box, select Take an existing key pair and then choose the key pair you generated in the section above or any existing key pair you plan to use.
  • In the left-hand navigation bar, like Instances to see the situation of your instance. Originally, the status of your situation is pending. After the status switches to running, your instance is available for use.

How to install and configure Jenkins?

  • Connect to your Linux instance.
  • Download and install Jenkins.
  • Configure Jenkins.

How to use PuTTy to connect to your instance?

  • From the Start menu, like All Programs > PuTTY > PuTTY.
  • In the Class pane, select Session, and execute the following fields:
  • In Host Name, start ec2-user@public_dns_name.
  • Guarantee that Port is 22.
  • In the Section pane, expand Messenger, develop SSH, and then choose Auth. Perform the following:
  • Click Browse.
  • Choose the .ppk file that you created for your key pair, as defined in and then snap Open.
  • Click Open to start the PuTTY session.

How to use SSH to connect to your instance?

Use the ssh command to attach to the situation. You will define the private key (.pem) file and ec2-user@public_dns_name.

$ ssh -i /path/my-key-pair.pem ec2-user@ec2-198-51-
100-1.compute-1.amazonaws.com

You will see a response like the following:

The authenticity of host 'ec2-198-51-100-1.compute1.amazonaws.com
(10.254.142.33)' cant is  established
RSA key fingerprint is 1f:51:ae:28:bf:89:e9:d8:1f:25:5d:37:2d:7d:b8:ca:9f:f5:f1:6f.

Type yes.

You will see a command like the following:

Warning: Permanently added 'ec2-198-51-100-1.compute1.amazonaws.com' (RSA) to the list of known hosts.

To download and install Jenkins:

  • To guarantee that your software packages are up to time on your situation, use the following command to activate a quick software update:

    [ec2-user ~]$ sudo yum update –y

  • Include the Jenkins repo using the command:

    [ec2-user ~]$ sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo

  • Enter a key file from Jenkins-CI to activate installation from the package:

    [ec2-user ~]$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key [ec2-user ~]$ sudo yum upgrade

  • Download Jenkins:

    [ec2-user ~]$ sudo yum install jenkins java-1.8.0-openjdk-devel -y [ec2-user ~]$ sudo systemctl daemon-reload

  • Begin Jenkins as a service:

    [ec2-user ~]$ sudo systemctl start jenkins

  • You can check the status of the Jenkins consults by below the command:

    [ec2-user ~]$ sudo systemctl status jenkins

How to configure the Jenkins?

Jenkins is now downloaded and executing on your EC2 instance. To configure Jenkins:

  • Attach to http://:8080 from your favourite browser.
  • As defined, enter the password identify in /var/lib/jenkins/secrets/initialAdminPassword.

Use the below command to show this password:

[ec2-user ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • The Jenkins installation characters direct you to the Customize Jenkins page. Click Install recommended plugins.
  • Once the connection is terminated, Author First Admin User agrees on Save and Stay.
  • On the left-hand side, match Manage Jenkins, and then select Manage Plugins.
  • Choose on the Free tab, and then open the Amazon EC2 plugin at the top right.
  • Choose the checkbox subsequent to the Amazon EC2 plugin, and then click Install outdoors restart.
  • Once the establishment is done, click Terminal to Dashboard.
  • Agree on configuring a cloud.
  • Agree to Add a new cloud, and choose Amazon EC2. A compilation of new fields emerges.
  • Fill out all the forms. You are now super ready to use EC2 instances as Jenkins agents

If you have any questions about the above topic or have to get services and consultations and get the best Jenkins application services. Feel free to contact us. AIRO ZERO CLOUD will be your strong digital partner. E-mail id: [email protected]