Hello folks, In this blog, I’m gonna show you How to run Jenkins in AWS, how to launch the ec2 instance, and then we’ll be logging into the ec2 instance using ssh and then downloading, installing, and configuring Jenkins.
alright, we’ve logged on to the AWS management console.
go to ec2 instances and launch an ubuntu instance.
choose amazon ubuntu ami, t2 micro, no of instance 1, and rest keep the default.
now I’ll show how you can do it by logging into the machine but once I show you if you know all those commands to set up and start the Jenkins service. and if you know those commands so you can put them in user data while configuring Instance Details.
and if you lunch the instance by that it will be run when the instance is launched not when it started because if you restart this instance it won’t get run
alright so add storage we’ll get with the default.
add tags key as name and value as Jenkins
now configure security group. and edit the security group name as “sg-jenkins” and description also.
allow ssh only MYIP and now let’s add another custom TCP rule for port 8080 where Jenkins will runs-on
After that, review and launch
select an existing and new key pair, select or create and then download the key.
got to the directory where you download the .pem file
chmod 400 jenkins.pem
after that, connect to the AWS console and click on ssh client, and type “yes” while connecting through the console.
sudo apt update
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee \ /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ https://pkg.jenkins.io/debian-stable binary/ | sudo tee \ /etc/apt/sources.list.d/jenkins.list > /dev/null
the first command sets up the Jenkins repository and the second imports the key.
so now we’re able to install Jenkins but this ami doesn’t come with java if I do
we know that In order to use Jenkins, java must be there so
sudo apt update sudo apt install openjdk-11-jdk java -version
Jenkins is installed now we need to enable it first before starting it.
sudo apt-get install jenkins
sudo systemctl start jenkins sudo systemctl status jenkins
In this blog, we’ve seen how to launch the ec2 instance and its configuration for Jenkins and how we can install Jenkins on it, after that, we accessed the Jenkins dashboard.