Skip to content

End-to-end Jenkins CI/CD implementation on AWS EC2 covering Jenkins installation, Docker agent configuration, plugin setup, and pipeline-ready infrastructure for real-world DevOps workflows.

License

Notifications You must be signed in to change notification settings

SahanaCodes7/Jenkins

Repository files navigation

Jenkins CI/CD on AWS EC2

This repository demonstrates a complete Jenkins setup on AWS EC2, designed to create a CI/CD-ready environment using Docker-based build agents.
The project highlights practical DevOps implementation commonly used in real-world production pipelines.

Key objectives include installing Jenkins, configuring Docker as a Jenkins agent, enabling CI/CD workflows, and preparing the setup for Kubernetes-based deployments.


AWS EC2 Instance Setup

  • Log in to the AWS Management Console
  • Navigate to EC2 → Instances
  • Launch a new Ubuntu-based EC2 instance

Screenshot 2023-02-01 at 12 37 45 PM


Jenkins Installation

Prerequisites

  • Java (OpenJDK)

Install Java

sudo apt update
sudo apt install openjdk-17-jre

Verify installation:

java -version

Install Jenkins

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.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 binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null

sudo apt-get update
sudo apt-get install jenkins

Network Configuration

Jenkins runs on port 8080, which must be allowed in the EC2 security group.

Steps:

  • EC2 → Instances → Select your instance
  • Open the Security tab
  • Edit inbound rules
  • Allow TCP port 8080

Screenshot 2023-02-01 at 12 42 01 PM


Access Jenkins

Open Jenkins in the browser using:

http://<EC2_PUBLIC_IP>:8080

You can find the EC2 public IP address in the AWS EC2 console.

Initial Setup

After accessing Jenkins:

  • Retrieve the initial admin password:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • Paste the password into the Jenkins setup screen
  • Install suggested plugins
  • Create an admin user (recommended)

Screenshot 2023-02-01 at 10 56 25 AM


Install Suggested Plugins

Screenshot 2023-02-01 at 10 58 40 AM

Wait for Jenkins to complete the plugin installation.

Screenshot 2023-02-01 at 10 59 31 AM


Create Admin User

Creating an admin user is recommended for long-term and production-like usage.

Screenshot 2023-02-01 at 11 02 09 AM

Jenkins installation is now complete and ready for use.

Screenshot 2023-02-01 at 11 14 13 AM


Install Docker Pipeline Plugin

To enable Docker-based builds in Jenkins:

  • Log in to Jenkins
  • Go to Manage Jenkins → Manage Plugins
  • Open the Available tab
  • Search for Docker Pipeline
  • Install the plugin and restart Jenkins

Screenshot 2023-02-01 at 12 17 02 PM

Wait for Jenkins to restart after plugin installation.


Docker Agent Configuration

Install Docker

sudo apt update
sudo apt install docker.io

Grant Docker Permissions

Add Jenkins and Ubuntu users to the Docker group:

sudo usermod -aG docker jenkins
sudo usermod -aG docker ubuntu
sudo systemctl restart docker

Restart Jenkins to apply permission changes:

http://<EC2_PUBLIC_IP>:8080/restart

Docker is now successfully configured as a Jenkins build agent.


Project Outcome

  • Jenkins installed and configured on AWS EC2
  • Docker integrated as a Jenkins build agent
  • CI/CD-ready infrastructure established
  • Foundation prepared for Kubernetes and advanced DevOps workflows

About

End-to-end Jenkins CI/CD implementation on AWS EC2 covering Jenkins installation, Docker agent configuration, plugin setup, and pipeline-ready infrastructure for real-world DevOps workflows.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published