✨ Introduction

If you're a DevOps engineer or cloud practitioner in 2025, chances are Jenkins is part of your CI/CD toolbox. But setting it up—especially on AWS EC2—can feel like one of those tasks that should be simple... but quickly turns into a rabbit hole of outdated tutorials and frustrating permission errors.

Let’s fix that.

In this guide, you’ll learn exactly how to launch a secure, production-ready Jenkins instance on AWS EC2 — with zero fluff and no skipped steps.

Whether you're building a personal automation pipeline or deploying across teams, this walkthrough will help you go from EC2 launch to Jenkins dashboard in under 30 minutes.


🚀 What is Jenkins and Why Install It on EC2?

Jenkins at a Glance

Jenkins is one of the most powerful open-source automation servers. It helps developers build, test, and deploy code automatically. Think of it as your CI/CD command center.

Why Use AWS EC2 for Jenkins?

  • Full control over OS, ports, and access
  • Scalable compute with EC2 instance types
  • VPC and security group integration for secure deployments
  • Ideal for DevOps pros who want flexibility over convenience

🛠️ Prerequisites Before You Begin

Make sure you’ve got:

  • ✅ An AWS account with EC2 launch permissions
  • ✅ A registered domain (optional but useful)
  • ✅ Basic knowledge of SSH and Linux terminal
  • ✅ A security group that allows SSH (port 22) and HTTP (port 8080 or 80)

We’ll use Amazon Linux 2023 (AL2023) in this guide, but you can adapt for Ubuntu if preferred.


📦 Step-by-Step: Installing Jenkins on AWS EC2


🔹 Step 1: Launch an EC2 Instance

  1. Go to your AWS EC2 Dashboard

  2. Click Launch Instance

  3. Set the following:

    • AMI: Amazon Linux 2023 (or Ubuntu 22.04 LTS)

    • Instance type: t2.medium or t3.medium (min 2 vCPUs recommended)

    • Key pair: Create or select an existing one

    • Security group: Allow inbound on:

      • Port 22 (SSH)
      • Port 8080 (Jenkins default)
  4. Click Launch


🔹 Step 2: SSH Into Your Instance

Replace your-key.pem and public-ip with your actual values:

chmod 400 your-key.pem
ssh -i your-key.pem ec2-user@your-ec2-public-ip

🔹 Step 3: Install Java (Required for Jenkins)

Jenkins runs on Java. On Amazon Linux:

sudo yum update -y
sudo amazon-linux-extras enable corretto8
sudo yum install java-1.8.0-amazon-corretto -y

Verify with:

java -version

🔹 Step 4: Add Jenkins Repo and Install Jenkins

sudo wget -O /etc/yum.repos.d/jenkins.repo \
    https://pkg.jenkins.io/redhat-stable/jenkins.repo

sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo yum upgrade
sudo yum install jenkins -y

🔹 Step 5: Start and Enable Jenkins

sudo systemctl start jenkins
sudo systemctl enable jenkins

Check status:

sudo systemctl status jenkins

🔹 Step 6: Allow Jenkins Port (8080) in EC2

If you didn’t allow port 8080 when setting up the instance:

  1. Go to EC2 > Security Groups > Inbound Rules

  2. Add a new rule:

    • Type: Custom TCP
    • Port: 8080
    • Source: Anywhere or your IP

🔹 Step 7: Access Jenkins via Browser

Go to:

http://your-ec2-public-ip:8080

You’ll see the “Unlock Jenkins” screen.

Get your initial password:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Paste that into the browser and hit Continue.


🔹 Step 8: Install Recommended Plugins

Let Jenkins install the default recommended plugins. This takes a few minutes.

Once done, set up:

  • Admin username/password
  • Instance configuration (leave default)
  • Jenkins URL

Click Save and Finish. Jenkins is now ready to use!


🛡️ Optional: Secure Jenkins with NGINX and SSL (Bonus)

If you're planning to run this in production, expose Jenkins on port 80 or 443 with a domain.

Install NGINX:

sudo yum install nginx -y
sudo systemctl start nginx
sudo systemctl enable nginx

Create a Reverse Proxy:

Edit NGINX config:

sudo nano /etc/nginx/conf.d/jenkins.conf

Add:

server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Restart NGINX:

sudo systemctl restart nginx

Optional: Add Free SSL with Let's Encrypt

Use Certbot:

sudo yum install epel-release -y
sudo yum install certbot python3-certbot-nginx -y
sudo certbot --nginx

Follow the prompts to install a free SSL certificate.


🧠 CI/CD Use Cases You Can Now Build

Now that Jenkins is up and running, here’s what you can automate:

  • Build and test pipelines for GitHub or Bitbucket
  • Docker image builds and container deployments
  • Multi-stage deployments with Kubernetes or ECS
  • Slack/email alerts for failed builds
  • Scheduled jobs (nightly builds, code checks, etc.)

📌 Troubleshooting Tips

🔁 Jenkins Not Starting?

Check the logs:

sudo journalctl -u jenkins

🔒 Can't Access Port 8080?

Double-check your security group and local firewall.


🧱 Java Errors?

Ensure the right version is installed and environment variables are set.


⚡ Quick Takeaways

  • 🔧 Launch EC2 with port 8080 open
  • ☕ Install Java 8 (or 11) before Jenkins
  • 🧱 Use systemctl to start and enable Jenkins
  • 🌐 Set up NGINX + domain for secure access
  • 🔐 Add SSL for production environments
  • ⚙️ Use Jenkins for full CI/CD automation on AWS

📣 Call to Action

You’ve just unlocked the power of Jenkins on AWS EC2.

If you’re serious about building robust, automated DevOps pipelines—don’t stop here.

🚀 Let our cloud engineers at Ramlit Limited help you:

  • Optimize Jenkins for production
  • Integrate Docker, GitHub Actions, or Kubernetes
  • Monitor, secure, and scale your CI/CD workflows

👉 Contact Us Now for a free 15-minute consultation.


❓ FAQ: Installing Jenkins on AWS EC2

Q1: What instance size should I choose for Jenkins?

For light CI/CD usage, t2.medium is fine. For active pipelines or multiple agents, consider t3.large or higher.


Q2: Can I use Ubuntu instead of Amazon Linux?

Absolutely. Just adjust the package manager (use apt instead of yum) and install Java accordingly.


Q3: Is port 8080 safe for production?

No. Expose Jenkins via a reverse proxy (like NGINX) and secure with SSL for production use.


Q4: Can Jenkins run Docker builds on EC2?

Yes, just install Docker on the EC2 instance and add the Jenkins user to the Docker group.


Q5: Is Jenkins still relevant in 2025?

100%. Jenkins remains a flexible, powerful CI/CD tool—especially for teams that need deep customization or on-prem/cloud hybrid setups.