Technology & Design

Integration Of Jenkins With AWS EC2 Instance Using SSH Plugin

If you want to run commands on the AWS EC2 Instance tool using Jenkins, this blog can help you to connect your self-hosted Jenkins with AWS EC2 Instance, using the SSH remote host plugin provided by Jenkins.

Pre-requisites

  1. One Up & Running AWS – EC2 Instance
  2. One UP  & Running Jenkins Server
  3. AWS EC2 Public IP Address
  4. AWS EC2 Pem File

Step 1

  • Go to: Jenkins -> Manage Jenkins -> Manage Plugins -> Available Tab
  • Search For ‘SSH Plugin
  • Download and Install that Plugin

The plugin shall appear in the installed tab.

Step 2

  • Go to: Jenkins -> Manage Jenkins -> Configure System

Now “SSH remote hosts” option will appear on this page.

  • “Add” button will appear in the SSH remote hosts section.
  • This plugin can connect multiple EC2 Instances.
  • Add button will ask for a number of parameters as described in the image above.

Parameter Values

  • Hostname: Public IP of EC2 Instance or any Domain name of EC2 Instance
  • Port: 22 ‘Because 22 Port is for SSH Connections’
  • pty, serverAliveInterval, timeout: put the value as described in above image
  • Need to Add Credentials by clicking Add button next to Credentials Drop Down.

Step 3

  • Add Credentials Popup will appear as explained in the image above.

Parameter Values

  • Kind: SSH Username with Private Key
  • Scope: Global
  • Username: ec2-user ‘or Any Username of your AWS EC2 Instance’
  • Private Key: Select ‘Enter directly’. Here we will add Pem file
    • Key: Open Pem file with text -> Copy Content -> Paste here.
  • Passphrase: leave it blank
  • ID: leave it blank
  • Description: Put any Name for your Connection.

Step 4

  • Back to SSH remote hosts in Manage Jenkins -> Configure System.
  • Select the credentials that you created recently.
  • Then hit ‘Check Connection’ Button.

 

? Congratulations! You successfully Integrated Jenkins with AWS EC2 using SSH remote host.

Published by
Janki Thaker

Recent Posts

  • Podcast

AI in Business: Enhancing Human Productivity, Not Replacing It

In this episode of the The Lazy CEO Podcast,…

1 month ago
  • Podcast

Key to Digital Success: Insights from CEO of Sunflower Lab

Join us for an enlightening episode of The CEO…

1 month ago
  • AI/ML

5 Development Frameworks for Complex Multi-Agent AI System

Creating multi-agent workflows is the future of AI development,…

2 months ago
  • Podcast

Bridging Data Silos for Enhanced BI: Gaining The Technology Leadership Edge

How has sunflower lab's focus on integrating ai, data…

3 months ago
  • Automation

3 Steps to Achieve Versioning and Drafts

Businesses are quickly shifting towards optimized processes. And the…

4 months ago
  • Automation

6 Mistakes to Avoid in Power Automate

Developers often make mistakes when using Power Automate, which…

4 months ago