How To Create Instance In Aws Step By Step
In this step you will deploy Jenkins on your EC2 instance by completing the following tasks:
-
[Connect to Your Linux Instance]
-
[Download and Install Jenkins]
-
Configure Jenkins
Connect to your Linux instance
After you launch your instance, you can connect to it and use it the way that you would use your local machine.
Before you connect to your instance, get the public DNS name of the instance using the Amazon EC2 console. Select the instance and locate Public DNS.
If your instance doesn't have a public DNS name, open the VPC console, select the VPC, and check the Summary tab. If either DNS resolution or DNS hostnames is no, click Edit and change the value to yes. |
Prerequisites
The tool that you use to connect to your Linux instance depends on the operating system running on your computer. 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 require the use of your key pair. Be sure that you created your key pair as described in [Create a key pair using Amazon EC2].
Using PuTTY to connect to your instance
-
From the Start menu, choose All Programs > PuTTY > PuTTY.
-
In the Category pane, select Session, and complete the following fields:
-
In Host Name, enter ec2-user@public_dns_name.
-
Ensure that Port is 22.
-
-
In the Category pane, expand Connection, expand SSH, and then select Auth. Complete the following:
-
Click Browse.
-
Select the .ppk file that you generated for your key pair, as described in [Create a key pair using Amazon EC2] and then click Open.
-
Click Open to start the PuTTY session.
-
Using SSH to connect to your instance
-
Use the ssh command to connect to the instance. You will specify 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 be 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. Are you sure you want to continue connecting (yes/no)?
-
Enter yes.
You will see a response like the following:
Warning: Permanently added 'ec2-198-51-100-1.compute1.amazonaws.com' (RSA) to the list of known hosts.
Download and install Jenkins
To download and install Jenkins:
-
To ensure that your software packages are up to date on your instance, use the following command to perform a quick software update:
[ec2-user ~]$ sudo yum update –y
-
Add the Jenkins repo using the following command:
[ec2-user ~]$ sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo
-
Import a key file from Jenkins-CI to enable installation from the package:
[ec2-user ~]$ sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
[ec2-user ~]$ sudo yum upgrade
-
Install Jenkins:
[ec2-user ~]$ sudo yum install jenkins java-1.8.0-openjdk-devel -y
[ec2-user ~]$ sudo systemctl daemon-reload
-
Start Jenkins as a service:
[ec2-user ~]$ sudo systemctl start jenkins
You can check the status of the Jenkins service using the command:
[ec2-user ~]$ sudo systemctl status jenkins
Configure Jenkins
Jenkins is now installed and running on your EC2 instance. To configure Jenkins:
-
Connect to http://<your_server_public_DNS>:8080 from your favorite browser. You will be able to access Jenkins through its management interface:
-
As prompted, enter the password found in /var/lib/jenkins/secrets/initialAdminPassword.
Use the following command to display this password:
[ec2-user ~]$ sudo cat /var/lib/jenkins/secrets/initialAdminPassword
-
The Jenkins installation script directs you to the Customize Jenkins page. Click Install suggested plugins.
-
Once the installation is complete, Create First Admin User, click Save and Continue.
-
On the left-hand side, click Manage Jenkins, and then click Manage Plugins.
-
Click on the Available tab, and then enter Amazon EC2 plugin at the top right.
-
Select the checkbox next to Amazon EC2 plugin, and then click Install without restart.
-
Once the installation is done, click Back to Dashboard.
-
Click on Configure a cloud.
-
Click Add a new cloud, and select Amazon EC2. A collection of new fields appears.
-
Fill out all the fields. (Note: You will have to Add Credentials of the kind AWS Credentials.)
You are now ready to use EC2 instances as Jenkins agents.
How To Create Instance In Aws Step By Step
Source: https://www.jenkins.io/doc/tutorials/tutorial-for-installing-jenkins-on-AWS/
Posted by: paigewilier88.blogspot.com
0 Response to "How To Create Instance In Aws Step By Step"
Post a Comment