<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: parth patel</title>
    <description>The latest articles on DEV Community by parth patel (@parth2861866).</description>
    <link>https://dev.to/parth2861866</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3765120%2Fed9065af-d4ac-4bca-9009-9873e18464bd.png</url>
      <title>DEV Community: parth patel</title>
      <link>https://dev.to/parth2861866</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/parth2861866"/>
    <language>en</language>
    <item>
      <title>5 AWS Concepts Every Developer Should Know Before Touching EC2</title>
      <dc:creator>parth patel</dc:creator>
      <pubDate>Mon, 09 Mar 2026 17:45:34 +0000</pubDate>
      <link>https://dev.to/parth2861866/5-aws-concepts-every-developer-should-know-before-touching-ec2-2an5</link>
      <guid>https://dev.to/parth2861866/5-aws-concepts-every-developer-should-know-before-touching-ec2-2an5</guid>
      <description>&lt;p&gt;&lt;em&gt;You don't need to be a cloud architect — but knowing these 5 things will save you hours of pain.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;If you're jumping into AWS for the first time, it can feel overwhelming. Hundreds of services, confusing pricing, and a console that looks like a cockpit.&lt;/p&gt;

&lt;p&gt;But honestly? Most of what you need day-to-day comes down to 5 core concepts. Learn these and everything else starts to click.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. 🌐 VPC — Your Private Network in the Cloud
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt; is your own isolated section of AWS. Think of it as renting a floor in a massive building — other tenants are there, but they can't get into your space.&lt;/p&gt;

&lt;p&gt;Every resource you create (EC2, RDS, Lambda) lives inside a VPC. Always create a custom VPC instead of using the default one — it gives you full control over your network.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. 🔒 Security Groups — Your Firewall
&lt;/h2&gt;

&lt;p&gt;Security Groups control &lt;strong&gt;who can talk to your resources and on which ports&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The most important rule to remember:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Only open the ports you actually need. Nothing more.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, a web server only needs ports &lt;code&gt;80&lt;/code&gt; (HTTP), &lt;code&gt;443&lt;/code&gt; (HTTPS), and &lt;code&gt;22&lt;/code&gt; (SSH). Opening everything is the #1 beginner mistake that leads to getting hacked.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. 💻 EC2 — Your Virtual Server
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Elastic Compute Cloud (EC2)&lt;/strong&gt; is simply a virtual machine running in AWS. You pick the OS, the size, and the storage — and AWS runs it for you 24/7.&lt;/p&gt;

&lt;p&gt;Quick tip on instance sizes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;t2.micro&lt;/code&gt; → free tier, good for tiny projects&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;t2.medium&lt;/code&gt; → minimum for running Kubernetes&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;t3.large&lt;/code&gt; → comfortable for most production workloads&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. 🪣 S3 — Store Anything, Forever
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Simple Storage Service (S3)&lt;/strong&gt; is object storage — basically an infinitely large hard drive in the cloud. Use it for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storing images, videos, documents&lt;/li&gt;
&lt;li&gt;Hosting static websites&lt;/li&gt;
&lt;li&gt;Saving application backups&lt;/li&gt;
&lt;li&gt;Storing Terraform state files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's dirt cheap, incredibly reliable (99.999999999% durability), and integrates with almost every other AWS service.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. 🔑 IAM — Control Who Can Do What
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Identity and Access Management (IAM)&lt;/strong&gt; is how you control permissions in AWS.&lt;/p&gt;

&lt;p&gt;The golden rule of IAM:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Give every user and service the &lt;strong&gt;minimum permissions&lt;/strong&gt; they need — nothing extra.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Never use your root account for daily work. Create an IAM user with only the permissions you need. This single habit prevents the majority of AWS security incidents.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;These 5 services work together on almost every project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your App
   ↓
EC2 (runs your code)
   ↓
VPC + Security Groups (keeps it secure)
   ↓
S3 (stores your files)
   ↓
IAM (controls who can access what)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Master these and you'll have a solid foundation for everything else AWS throws at you — EKS, RDS, Lambda, you name it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Found this helpful? Drop a ❤️ and follow for more cloud and DevOps content. Questions? Drop them in the comments!&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;aws&lt;/code&gt; &lt;code&gt;cloud&lt;/code&gt; &lt;code&gt;devops&lt;/code&gt; &lt;code&gt;beginners&lt;/code&gt; &lt;code&gt;webdev&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How I Built an End-to-End DevOps Environment on AWS EC2 from Scratch</title>
      <dc:creator>parth patel</dc:creator>
      <pubDate>Mon, 09 Mar 2026 17:27:33 +0000</pubDate>
      <link>https://dev.to/parth2861866/how-i-built-an-end-to-end-devops-environment-on-aws-ec2-from-scratch-2i7l</link>
      <guid>https://dev.to/parth2861866/how-i-built-an-end-to-end-devops-environment-on-aws-ec2-from-scratch-2i7l</guid>
      <description>&lt;p&gt;&lt;em&gt;A beginner-friendly walkthrough of provisioning a real Kubernetes cluster, Jenkins CI/CD pipeline, and security tooling on AWS — step by step.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧭 What We're Building
&lt;/h2&gt;

&lt;p&gt;By the end of this guide you'll have a fully working DevOps environment running on AWS EC2 that includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;custom VPC&lt;/strong&gt; with security groups&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Kubernetes (v1.28) cluster&lt;/strong&gt; with 1 master + 2 worker nodes&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;Jenkins CI/CD pipeline&lt;/strong&gt; that takes code from commit all the way to production&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SonarQube&lt;/strong&gt; for automated code quality analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kubeaudit&lt;/strong&gt; for Kubernetes security scanning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nexus Repository Manager&lt;/strong&gt; for artifact versioning&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt; for containerizing and pushing images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the exact setup I built for a real project — so everything here is battle-tested.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we start, make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;AWS account&lt;/strong&gt; (free tier works for learning)&lt;/li&gt;
&lt;li&gt;Basic familiarity with the &lt;strong&gt;Linux command line&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH client&lt;/strong&gt; installed (Terminal on Mac/Linux, PuTTY or WSL on Windows)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it. You don't need to be a DevOps expert — that's what this guide is for.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1 — Create Your VPC and Security Groups
&lt;/h2&gt;

&lt;p&gt;The first thing we need is a &lt;strong&gt;Virtual Private Cloud (VPC)&lt;/strong&gt; — think of it as your own private network inside AWS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Create the VPC
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;AWS Console → VPC → Create VPC&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Set the IPv4 CIDR block to &lt;code&gt;10.0.0.0/16&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Give it a name like &lt;code&gt;devops-vpc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Create a Subnet
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Subnets → Create Subnet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Select your new VPC&lt;/li&gt;
&lt;li&gt;Set CIDR to &lt;code&gt;10.0.1.0/24&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Choose an availability zone (e.g. &lt;code&gt;us-east-1a&lt;/code&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Set Up Security Groups
&lt;/h3&gt;

&lt;p&gt;This is important — we need to open specific ports for our tools to communicate.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;Security Groups → Create Security Group&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add these &lt;strong&gt;Inbound Rules&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Port&lt;/th&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;22&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;SSH access&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6443&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;Kubernetes API server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8080&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;Jenkins web UI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8081&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;Nexus Repository Manager&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9000&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;SonarQube&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;30000-32767&lt;/td&gt;
&lt;td&gt;TCP&lt;/td&gt;
&lt;td&gt;Kubernetes NodePort services&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Tip:&lt;/strong&gt; For learning purposes you can set the source to &lt;code&gt;0.0.0.0/0&lt;/code&gt;. For production, always restrict to your IP.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Step 2 — Launch Your EC2 Instances
&lt;/h2&gt;

&lt;p&gt;We need &lt;strong&gt;3 EC2 instances&lt;/strong&gt; — one master node and two worker nodes for Kubernetes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Launch Each Instance
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;EC2 → Launch Instance&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Ubuntu 22.04 LTS&lt;/strong&gt; as the AMI&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;t2.medium&lt;/strong&gt; (2 vCPU, 4GB RAM) — minimum for Kubernetes&lt;/li&gt;
&lt;li&gt;Select your VPC and subnet from Step 1&lt;/li&gt;
&lt;li&gt;Attach your security group&lt;/li&gt;
&lt;li&gt;Create or use an existing &lt;strong&gt;key pair&lt;/strong&gt; (.pem file) for SSH&lt;/li&gt;
&lt;li&gt;Launch&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Repeat this &lt;strong&gt;3 times&lt;/strong&gt; — name them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;k8s-master&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k8s-worker-1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;k8s-worker-2&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Connect via SSH
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;400 your-key.pem
ssh &lt;span class="nt"&gt;-i&lt;/span&gt; your-key.pem ubuntu@&amp;lt;YOUR_EC2_PUBLIC_IP&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 3 — Set Up Kubernetes with Kubeadm
&lt;/h2&gt;

&lt;p&gt;Run these commands on &lt;strong&gt;all 3 nodes&lt;/strong&gt; first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Dependencies (all nodes)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Update packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Install Docker&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; docker.io
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;docker
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start docker

&lt;span class="c"&gt;# Install Kubernetes tools&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; apt-transport-https ca-certificates curl
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | &lt;span class="nb"&gt;sudo &lt;/span&gt;gpg &lt;span class="nt"&gt;--dearmor&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; /etc/apt/keyrings/kubernetes-apt-keyring.gpg
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /'&lt;/span&gt; | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/sources.list.d/kubernetes.list

&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; kubelet kubeadm kubectl
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-mark hold kubelet kubeadm kubectl

&lt;span class="c"&gt;# Disable swap (required by Kubernetes)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;swapoff &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;span class="nb"&gt;sudo sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'/ swap / s/^\(.*\)$/#\1/g'&lt;/span&gt; /etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Initialize the Master Node
&lt;/h3&gt;

&lt;p&gt;Run this &lt;strong&gt;only on the master node&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;kubeadm init &lt;span class="nt"&gt;--pod-network-cidr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;10.244.0.0/16

&lt;span class="c"&gt;# Set up kubectl for your user&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.kube
&lt;span class="nb"&gt;sudo cp&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; /etc/kubernetes/admin.conf &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.kube/config
&lt;span class="nb"&gt;sudo chown&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;:&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;$HOME&lt;/span&gt;/.kube/config

&lt;span class="c"&gt;# Install Flannel network plugin&lt;/span&gt;
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After &lt;code&gt;kubeadm init&lt;/code&gt; completes, you'll see a &lt;code&gt;kubeadm join&lt;/code&gt; command. &lt;strong&gt;Copy it&lt;/strong&gt; — you'll need it for the worker nodes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Join the Worker Nodes
&lt;/h3&gt;

&lt;p&gt;Run the join command on &lt;strong&gt;each worker node&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;kubeadm &lt;span class="nb"&gt;join&lt;/span&gt; &amp;lt;MASTER_IP&amp;gt;:6443 &lt;span class="nt"&gt;--token&lt;/span&gt; &amp;lt;TOKEN&amp;gt; &lt;span class="nt"&gt;--discovery-token-ca-cert-hash&lt;/span&gt; sha256:&amp;lt;HASH&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verify Your Cluster
&lt;/h3&gt;

&lt;p&gt;Back on the master node:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get nodes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see all 3 nodes with status &lt;code&gt;Ready&lt;/code&gt;. 🎉&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4 — Install Jenkins
&lt;/h2&gt;

&lt;p&gt;Run this on your &lt;strong&gt;master node&lt;/strong&gt; (or a dedicated EC2 instance):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Java (required by Jenkins)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; openjdk-21-jdk

&lt;span class="c"&gt;# Add Jenkins repo&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /usr/share/keyrings/jenkins-keyring.asc &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;span class="nb"&gt;echo &lt;/span&gt;deb &lt;span class="o"&gt;[&lt;/span&gt;signed-by&lt;span class="o"&gt;=&lt;/span&gt;/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | &lt;span class="nb"&gt;sudo tee&lt;/span&gt; /etc/apt/sources.list.d/jenkins.list &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null

&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; jenkins
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;jenkins
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start jenkins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open Jenkins in your browser at &lt;code&gt;http://&amp;lt;YOUR_EC2_IP&amp;gt;:8080&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Get the initial admin password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo cat&lt;/span&gt; /var/lib/jenkins/secrets/initialAdminPassword
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Required Jenkins Plugins
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;Manage Jenkins → Plugins&lt;/strong&gt; and install:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker Pipeline&lt;/li&gt;
&lt;li&gt;Kubernetes CLI&lt;/li&gt;
&lt;li&gt;Maven Integration&lt;/li&gt;
&lt;li&gt;SonarQube Scanner&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 5 — Set Up SonarQube
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Run SonarQube via Docker (easiest way)&lt;/span&gt;
docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; sonarqube &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 9000:9000 &lt;span class="se"&gt;\&lt;/span&gt;
  sonarqube:community
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;code&gt;http://&amp;lt;YOUR_EC2_IP&amp;gt;:9000&lt;/code&gt; — default login is &lt;code&gt;admin / admin&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Connect SonarQube to Jenkins
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;In SonarQube go to &lt;strong&gt;Administration → Security → Generate Token&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Copy the token&lt;/li&gt;
&lt;li&gt;In Jenkins go to &lt;strong&gt;Manage Jenkins → Credentials → Add&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Add the token as a &lt;strong&gt;Secret Text&lt;/strong&gt; credential named &lt;code&gt;sonar-token&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 6 — Set Up Nexus Repository Manager
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; nexus &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 8081:8081 &lt;span class="se"&gt;\&lt;/span&gt;
  sonatype/nexus3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open &lt;code&gt;http://&amp;lt;YOUR_EC2_IP&amp;gt;:8081&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Get the admin password:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;exec &lt;/span&gt;nexus &lt;span class="nb"&gt;cat&lt;/span&gt; /nexus-data/admin.password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nexus will store your built artifacts (JAR files, Docker images) so every build is versioned and traceable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 7 — Create Your Jenkins Pipeline
&lt;/h2&gt;

&lt;p&gt;Create a file called &lt;code&gt;Jenkinsfile&lt;/code&gt; in the root of your project repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight groovy"&gt;&lt;code&gt;&lt;span class="n"&gt;pipeline&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="n"&gt;any&lt;/span&gt;

    &lt;span class="n"&gt;tools&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;jdk&lt;/span&gt; &lt;span class="s1"&gt;'JDK21'&lt;/span&gt;
        &lt;span class="n"&gt;maven&lt;/span&gt; &lt;span class="s1"&gt;'Maven3'&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;stages&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Checkout'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;git&lt;/span&gt; &lt;span class="nl"&gt;branch:&lt;/span&gt; &lt;span class="s1"&gt;'main'&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;url:&lt;/span&gt; &lt;span class="s1"&gt;'https://github.com/YOUR_USERNAME/YOUR_REPO.git'&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Build'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'mvn clean package -DskipTests'&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SonarQube Analysis'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;withSonarQubeEnv&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'SonarQube'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                    &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'mvn sonar:sonar'&lt;/span&gt;
                &lt;span class="o"&gt;}&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Build Docker Image'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'docker build -t your-app:${BUILD_NUMBER} .'&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'docker tag your-app:${BUILD_NUMBER} your-registry/your-app:${BUILD_NUMBER}'&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Push to Nexus'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'mvn deploy'&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;stage&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Deploy to Kubernetes'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'kubectl apply -f k8s/deployment.yaml'&lt;/span&gt;
                &lt;span class="n"&gt;sh&lt;/span&gt; &lt;span class="s1"&gt;'kubectl set image deployment/your-app your-app=your-registry/your-app:${BUILD_NUMBER}'&lt;/span&gt;
            &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;post&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;success&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'✅ Pipeline completed successfully!'&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;failure&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'❌ Pipeline failed — check the logs above.'&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Step 8 — Security Scanning with Kubeaudit
&lt;/h2&gt;

&lt;p&gt;Kubeaudit scans your Kubernetes cluster for common security issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install Kubeaudit&lt;/span&gt;
wget https://github.com/Shopify/kubeaudit/releases/latest/download/kubeaudit_linux_amd64.tar.gz
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzf&lt;/span&gt; kubeaudit_linux_amd64.tar.gz
&lt;span class="nb"&gt;sudo mv &lt;/span&gt;kubeaudit /usr/local/bin/

&lt;span class="c"&gt;# Run a full audit&lt;/span&gt;
kubeaudit all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common issues it will flag:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Missing &lt;strong&gt;NetworkPolicies&lt;/strong&gt; (controls traffic between pods)&lt;/li&gt;
&lt;li&gt;Missing &lt;strong&gt;AppArmor&lt;/strong&gt; annotations&lt;/li&gt;
&lt;li&gt;Containers running as root&lt;/li&gt;
&lt;li&gt;Missing resource limits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fix them one by one — each fix makes your cluster significantly more secure.&lt;/p&gt;




&lt;h2&gt;
  
  
  🎉 What You've Built
&lt;/h2&gt;

&lt;p&gt;Congratulations! You now have a production-grade DevOps environment that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Automatically builds&lt;/strong&gt; your code on every commit&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scans for bugs&lt;/strong&gt; with SonarQube before deploying&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stores versioned artifacts&lt;/strong&gt; in Nexus&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploys to Kubernetes&lt;/strong&gt; with zero downtime&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audits security&lt;/strong&gt; with Kubeaudit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the kind of infrastructure that runs real production workloads at companies around the world.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Key Lessons I Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Security groups matter&lt;/strong&gt; — always be intentional about which ports are open&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap must be disabled&lt;/strong&gt; before Kubernetes will work — I learned this the hard way&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kubeaudit catches things you'd never think of&lt;/strong&gt; — run it early, not after you deploy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nexus + versioned artifacts&lt;/strong&gt; means you can always roll back to any previous build&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🔗 What's Next?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Add &lt;strong&gt;Terraform&lt;/strong&gt; to provision all of this infrastructure as code&lt;/li&gt;
&lt;li&gt;Set up &lt;strong&gt;Prometheus + Grafana&lt;/strong&gt; for monitoring your cluster&lt;/li&gt;
&lt;li&gt;Configure &lt;strong&gt;automatic SSL&lt;/strong&gt; with cert-manager&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;Helm charts&lt;/strong&gt; for cleaner Kubernetes deployments&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Thanks for reading! If this helped you, drop a ❤️ and follow for more DevOps content. Feel free to ask questions in the comments — I'm happy to help.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;code&gt;devops&lt;/code&gt; &lt;code&gt;kubernetes&lt;/code&gt; &lt;code&gt;aws&lt;/code&gt; &lt;code&gt;jenkins&lt;/code&gt; &lt;code&gt;docker&lt;/code&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>kubernetes</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
