Enterprise-Grade CI/CD Pipeline for Java Bank App Using Jenkins and AWS DevOps

Project Overview
This project demonstrates a complete CI/CD pipeline for a Bank Application using AWS DevOps tools. The pipeline includes:
Jenkins for CI/CD orchestration
SonarQube for code quality analysis
Nexus for artifact repository management
Docker for containerization
Trivy for security scanning
Kubernetes (EKS) for deployment
1. Jenkins Server Setup
Step 1: Launch EC2 Instance
Launch an Ubuntu EC2 instance with t2.large and 25GB storage for the Jenkins Server
Security group should allow inbound traffic on port 8080
Step 2: Install Jenkins
- Connect to the instance using its public IP:
ssh -i <.pem key name> ubuntu@<EC2 public IP> |
2. Update the server |
3. Install Java on the Jenkins Server
sudo apt install openjdk-17-jre-headless -y |
4. Install Jenkins on the server:
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \ |
5. Verify the Jenkins status:
sudo systemctl status jenkins |
6. Access Jenkins UI using the server IP address at port 8080:
<EC2 Public IP>:8080 |
7. Get the admin password:
/var/lib/jenkins/secrets/initialAdminPassword |
8. Complete the setup by:
Installing suggested plugins
Creating an admin user
Configuring the Jenkins URL
Create Admin User with below details and click on save next
Now we will be able to view the Jenkins Dashboard
2. Plugin Setup
Install the following Jenkins plugins:
Blue Ocean
Pipeline: Stage View Version
SonarQube Scanner
Config File Provider
Maven Integration
Pipeline Maven Integration
Kubernetes Client API
Kubernetes Credentials
Kubernetes
Kubernetes CLI
Kubernetes Credentials Provider
Kubernetes :: Pipeline :: DevOps Steps
Docker
Docker Pipeline
Pipeline Stage View
3. Install Docker on Jenkins Server
# Add Docker's official GPG key |
4. Install Trivy on Jenkins Server
sudo apt-get install wget gnupg |
# Verify Trivy installation |
5. SonarQube and Nexus Setup
Launch 2 EC2 instances (t2.medium with 20GB storage):
1 for SonarQube
1 for Nexus
For both servers:
Connect and update:
→ Connect to both servers using their public IP address and update using the below command
sudo apt update |
→ Install Docker on Both Servers and Change the permission for the docker
sudo apt install docker.io -y |
5.1 Nexus Setup
Install Nexus as a Docker container: |
Now we will able to access Nexus Repository using Nexus-Server public IP at port 8081
Click on sign in to login to Nexus
Get the admin password:
Get into container
docker ps |
Complete the setup:
Login with the password
Set a new admin password
Disable anonymous access
Login to Nexus using the password
setup new admin password
click on Next, and select “Disable anonymous access”
Click on Next and select Finish
Nexus Setup is completed.
5.2 SonarQube Setup
Install SonarQube as a Docker container:
sudo docker run -d --name Sonardevops -p 9000:9000 sonarqube:lts-community |
Access SonarQube at <Sonar-Server-IP>:9000
Login using:
Username: admin
Password: admin
Change the default password when prompted.
Login to Sonarqube using admin ID and password
User Name: admin
Password: admin
Click on Login and update the password
sonarqube setup is completed successfully.
6. Configure Tools on Jenkins Server
6.1 SonarQube Scanner Configuration
Go to Dashboard → Manage Jenkins → Tools:
Add a SonarQube Scanner installation named "sonar-scanner"
Install automatically from Maven Central
6.2 Maven Configuration
Add Maven installation:
Name: "maven3"
Install automatically from Apache
6.3 Docker Configuration
Add Docker installation:
Name: "docker"
Install automatically
Click on Apply and Save.
Click on Apply and Save.
7. Configure SonarQube Server on Jenkins
7.1 Generate Token in SonarQube
Go to SonarQube Server → Administration → Security → Users
Click on Tokens and Update Token
Create a token with a name and generate
Copy the generated token
7.2 Add Token to Jenkins Credentials
In Jenkins, go to Dashboard → Manage Jenkins → Credentials → Add Secret Text:
ID: sonar-token
Description: SonarQube Token
Secret: <Paste the token>
You will this page once you click on create
7.3 Add Docker Hub Credentials
Add Docker Hub credentials in Jenkins:
ID: docker-cred
Description: Docker Hub Credentials
Username: <Your Docker Hub username>
Password: <Your Docker Hub password>
7.4 Configure SonarQube in Jenkins
Go to Dashboard → Manage Jenkins → System:
Under SonarQube servers:
Select SonarQube installations
Click on Add SonarQube
Name: sonar
URL: <SonarQube server URL>
Select the sonar token credential
7.5 Add SonarQube Webhook
In SonarQube:
Go to Administration → Configuration → Webhooks
Click on Create
Add URL: http://<jenkins-public-ip>:8080/sonarqube-webhook/
Click on Create
Modify the POM.xml
8. Configure Nexus Repository
8.1 Modify pom.xml
Update maven-releases and maven-snapshots URLs in pom.xml under distributionManagement:
<distributionManagement> |
Before:
Copy maven-releases and maven-snapshots URLs from Nexus Repository
Goto Server administration and configuration → Repository → Repositories
Copy maven-releses URL
Update in pom.xml file
Similary copy maven-snapshots URL and update in pom.xml
After:
8.2 Provide Credentials for Nexus
In Jenkins, go to Dashboard → Manage Jenkins → Managed files:
Add a new Config of type Global Maven settings.xml
ID: settings-maven
Modify settings.xml to include server details:
Select Type as: Global Maven settings.xml
ID: Enter Any Name [here settings-maven]
Click on Next, It will provide the settings.xml file
Modify the Server details in settings.xml file
Before:
After:
<servers> |
Added maven-releases and maven-snapshots server details with Nexus repos user ID and Password to access Nexus and push the artifacts to the Nexus repository
Click on Submit, settings file is added successfully
9. Create Jenkins Pipeline
Go to Jenkins Dashboard
Click on New Item, enter a name and select Pipeline
Under General, select "Discard old builds" and set Max # of builds to keep: 2
Add the pipeline script:
click on Ok
Under General, select Discard old builds and
set Max # of builds to keep: 2
Start writing the pipeline
Jenkins Pipeline:
pipeline { |
Now we will be able to access the application Using Jenkins Server IP on port 5000.
Note: Use "adijaiswal/bankapp
" Docker image to ensure proper functionality.
Deploy Using Kubernetes
10.1 Server Setup for EKS
Launch an EC2 instance (t2.medium with 20GB storage)
Install AWS CLI:
bash
Copy
Connect to server and Update
Install AWS CLI on the Server
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" |
Create an AWS Credential, ACCESS KEY and SECRET ACCESS KEY to access AWS and create EKS cluster
Configure AWS with your access keys:
aws configure |
Install Terraform
sudo snap install terraform --classic |
Clone the EKS Terraform repository:
The cluster is created successfully
10.2 Configure RBAC for Kubernetes
mkdir RBAC
cd RBAC
- Install kubectl:
sudo snap install kubectl --classic |
- Update kubeconfig file:
aws eks --region ap-south-1 update-kubeconfig --name devopssubroto-cluster |
- Create namespace:
kubectl create namespace webapps |
- Create service account, role, and role binding: svc.yml:
apiVersion: v1 |
- role.yml:
apiVersion: rbac.authorization.k8s.io/v1 |
- Bind.yml:
apiVersion: rbac.authorization.k8s.io/v1 |
- Create a secret for the service account token: secret.yml:
apiVersion: v1 |
Apply the secret:
kubectl apply -f secret.yml -n webapps |
- Get the token:
kubectl describe secret mysecretname -n webapps |
- Add the token to Jenkins credentials as "k8s-token"
10.3 Create Kubernetes Deployment Files
Create ds.yml:
--- |
10.4 Install kubectl on Jenkins Server
Add these stages to your Jenkins pipeline:
pipeline { |
Now we will be able to access application using load balancer URL
Final Application:
11. Cleanup Resources
To destroy the EKS cluster when you're done:
terraform destroy --auto-approve |
Final Application
After successful deployment, you can access the application using the Load Balancer URL provided by AWS.
This document provides a comprehensive guide to setting up a complete CI/CD pipeline for a Bank Application using various DevOps tools. It covers everything from Jenkins setup to deployment on Kubernetes.
Subscribe to my newsletter
Read articles from Subroto Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Subroto Sharma
Subroto Sharma
I'm a passionate and results-driven DevOps Engineer with hands-on experience in automating infrastructure, optimizing CI/CD pipelines, and enhancing software delivery through modern DevOps and DevSecOps practices. My expertise lies in bridging the gap between development and operations to streamline workflows, increase deployment velocity, and ensure application security at every stage of the software lifecycle. I specialize in containerization with Docker and Kubernetes, infrastructure-as-code using Terraform, and managing scalable cloud environments—primarily on AWS. I’ve worked extensively with tools like Jenkins, GitHub Actions, SonarQube, Trivy, and various monitoring/logging stacks to build secure, efficient, and resilient systems. Driven by automation and a continuous improvement mindset, I aim to deliver value faster and more reliably by integrating cutting-edge tools and practices into development pipelines.