<?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>Forem: Suraj</title>
    <description>The latest articles on Forem by Suraj (@surajkumar00).</description>
    <link>https://forem.com/surajkumar00</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%2F1165662%2F9c2dce48-9960-4a6c-9abb-d04cc8a69bf5.jpeg</url>
      <title>Forem: Suraj</title>
      <link>https://forem.com/surajkumar00</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/surajkumar00"/>
    <language>en</language>
    <item>
      <title>Fix Wrong Authors Commits the Safe Way Using Git Rebase</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Sun, 05 Oct 2025 13:51:30 +0000</pubDate>
      <link>https://forem.com/surajkumar00/fix-wrong-authors-commits-the-safe-way-using-git-rebase-12e0</link>
      <guid>https://forem.com/surajkumar00/fix-wrong-authors-commits-the-safe-way-using-git-rebase-12e0</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Ever committed code with the wrong Git author? Whether you're juggling personal and work accounts or just forgot to configure your identity in a new project, this happens to the best of us. The good news? &lt;strong&gt;You can fix it safely&lt;/strong&gt; and in this guide, we'll do it the smart way using a Docker sandbox plus real GitHub practice.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You'll Learn
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Git rebase fundamentals&lt;/strong&gt; (interactive mode explained simply)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three real-world scenarios&lt;/strong&gt; for fixing wrong authors&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safe Docker lab environment&lt;/strong&gt; (no risk to your actual Git setup)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hands-on GitHub practice&lt;/strong&gt; (see the fixes in action)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why This Approach Works
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Docker Container:&lt;/strong&gt; Keeps your global Git config safe while you experiment&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real GitHub Repo:&lt;/strong&gt; See the actual before/after results in GitHub's UI&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Progressive Scenarios:&lt;/strong&gt; From simple local fixes to complex merged commits&lt;/p&gt;

&lt;p&gt;We'll simulate this common mistake:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global user (wrong)&lt;/strong&gt; → &lt;code&gt;surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt;&lt;/code&gt; → You have made commit with this&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repo user (correct)&lt;/strong&gt; → &lt;code&gt;surajdevops &amp;lt;surajdevops@example.com&amp;gt;&lt;/code&gt; → But you should have made the commit with this.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Git Rebase : The Foundation
&lt;/h2&gt;

&lt;p&gt;Before diving into &lt;strong&gt;fixes&lt;/strong&gt;, let's understand &lt;strong&gt;why we use Git rebase&lt;/strong&gt; for &lt;strong&gt;author corrections&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Git Rebase?
&lt;/h3&gt;

&lt;p&gt;Takes your commits and replays them on top of another branch, creating a &lt;strong&gt;straight line history&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;git rebase main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moves your commits to the tip of main branch&lt;/li&gt;
&lt;li&gt;Creates &lt;strong&gt;new commit IDs&lt;/strong&gt; (rewrites history)&lt;/li&gt;
&lt;li&gt;Makes history look like you worked on the latest code all along&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is Git Merge?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Git Merge&lt;/strong&gt; = Combines two branches by creating a &lt;strong&gt;merge commit&lt;/strong&gt; that joins them together.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What it does:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeps &lt;strong&gt;original commits unchanged&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Creates one new "merge commit"&lt;/li&gt;
&lt;li&gt;Preserves the branching structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When to Use?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Merge:&lt;/strong&gt; When working with others on the same branch&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rebase:&lt;/strong&gt; When cleaning up your local commits before opening a PR&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Golden Rule:&lt;/strong&gt; Never rebase shared branches!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Interactive Rebase for Fixes?
&lt;/h2&gt;

&lt;p&gt;If you only need to fix the &lt;strong&gt;latest commit&lt;/strong&gt;, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Correct Name &amp;lt;correct@email.com&amp;gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But if the wrong author is &lt;strong&gt;buried in the middle&lt;/strong&gt; of history, you need to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Stop at that specific commit&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fix the author information&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Replay the remaining commits&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's exactly what &lt;code&gt;git rebase -i&lt;/code&gt; (interactive rebase) does!&lt;/p&gt;

&lt;h2&gt;
  
  
  Rebase vs Merge: Quick Comparison
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Merge&lt;/strong&gt; = Combines two branches while preserving original commit history&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rebase&lt;/strong&gt; = Replays commits on a new base, rewriting history for a clean linear timeline&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Interactive Rebase: What Happens Under the Hood
&lt;/h3&gt;

&lt;p&gt;When you run &lt;code&gt;git rebase -i HEAD~3&lt;/code&gt;, here's the journey:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1j9hk1ivvegdhdmcdyr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk1j9hk1ivvegdhdmcdyr.png" alt="image" width="800" height="652"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Visual: Before &amp;amp; After (Actual Git Output)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Before (wrong author on commits):&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="nv"&gt;$ &lt;/span&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;format:&lt;span class="s1"&gt;'%h - %an &amp;lt;%ae&amp;gt; - %s'&lt;/span&gt;
&lt;span class="k"&gt;*&lt;/span&gt; 9a3f8d2 - surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; - Add gitignore
&lt;span class="k"&gt;*&lt;/span&gt; 7b2c4e1 - surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; - Add main application file
&lt;span class="k"&gt;*&lt;/span&gt; 5d1a3b9 - surajdevops &amp;lt;surajdevops@example.com&amp;gt; - Initial commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice commits &lt;code&gt;9a3f8d2&lt;/code&gt; and &lt;code&gt;7b2c4e1&lt;/code&gt; have the &lt;strong&gt;wrong author&lt;/strong&gt; (surajdeveloper).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;During interactive rebase:&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="nv"&gt;$ &lt;/span&gt;git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~3
&lt;span class="c"&gt;# Editor opens showing:&lt;/span&gt;
pick 5d1a3b9 Initial commit
pick 7b2c4e1 Add main application file
pick 9a3f8d2 Add gitignore

&lt;span class="c"&gt;# You change it to:&lt;/span&gt;
pick 5d1a3b9 Initial commit
edit 7b2c4e1 Add main application file  &lt;span class="c"&gt;# &amp;lt;- mark as edit&lt;/span&gt;
edit 9a3f8d2 Add gitignore              &lt;span class="c"&gt;# &amp;lt;- mark as edit&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;After fixing with rebase + amend:&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="nv"&gt;$ &lt;/span&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;format:&lt;span class="s1"&gt;'%h - %an &amp;lt;%ae&amp;gt; - %s'&lt;/span&gt;
&lt;span class="k"&gt;*&lt;/span&gt; 2f8a9c5 - surajdevops &amp;lt;surajdevops@example.com&amp;gt; - Add gitignore
&lt;span class="k"&gt;*&lt;/span&gt; 4e7b3d1 - surajdevops &amp;lt;surajdevops@example.com&amp;gt; - Add main application file
&lt;span class="k"&gt;*&lt;/span&gt; 5d1a3b9 - surajdevops &amp;lt;surajdevops@example.com&amp;gt; - Initial commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ All commits now show the &lt;strong&gt;correct author&lt;/strong&gt; (surajdevops)!&lt;/p&gt;

&lt;p&gt;⚠️ Note: The commit hashes changed (9a3f8d2 → 2f8a9c5) because we rewrote history.&lt;/p&gt;

&lt;h2&gt;
  
  
  🐳 Setting Up Your Docker Git Lab: Let's do it hands-on
&lt;/h2&gt;

&lt;p&gt;Let's create a completely isolated environment for safe experimentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build &amp;amp; Run the Lab with the Docker image and clone the GitHub repo:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Image:&lt;/strong&gt; &lt;a href="https://hub.docker.com/r/surajkumar00/git-rebase-lab" rel="noopener noreferrer"&gt;https://hub.docker.com/r/surajkumar00/git-rebase-lab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GitHub repo:&lt;/strong&gt; &lt;a href="https://github.com/Suraj-kumar00/learn-git" rel="noopener noreferrer"&gt;https://github.com/Suraj-kumar00/learn-git&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Run interactive container
&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;# Run interactive container&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; surajkumar00/git-rebase-lab

git clone https://github.com/Suraj-kumar00/learn-git.git
&lt;span class="nb"&gt;cd &lt;/span&gt;learn-git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You're now inside a clean Ubuntu container and GitHub repo with Git ready to go!&lt;/p&gt;

&lt;h2&gt;
  
  
  Lab Exercise: Creating the Problem
&lt;/h2&gt;

&lt;p&gt;Let's simulate the real-world scenario where you accidentally use the wrong Git identity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 0: Create a feature branch
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; feature

&lt;span class="c"&gt;# Check the branch&lt;/span&gt;
git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 1: Set Wrong Global Identity
&lt;/h3&gt;

&lt;p&gt;Inside the Docker container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"surajdeveloper"&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"surajdeveloper@example.com"&lt;/span&gt;

&lt;span class="c"&gt;# Verify it's set&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; &lt;span class="nt"&gt;--list&lt;/span&gt;
&lt;span class="c"&gt;# or&lt;/span&gt;
git config &lt;span class="nt"&gt;--list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Let's make some Commits
&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;echo&lt;/span&gt; &lt;span class="s2"&gt;"console.log('Hello World');"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; app.js
git add app.js
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add main javascript application file"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"print('Hello World')"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; main.py
git add main.py
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add main python application file"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"node_modules/"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .gitignore
git add .gitignore
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add gitignore"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Check the Damage
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log

&lt;span class="c"&gt;# or&lt;/span&gt;

git log &lt;span class="nt"&gt;--oneline&lt;/span&gt;

&lt;span class="c"&gt;# or&lt;/span&gt;

git log &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;format:&lt;span class="s2"&gt;"%h %an &amp;lt;%ae&amp;gt; %s"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output shows all commits have the wrong author:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;a1b2c3d surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Add gitignore
b4c5d6e surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Add main python application file
c7d8e9f surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Add main javascript application file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Set Correct Repo-Level Identity
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config user.name &lt;span class="s2"&gt;"surajdevops"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"surajdevops@example.com"&lt;/span&gt;

&lt;span class="c"&gt;# Verify repo config overrides global&lt;/span&gt;
git config user.name
git config user.email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;New commits will now use the correct author, but what about the existing ones?&lt;/p&gt;

&lt;h2&gt;
  
  
  Scenario 1: Fix Local Commits (Before Push)
&lt;/h2&gt;

&lt;p&gt;This is the &lt;strong&gt;safest scenario&lt;/strong&gt; — commits exist only on your local machine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interactive Rebase in Action
&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;# Start interactive rebase for last 3 commits&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This opens your editor with something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pick c7d8e9f Add main javascript application file
pick b4c5d6e Add main python application file
pick a1b2c3d Add gitignore

&lt;span class="c"&gt;# Commands:&lt;/span&gt;
&lt;span class="c"&gt;# p, pick &amp;lt;commit&amp;gt; = use commit&lt;/span&gt;
&lt;span class="c"&gt;# e, edit &amp;lt;commit&amp;gt; = use commit, but stop for amending&lt;/span&gt;
&lt;span class="c"&gt;# r, reword &amp;lt;commit&amp;gt; = use commit, but edit the commit message&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Mark Commits for Editing
&lt;/h3&gt;

&lt;p&gt;Change &lt;code&gt;pick&lt;/code&gt; to &lt;code&gt;edit&lt;/code&gt; for commits you want to fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;edit c7d8e9f Add main javascript application file
edit b4c5d6e Add main python application file
edit a1b2c3d Add gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save and exit (in vim: &lt;code&gt;esc&lt;/code&gt; &lt;code&gt;shift+:&lt;/code&gt; press &lt;code&gt;x&lt;/code&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix Each Commit
&lt;/h3&gt;

&lt;p&gt;Git will stop at each commit marked for editing:&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;# When Git pauses at first commit&lt;/span&gt;
git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"surajdevops &amp;lt;surajdevops@example.com&amp;gt;"&lt;/span&gt; &lt;span class="nt"&gt;--no-edit&lt;/span&gt;

&lt;span class="c"&gt;# Continue to next commit&lt;/span&gt;
git rebase &lt;span class="nt"&gt;--continue&lt;/span&gt;

&lt;span class="c"&gt;# Repeat for each commit Git stops at&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Verify the Fix
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;format:&lt;span class="s2"&gt;"%h %an &amp;lt;%ae&amp;gt; %s"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now all commits show the correct author! ✅&lt;/p&gt;

&lt;h2&gt;
  
  
  Scenario 1.1: Fix Initial Commit (Including Root)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Special case:&lt;/strong&gt; What if the &lt;strong&gt;initial commit&lt;/strong&gt; also has the wrong author? Regular &lt;code&gt;HEAD~N&lt;/code&gt; won't include the root commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Problem: Initial Commit Has Wrong Author
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;format:&lt;span class="s2"&gt;"%h %an &amp;lt;%ae&amp;gt; %s"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output shows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;a1b2c3d surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Add gitignore
b4c5d6e surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Add main python application file
c7d8e9f surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Add main javascript application file
d8e9f0g surajdeveloper &amp;lt;surajdeveloper@example.com&amp;gt; Initial commit  ← WRONG!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Solution: Use &lt;code&gt;-root&lt;/code&gt; Flag
&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;# Include the initial commit in interactive rebase&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;--root&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This opens the editor with &lt;strong&gt;ALL commits&lt;/strong&gt; including the root:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pick d8e9f0g Initial commit          ← Root commit included!
pick c7d8e9f Add main javascript application file
pick b4c5d6e Add main python application file
pick a1b2c3d Add gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Mark Commits (Including Root) for Editing
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;edit d8e9f0g Initial commit          ← Fix the root!
edit c7d8e9f Add main javascript application file
edit b4c5d6e Add main python application file
edit a1b2c3d Add gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Fix Each Commit (Same Process)
&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;# Git stops at root commit first&lt;/span&gt;
git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"surajdevops &amp;lt;surajdevops@example.com&amp;gt;"&lt;/span&gt; &lt;span class="nt"&gt;--no-edit&lt;/span&gt;
git rebase &lt;span class="nt"&gt;--continue&lt;/span&gt;

&lt;span class="c"&gt;# Continue for each subsequent commit...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why &lt;code&gt;-root&lt;/code&gt; is Essential
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Regular rebase&lt;/strong&gt; (&lt;code&gt;HEAD~4&lt;/code&gt;) excludes the initial commit&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Root rebase&lt;/strong&gt; (&lt;code&gt;-root&lt;/code&gt;) includes &lt;strong&gt;everything&lt;/strong&gt; from the beginning&lt;/li&gt;
&lt;li&gt;This is the &lt;strong&gt;only way&lt;/strong&gt; to edit the initial commit's author&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scenario 2: Wrong Author Already Pushed (Branch Not Merged)
&lt;/h2&gt;

&lt;p&gt;If you've already pushed the commits to a feature branch (but not merged to main), you can still fix them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setup: Push to Remote Branch
&lt;/h3&gt;

&lt;p&gt;First, let's simulate this scenario:&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;# Create a feature branch (if not already on one)&lt;/span&gt;
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; feature/user-auth

&lt;span class="c"&gt;# Push to remote (if you have access to push)&lt;/span&gt;
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/user-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Fix and Force Push
&lt;/h3&gt;

&lt;p&gt;After fixing the commits locally (using the same rebase process above):&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;# Force push the corrected history&lt;/span&gt;
git push origin feature/user-auth &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;⚠️ Important Warnings:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only force push if &lt;strong&gt;you own the branch&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Coordinate with your team&lt;/strong&gt; before rewriting pushed history&lt;/li&gt;
&lt;li&gt;Never force push to &lt;code&gt;main&lt;/code&gt; or &lt;code&gt;master&lt;/code&gt; without team agreement&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scenario 3: Wrong Author Already Merged to Main
&lt;/h2&gt;

&lt;p&gt;This is the &lt;strong&gt;most complex scenario&lt;/strong&gt;. Once commits are merged into the main branch, rewriting history becomes dangerous.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: Accept and Document (✅ Recommended)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Best practice&lt;/strong&gt; → Don't rewrite main branch history. Instead, add documentation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;--allow-empty&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"docs: commits abc123-def456 were authored by surajdevops, not surajdeveloper"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option 2: Rewrite Main (⚠️ Dangerous)
&lt;/h3&gt;

&lt;p&gt;Only do this if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your &lt;strong&gt;entire team agrees&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You can coordinate a &lt;strong&gt;synchronized reset&lt;/strong&gt; for all team members&lt;/li&gt;
&lt;li&gt;The repository is &lt;strong&gt;not public&lt;/strong&gt; or widely used
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Fix commits using rebase&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~5  &lt;span class="c"&gt;# Adjust number as needed&lt;/span&gt;

&lt;span class="c"&gt;# Force push main (DANGEROUS!)&lt;/span&gt;
git push origin main &lt;span class="nt"&gt;--force&lt;/span&gt;

&lt;span class="c"&gt;# All team members must then:&lt;/span&gt;
&lt;span class="c"&gt;# git fetch origin&lt;/span&gt;
&lt;span class="c"&gt;# git reset --hard origin/main&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Advanced Tips &amp;amp; Best Practices
&lt;/h2&gt;

&lt;p&gt;For this you can read my this blog &lt;a href="https://surajk00.hashnode.dev/managing-multiple-githubgit-accounts-on-one-machine-personal-work" rel="noopener noreferrer"&gt;&lt;strong&gt;Managing Multiple GitHub/Git Accounts on One Machine (Personal + Work)&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Prevent Future Mistakes
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set repo-specific config&lt;/strong&gt; immediately in new projects:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Right after git clone or git init&lt;/span&gt;
git config user.name &lt;span class="s2"&gt;"Your Correct Name"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"your.correct@email.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create Git aliases&lt;/strong&gt; for quick identity switching:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add to ~/.gitconfig&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; alias.work &lt;span class="s1"&gt;'config user.email "work@company.com"'&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; alias.personal &lt;span class="s1"&gt;'config user.email "personal@gmail.com"'&lt;/span&gt;

&lt;span class="c"&gt;# Usage: git work or git personal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  When NOT to Rewrite History
&lt;/h3&gt;

&lt;p&gt;Never rewrite history when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;❌ Commits already merged to main/master&lt;/li&gt;
&lt;li&gt;❌ Public repositories with external contributors&lt;/li&gt;
&lt;li&gt;❌ Other team members have based work on your commits&lt;/li&gt;
&lt;li&gt;❌ CI/CD systems have already processed the commits&lt;/li&gt;
&lt;li&gt;❌ The commits have been tagged for a release&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Reference: Rebase Commands
&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;# Fix last commit only&lt;/span&gt;
git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Name &amp;lt;email&amp;gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Fix multiple recent commits&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~N  &lt;span class="c"&gt;# N = number of commits&lt;/span&gt;

&lt;span class="c"&gt;# Fix commits including the initial commit&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;--root&lt;/span&gt;

&lt;span class="c"&gt;# Fix commits after specific commit&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; abc123^  &lt;span class="c"&gt;# abc123 = commit hash&lt;/span&gt;

&lt;span class="c"&gt;# Abort rebase if something goes wrong&lt;/span&gt;
git rebase &lt;span class="nt"&gt;--abort&lt;/span&gt;

&lt;span class="c"&gt;# Skip a problematic commit during rebase&lt;/span&gt;
git rebase &lt;span class="nt"&gt;--skip&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Complete Setup Commands Summary
&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;# 1. Run the Docker lab&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;--rm&lt;/span&gt; surajkumar00/git-rebase-lab

&lt;span class="c"&gt;# 2. Clone the practice repo&lt;/span&gt;
git clone https://github.com/Suraj-kumar00/learn-git.git
&lt;span class="nb"&gt;cd &lt;/span&gt;learn-git

&lt;span class="c"&gt;# 3. Create feature branch&lt;/span&gt;
git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; feature

&lt;span class="c"&gt;# 4. Set wrong identity and create commits&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"surajdeveloper"&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"surajdeveloper@example.com"&lt;/span&gt;

&lt;span class="c"&gt;# 5. Make commits (will have wrong author)&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"console.log('Hello World');"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; app.js &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git add app.js &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add main javascript application file"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"print('Hello World')"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; main.py &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git add main.py &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add main python application file"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"node_modules/"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .gitignore &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git add .gitignore &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add gitignore"&lt;/span&gt;

&lt;span class="c"&gt;# 6. Set correct identity&lt;/span&gt;
git config user.name &lt;span class="s2"&gt;"surajdevops"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"surajdevops@example.com"&lt;/span&gt;

&lt;span class="c"&gt;# 7. Fix the commits&lt;/span&gt;

&lt;span class="c"&gt;# or git rebase -i --root for initial commit&lt;/span&gt;
git rebase &lt;span class="nt"&gt;-i&lt;/span&gt; HEAD~3

&lt;span class="c"&gt;# Change 'pick' to 'edit', then for each commit:&lt;/span&gt;
git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;--author&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"surajdevops &amp;lt;surajdevops@example.com&amp;gt;"&lt;/span&gt; &lt;span class="nt"&gt;--no-edit&lt;/span&gt;
git rebase &lt;span class="nt"&gt;--continue&lt;/span&gt;

&lt;span class="c"&gt;# 8. Verify the fix&lt;/span&gt;
git log &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;format:&lt;span class="s2"&gt;"%h %an &amp;lt;%ae&amp;gt; %s"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Your Next Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure proper Git identities&lt;/strong&gt; in all your current projects to prevent future mistakes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share this guide&lt;/strong&gt; with your team to prevent future author mix-ups&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt;: Git is powerful, but with great power comes great responsibility hehe. Always practice in safe environments before applying these techniques to important repositories!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Happy rebasing!&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Found this helpful? Star the practice repo and share with your team! Questions or improvements? Open an issue on the above GitHub repo.&lt;/p&gt;

</description>
      <category>git</category>
      <category>tutorial</category>
      <category>docker</category>
      <category>github</category>
    </item>
    <item>
      <title>Why NGINX Still Powers the Modern Web in 2025: Part 1</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Wed, 27 Aug 2025 16:13:46 +0000</pubDate>
      <link>https://forem.com/surajkumar00/why-nginx-still-powers-the-modern-web-in-2025-part-1-8g8</link>
      <guid>https://forem.com/surajkumar00/why-nginx-still-powers-the-modern-web-in-2025-part-1-8g8</guid>
      <description>&lt;p&gt;&lt;strong&gt;NGINX Fundamentals: Architecture, Configuration, and Real-Time Hands-On Practice&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;NGINX has revolutionized modern web infrastructure, becoming the backbone of high-performance applications worldwide. In this part 1 you'll learn about NGINX fundamentals configurations, theoretical knowledge with real-time scenario examples.&lt;/p&gt;

&lt;p&gt;Originally developed by &lt;strong&gt;Igor Sysoev&lt;/strong&gt; in &lt;strong&gt;2004&lt;/strong&gt;, NGINX was created to solve the infamous &lt;strong&gt;C10K problem&lt;/strong&gt; and has since evolved into one of the most powerful and widely adopted web servers in the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Forward Proxy and Reverse Proxy?
&lt;/h2&gt;

&lt;p&gt;Understanding proxy servers is fundamental to grasping NGINX's core functionality, as it excels primarily as a reverse proxy server.&lt;/p&gt;

&lt;h3&gt;
  
  
  Forward Proxy:
&lt;/h3&gt;

&lt;p&gt;A forward proxy acts as an intermediary between &lt;strong&gt;clients&lt;/strong&gt; and the &lt;strong&gt;internet&lt;/strong&gt;, &lt;strong&gt;sitting on the client side&lt;/strong&gt; of the &lt;strong&gt;network&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Acts on behalf of the &lt;strong&gt;client&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Sits between &lt;strong&gt;client&lt;/strong&gt; and the &lt;strong&gt;public internet&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Forwards client requests to servers&lt;/li&gt;
&lt;li&gt;Server doesn't know which specific client made the request&lt;/li&gt;
&lt;li&gt;Primarily serves client needs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real-World Example:&lt;/strong&gt; Corporate networks use forward proxies to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Filter employee internet access&lt;/li&gt;
&lt;li&gt;Block &lt;strong&gt;social media&lt;/strong&gt; and &lt;strong&gt;non-work websites&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Cache frequently accessed content to save bandwidth&lt;/li&gt;
&lt;li&gt;Provide anonymity for internal users&lt;/li&gt;
&lt;li&gt;Monitor and log internet usage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6emsevqfeqxmr9b6yexu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6emsevqfeqxmr9b6yexu.png" alt="image" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reverse Proxy:
&lt;/h3&gt;

&lt;p&gt;A reverse proxy sits between &lt;strong&gt;clients&lt;/strong&gt; and &lt;strong&gt;backend servers&lt;/strong&gt;, &lt;strong&gt;acting on behalf of the server infrastructure&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Acts on behalf of the &lt;strong&gt;server&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Sits between &lt;strong&gt;internet clients&lt;/strong&gt; and &lt;strong&gt;backend servers&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Hides server implementation details from clients&lt;/li&gt;
&lt;li&gt;Distributes incoming requests across multiple backend servers&lt;/li&gt;
&lt;li&gt;Provides additional services like &lt;strong&gt;SSL termination&lt;/strong&gt;, &lt;strong&gt;caching&lt;/strong&gt;, and &lt;strong&gt;load balancing&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Real-World Example:&lt;/strong&gt; Netflix, Amazon, and Google use reverse proxies to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Distribute user requests across thousands of servers worldwide&lt;/li&gt;
&lt;li&gt;Cache popular content closer to users&lt;/li&gt;
&lt;li&gt;Terminate SSL connections at the edge&lt;/li&gt;
&lt;li&gt;Provide DDoS protection and security filtering&lt;/li&gt;
&lt;li&gt;Ensure high availability and fault tolerance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4dya1nl5s2u395z3dm89.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4dya1nl5s2u395z3dm89.png" alt="image" width="800" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;What is DMZ?&lt;/p&gt;

&lt;p&gt;A DMZ (Demilitarized Zone) is &lt;strong&gt;a physical or logical subnetwork that adds an extra layer of security to an organization's network by isolating publicly accessible services, such as web or email servers, from the main internal network&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Understanding NGINX: Architecture &amp;amp; Use Cases
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is NGINX?
&lt;/h3&gt;

&lt;p&gt;NGINX (pronounced "&lt;strong&gt;engine-x&lt;/strong&gt;") is a widely used &lt;strong&gt;open-source&lt;/strong&gt; tool that does much more than just &lt;strong&gt;serve web pages&lt;/strong&gt;. Known for its &lt;strong&gt;speed&lt;/strong&gt; and &lt;strong&gt;reliability&lt;/strong&gt;, it also works as a &lt;strong&gt;reverse proxy&lt;/strong&gt;, &lt;strong&gt;load balancer&lt;/strong&gt;, and &lt;strong&gt;caching server&lt;/strong&gt;. Whether you're &lt;strong&gt;streaming medi&lt;/strong&gt;a, handling &lt;strong&gt;email protocols like SMTP or IMAP, or routing HTTP and TCP traffic&lt;/strong&gt;, NGINX is built to handle it all with efficiency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Core Capabilities:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web Server&lt;/strong&gt;: Serving static and dynamic content with minimal resource usage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reverse Proxy&lt;/strong&gt;: Forwarding client requests to backend application servers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancer&lt;/strong&gt;: Distributing incoming traffic across multiple backend servers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Cache&lt;/strong&gt;: Storing frequently requested content to reduce backend load&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSL/TLS Termination&lt;/strong&gt;: Handling encryption/decryption at the network edge&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mail Proxy&lt;/strong&gt;: Managing SMTP, POP3, and IMAP protocol connections&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream Proxy&lt;/strong&gt;: Handling TCP and UDP traffic for various applications&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What problem it solves?
&lt;/h3&gt;

&lt;p&gt;NGINX was specifically designed to solve the &lt;strong&gt;C10K problem&lt;/strong&gt; - the challenge of handling 10,000 (or more) concurrent client connections on a web server efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Traditional Problem:&lt;/strong&gt; Before NGINX, traditional web servers like Apache used a process-per-connection or thread-per-connection model:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3dq6pikrqxlhvp1wj6xg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3dq6pikrqxlhvp1wj6xg.png" alt="image" width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This approach became unsustainable as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each connection consumed significant memory (&lt;strong&gt;8-12MB per process&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Context switching between processes became expensive&lt;/li&gt;
&lt;li&gt;System resources were quickly exhausted&lt;/li&gt;
&lt;li&gt;Performance degraded dramatically under high load&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NGINX's Solution:&lt;/strong&gt; NGINX was built to solve this problem using an asynchronous, event-driven model, making it lightweight and able to handle tens of thousands of connections simultaneously efficiently and reliably.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxg9kfmzn9ardomh79lcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxg9kfmzn9ardomh79lcz.png" alt="image" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why NGINX Became Essential:
&lt;/h3&gt;

&lt;p&gt;The traditional web servers like &lt;strong&gt;Apache&lt;/strong&gt; used a &lt;strong&gt;process-per-connection model&lt;/strong&gt;, which became inefficient as web traffic grew exponentially. Each connection required a separate process or thread, consuming significant memory and CPU resources. NGINX's innovative approach changed this paradigm entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;NGINX Architecture: The Process Model&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;NGINX uses an &lt;strong&gt;event-driven, asynchronous architecture&lt;/strong&gt; that sets it apart from traditional web servers and consists of &lt;strong&gt;several components&lt;/strong&gt; such as*&lt;em&gt;:&lt;/em&gt;*&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6eq6p3536nzuu00bjb60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6eq6p3536nzuu00bjb60.png" alt="infographic-Inside-NGINX_process-model" width="740" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Master process&lt;/strong&gt; – Controls the main NGINX instance. It manages configuration, and is responsible for starting, stopping, and supervising the worker processes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Worker processes&lt;/strong&gt; – Handle all the actual work: managing client connections, serving static content, proxying requests, load balancing, and SSL/TLS termination.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache loader&lt;/strong&gt; – Runs at startup to load cache metadata from disk into memory, making cached content immediately available after NGINX boots.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache manager&lt;/strong&gt; – Runs in the background at intervals to check the cache directory, remove expired data, and ensure disk usage stays within limits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared memory&lt;/strong&gt; – Provides inter-process communication and storage for shared state, such as cache indexes, rate limiting counters, and load-balancing information.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Why This Architecture Matters:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Memory Efficiency&lt;/strong&gt;: One worker can handle thousands of connections with minimal memory overhead&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CPU Efficiency&lt;/strong&gt;: No context switching between processes for each request&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Performance degrades gracefully under high load&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stability&lt;/strong&gt;: If a worker crashes, the master spawns a new one without affecting other connections&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resource Optimization&lt;/strong&gt;: Efficient use of system resources leads to better overall performance&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Core Use Cases
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;NGINX's versatility makes it suitable for numerous deployment scenarios:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Web Server:&lt;/strong&gt; Serving static content (&lt;strong&gt;HTML&lt;/strong&gt;, &lt;strong&gt;CSS&lt;/strong&gt;, &lt;strong&gt;JS&lt;/strong&gt;, &lt;strong&gt;images&lt;/strong&gt;) with minimal overhead&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reverse Proxy:&lt;/strong&gt; Forwarding requests to backend applications&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  NGINX Alternatives
&lt;/h2&gt;

&lt;p&gt;While NGINX is widely used, a few alternatives are worth knowing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Apache HTTP Server&lt;/strong&gt; – A long-standing web server with strong legacy support and a rich module ecosystem, but less efficient under heavy load compared to NGINX.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HAProxy&lt;/strong&gt; – Specializes in high-performance load balancing and traffic distribution. Great for reliability, but not designed to serve static content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traefik&lt;/strong&gt; – A modern, cloud-native reverse proxy with built-in support for containers, service discovery, and automatic SSL management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare (as a Service)&lt;/strong&gt; – A managed CDN and security platform offering DDoS protection, WAF, and global content delivery but relies on a third-party provider.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Setting Up Nginx with Docker: Hands-On
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before we begin, ensure you have Docker installed on your system. You can download it from &lt;a href="https://docker.com/" rel="noopener noreferrer"&gt;Docker's official website&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Setting Up the Docker Container
&lt;/h3&gt;

&lt;p&gt;Let's start by creating and running an Ubuntu container with Nginx:&lt;br&gt;
&lt;/p&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;-it&lt;/span&gt; &lt;span class="nt"&gt;--name&lt;/span&gt; nginx-docker &lt;span class="nt"&gt;-p&lt;/span&gt; 8080:80 ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Command Breakdown:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;name nginx-docker&lt;/code&gt; → Assigns a custom name to your container&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;p 8080:80&lt;/code&gt; → Maps your host machine's port 8080 to the container's port 80&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;it ubuntu&lt;/code&gt; → Creates an interactive terminal session with Ubuntu&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This command will download the Ubuntu image (if not already present) and start an interactive container session.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Installing Nginx and Essential Tools
&lt;/h3&gt;

&lt;p&gt;Once inside the container, update the package list and install Nginx:&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;# Update package repositories&lt;/span&gt;
apt update

&lt;span class="c"&gt;# Install Nginx web server&lt;/span&gt;
apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx &lt;span class="nt"&gt;-y&lt;/span&gt;

&lt;span class="c"&gt;# Install vim text editor (useful for editing config files)&lt;/span&gt;
apt &lt;span class="nb"&gt;install &lt;/span&gt;vim &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the &lt;code&gt;apt install vim -y&lt;/code&gt; command first choose number &lt;code&gt;5&lt;/code&gt; which is Asia and then choose &lt;code&gt;44&lt;/code&gt; It’s Kolkata, we are choosing these to install IST timezone while installing the &lt;code&gt;vim&lt;/code&gt; tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip:&lt;/strong&gt; Always run &lt;code&gt;apt update&lt;/code&gt; first to ensure you're installing the latest versions of packages.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Verify Nginx Installation
&lt;/h3&gt;

&lt;p&gt;Check if Nginx was installed successfully:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nginx &lt;span class="nt"&gt;-v&lt;/span&gt;
or
nginx &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see output similar to: &lt;code&gt;nginx version: nginx/1.18.0 (Ubuntu)&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Understanding Nginx Directory Structure
&lt;/h2&gt;

&lt;p&gt;After installation, all Nginx files are stored in &lt;code&gt;/etc/nginx&lt;/code&gt;. Let's explore this directory:&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;cd&lt;/span&gt; /etc/nginx
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll see a structure like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;drwxr-xr-x 8 root root 4096 Aug 19 13:38 ./
drwxr-xr-x 1 root root 4096 Aug 19 13:36 ../
drwxr-xr-x 2 root root 4096 May 27 10:28 conf.d/
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 1125 Dec  1  2023 fastcgi.conf
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 1055 Dec  1  2023 fastcgi_params
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 5465 Dec  1  2023 mime.types
drwxr-xr-x 2 root root 4096 May 27 10:28 modules-available/
drwxr-xr-x 2 root root 4096 May 27 10:28 modules-enabled/
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root 1446 Aug 19 13:37 nginx.conf
&lt;span class="nt"&gt;-rw-r--r--&lt;/span&gt; 1 root root  636 Dec  1  2023 scgi_params
drwxr-xr-x 2 root root 4096 Aug 19 13:24 sites-available/
drwxr-xr-x 2 root root 4096 Aug 19 13:24 sites-enabled/
drwxr-xr-x 2 root root 4096 Aug 19 13:24 snippets/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Key Files and Directories:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nginx.conf&lt;/code&gt; → Main configuration file (most important!)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sites-available/&lt;/code&gt; → Contains individual site configurations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sites-enabled/&lt;/code&gt; → Contains symlinks to active site configurations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;conf.d/&lt;/code&gt; → Additional configuration files&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 5: Managing Nginx Service
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Starting Nginx
&lt;/h3&gt;

&lt;p&gt;To start the Nginx service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;service nginx start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; After installation or when Nginx has been stopped.&lt;/p&gt;

&lt;h3&gt;
  
  
  Checking Nginx Status
&lt;/h3&gt;

&lt;p&gt;To verify Nginx is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;service nginx status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternative method to check running processes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux | &lt;span class="nb"&gt;grep &lt;/span&gt;nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see output showing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;nginx: master process&lt;/code&gt; (main Nginx process)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;nginx: worker process&lt;/code&gt; (handles actual requests)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stopping Nginx
&lt;/h3&gt;

&lt;p&gt;When you need to stop Nginx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;service nginx stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;When to use:&lt;/strong&gt; During maintenance, troubleshooting, or when shutting down your server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Testing Your Nginx Installation
&lt;/h2&gt;

&lt;p&gt;Since we mapped port 80 to 8080, open your web browser and navigate to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the default &lt;strong&gt;Nginx Welcome Page&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdyq527u40pelvn8ds7hc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdyq527u40pelvn8ds7hc.png" alt="image" width="800" height="170"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Note:&lt;/strong&gt; Nginx runs on port 80 by default, but since we're using Docker, we've mapped container port 80 to host port 8080. Make sure no other service is using port 8080 on your host machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Creating a Custom Configuration
&lt;/h2&gt;

&lt;p&gt;Now let's customize Nginx with our own configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backup the Original Configuration
&lt;/h3&gt;

&lt;p&gt;Always backup before making changes:&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;cd&lt;/span&gt; /etc/nginx
&lt;span class="nb"&gt;mv &lt;/span&gt;nginx.conf nginx-backup.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create New Configuration File
&lt;/h3&gt;

&lt;p&gt;You can either create an empty file first or directly edit:&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;# Option 1: Create empty file then edit&lt;/span&gt;
&lt;span class="nb"&gt;touch &lt;/span&gt;nginx.conf
vim nginx.conf

&lt;span class="c"&gt;# Option 2: Directly create and edit&lt;/span&gt;
vim nginx.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add Custom Configuration
&lt;/h3&gt;

&lt;p&gt;Insert the following content into your new &lt;code&gt;nginx.conf&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;events &lt;span class="o"&gt;{&lt;/span&gt;
    worker_connections 1024&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

http &lt;span class="o"&gt;{&lt;/span&gt;
    server &lt;span class="o"&gt;{&lt;/span&gt;
        listen 80&lt;span class="p"&gt;;&lt;/span&gt;
        server_name _&lt;span class="p"&gt;;&lt;/span&gt;

        location / &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return &lt;/span&gt;200 &lt;span class="s2"&gt;"Hello from Nginx Custom Configuration via Docker&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;n"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            add_header Content-Type text/plain&lt;span class="p"&gt;;&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;p&gt;&lt;strong&gt;How to exit the vim editor&lt;/strong&gt;: After pasting this, press &lt;code&gt;esc&lt;/code&gt; and then &lt;code&gt;shift + :&lt;/code&gt; and the press &lt;code&gt;x&lt;/code&gt; and press &lt;code&gt;enter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration Breakdown:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;events&lt;/code&gt; → Defines connection processing parameters&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;worker_connections 1024&lt;/code&gt; → Maximum connections per worker process&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http&lt;/code&gt; → Main HTTP context&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;listen 80&lt;/code&gt; → Port Nginx listens on&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;server_name _&lt;/code&gt; → Catch-all server name&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;location /&lt;/code&gt; → Handles all requests to root path&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;return 200&lt;/code&gt; → Returns HTTP 200 status with custom message&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 8: Testing and Reloading Configuration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Test Configuration Syntax
&lt;/h3&gt;

&lt;p&gt;Before applying changes, always test the configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nginx &lt;span class="nt"&gt;-t&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxjp489tijt570jldzmp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgxjp489tijt570jldzmp.png" alt="image" width="800" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reload Configuration
&lt;/h3&gt;

&lt;p&gt;If the test passes, reload Nginx to apply changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nginx &lt;span class="nt"&gt;-s&lt;/span&gt; reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why reload instead of restart?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;reload&lt;/code&gt; → Applies new configuration without dropping existing connections&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;restart&lt;/code&gt; → Stops and starts Nginx, dropping all connections&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Visit &lt;code&gt;http://localhost:8080&lt;/code&gt; again. You should now see your custom message: "Hello from Nginx Custom Configuration via Docker"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhgkqmbuw9n78gb6a2gz6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhgkqmbuw9n78gb6a2gz6.png" alt="image" width="800" height="64"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Commands Summary
&lt;/h2&gt;

&lt;p&gt;Here's a quick reference of essential Nginx commands:&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;# Service management&lt;/span&gt;
service nginx start     &lt;span class="c"&gt;# Start Nginx&lt;/span&gt;
service nginx stop      &lt;span class="c"&gt;# Stop Nginx&lt;/span&gt;
service nginx status    &lt;span class="c"&gt;# Check status&lt;/span&gt;
service nginx restart   &lt;span class="c"&gt;# Full restart&lt;/span&gt;

&lt;span class="c"&gt;# Configuration management&lt;/span&gt;
nginx &lt;span class="nt"&gt;-t&lt;/span&gt;               &lt;span class="c"&gt;# Test configuration&lt;/span&gt;
nginx &lt;span class="nt"&gt;-s&lt;/span&gt; reload        &lt;span class="c"&gt;# Reload configuration&lt;/span&gt;
nginx &lt;span class="nt"&gt;-s&lt;/span&gt; stop          &lt;span class="c"&gt;# Graceful stop&lt;/span&gt;
nginx &lt;span class="nt"&gt;-s&lt;/span&gt; quit          &lt;span class="c"&gt;# Graceful shutdown&lt;/span&gt;

&lt;span class="c"&gt;# Information&lt;/span&gt;
nginx &lt;span class="nt"&gt;-v&lt;/span&gt;              &lt;span class="c"&gt;# Show version&lt;/span&gt;
nginx &lt;span class="nt"&gt;-V&lt;/span&gt;              &lt;span class="c"&gt;# Show version and compile options&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  In the next parts of this nignx blogs we’ll learn:
&lt;/h2&gt;

&lt;p&gt;Now that you have a basic Nginx setup running, you can explore:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serving static files&lt;/li&gt;
&lt;li&gt;Setting up reverse proxy&lt;/li&gt;
&lt;li&gt;SSL/TLS configuration&lt;/li&gt;
&lt;li&gt;Load balancing&lt;/li&gt;
&lt;li&gt;Custom error pages&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;You've successfully set up &lt;strong&gt;Nginx in a Docker container&lt;/strong&gt;, learned how to manage the service, and created your &lt;strong&gt;first custom configuration&lt;/strong&gt;. This foundation will serve you well as you continue your journey with &lt;strong&gt;web servers&lt;/strong&gt; and &lt;strong&gt;containerization&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember&lt;/strong&gt;: Always test your configurations before applying them, and keep backups of working configurations. Happy learning!&lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for reading…
&lt;/h3&gt;

</description>
      <category>nginx</category>
      <category>devops</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Git Cherry-Pick Saved My Messed-Up Branch — Here’s How You Can Too!</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Tue, 01 Jul 2025 17:56:22 +0000</pubDate>
      <link>https://forem.com/surajkumar00/git-cherry-pick-saved-my-messed-up-branch-heres-how-you-can-too-1bdb</link>
      <guid>https://forem.com/surajkumar00/git-cherry-pick-saved-my-messed-up-branch-heres-how-you-can-too-1bdb</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;A practical, real-world guide to understanding and applying Git &lt;strong&gt;cherry-pick&lt;/strong&gt; with actual developer mistakes and fixes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcqm96l9uxsbwfm8trra.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdcqm96l9uxsbwfm8trra.gif" alt="image" width="400" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is&lt;/strong&gt; &lt;code&gt;git cherry-pick&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git cherry-pick&lt;/code&gt; lets you &lt;strong&gt;selectively&lt;/strong&gt; apply commits from &lt;strong&gt;one branch to another&lt;/strong&gt; — like copying specific code changes &lt;strong&gt;without merging entire branches&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Now let’s understand a quick comparison&lt;/strong&gt; &lt;code&gt;cherry-pick&lt;/code&gt; &lt;strong&gt;vs&lt;/strong&gt; &lt;code&gt;merge&lt;/code&gt; vs &lt;code&gt;rebase&lt;/code&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;What it Does&lt;/th&gt;
&lt;th&gt;When to Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git cherry-pick&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Apply specific commits to current branch&lt;/td&gt;
&lt;td&gt;You want &lt;em&gt;only&lt;/em&gt; certain commits, not the full branch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git merge&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Combine entire branch history into current branch&lt;/td&gt;
&lt;td&gt;You want to bring all commits and preserve history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git rebase&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Move/Replay commits onto another base branch&lt;/td&gt;
&lt;td&gt;You want a clean, linear history, avoid merge commits&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;cherry-pick&lt;/code&gt; for precision, specific commits only&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;merge&lt;/code&gt; to combine full branch history&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;rebase&lt;/code&gt; to clean history and avoid unnecessary merges&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Why You Might Need&lt;/strong&gt; &lt;code&gt;cherry-pick&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;You committed on the wrong branch (happens more than we admit)&lt;/li&gt;
&lt;li&gt;You need a bug fix from one branch to another&lt;/li&gt;
&lt;li&gt;You want to copy only certain commits, not merge everything&lt;/li&gt;
&lt;li&gt;You made changes, reverted them locally, but commits got mixed up&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;My Real-Time Scenario: How I Discovered&lt;/strong&gt; &lt;code&gt;cherry-pick&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Let me share how I personally ran into this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I made some changes in a branch (let's call it branch A) but accidentally reverted the commits locally, leaving them in the unstaged area. Later, I re-committed those changes — but this time, I was working on branch B, where I only wanted my latest changes, not the leftover ones from branch A.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I pushed the branch to GitHub, went to open the PR, and BOOM — I saw two commits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One commit with my intended change for &lt;code&gt;branch B&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;But another unintended commit sneakily came from &lt;strong&gt;branch A&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Total mess, right? But no worries — I fixed this cleanly using &lt;code&gt;git cherry-pick&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I removed the wrong commit from &lt;code&gt;branch B&lt;/code&gt;, stayed on &lt;code&gt;branch A&lt;/code&gt;, cherry-picked only the commit I actually needed onto &lt;code&gt;branch B&lt;/code&gt;, and pushed it again. Clean history, problem solved.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step-by-Step Practical Guide to&lt;/strong&gt; &lt;code&gt;git cherry-pick&lt;/code&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. View Commit History with&lt;/strong&gt; &lt;code&gt;git log&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ This shows a simple, visual commit history across all branches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; If you're working on a shared repository with your team and didn't create your own branch yet, you can check history of a specific branch like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &amp;lt;branch-name&amp;gt; &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&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;git log main &lt;span class="nt"&gt;--oneline&lt;/span&gt; &lt;span class="nt"&gt;--graph&lt;/span&gt; &lt;span class="nt"&gt;--all&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Use this to find the commit hash (&lt;code&gt;abc123&lt;/code&gt;) you want to cherry-pick.&lt;/p&gt;

&lt;p&gt;✅ Copy that hash — you'll need it in the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Switch to Your Target Branch&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before you apply the commit, make sure you're on the correct branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows your current branch.&lt;/p&gt;

&lt;p&gt;If unsure, list all branches:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Switch to your target branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &amp;lt;your-branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&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;git checkout feature/login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Cherry-Pick the Commit&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cherry-pick &amp;lt;commit-hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ This applies only the specific commit to your current branch, without merging the entire source branch or bringing unrelated changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&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;git cherry-pick abcd1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the commit applies cleanly, you're done. If there's a conflict, Git will pause and you resolve it manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Cherry-Pick Multiple Commits&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One by one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cherry-pick &amp;lt;commit1&amp;gt; &amp;lt;commit2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Range of commits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cherry-pick commitA^..commitB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Handling Conflicts During Cherry-Pick&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Conflict? No stress. Git pauses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;CONFLICT &lt;span class="o"&gt;(&lt;/span&gt;content&lt;span class="o"&gt;)&lt;/span&gt;: Merge conflict &lt;span class="k"&gt;in &lt;/span&gt;file.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Resolve it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git cherry-pick &lt;span class="nt"&gt;--continue&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or abort:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git cherry-pick &lt;span class="nt"&gt;--abort&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  You can also follow this short youtube video if you want:
&lt;/h2&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Final Thoughts&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Mistakes happen — commits go to the wrong place, branches get mixed up.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git cherry-pick&lt;/code&gt; is the clean, targeted way to:&lt;/p&gt;

&lt;p&gt;✅ Move specific commits&lt;/p&gt;

&lt;p&gt;✅ Fix accidental commits&lt;/p&gt;

&lt;p&gt;✅ Avoid messy merges&lt;/p&gt;

&lt;p&gt;Once you try it practically, you’ll use it confidently — like I did when I accidentally messed up branches.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for reading guys…
&lt;/h3&gt;

</description>
      <category>git</category>
      <category>programming</category>
      <category>devops</category>
      <category>developers</category>
    </item>
    <item>
      <title>Managing Multiple GitHub/Git Accounts on One Machine (Personal + Work)</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Tue, 17 Jun 2025 13:14:04 +0000</pubDate>
      <link>https://forem.com/surajkumar00/managing-multiple-githubgit-accounts-on-one-machine-personal-work-2n89</link>
      <guid>https://forem.com/surajkumar00/managing-multiple-githubgit-accounts-on-one-machine-personal-work-2n89</guid>
      <description>&lt;p&gt;As developers and DevOps engineers, it's common to contribute to both personal and professional projects. However, using &lt;strong&gt;two GitHub accounts&lt;/strong&gt; on a &lt;strong&gt;single machine&lt;/strong&gt; can lead to &lt;code&gt;identity conflicts&lt;/code&gt;, &lt;code&gt;unverified commits&lt;/code&gt;, or &lt;code&gt;accidentally pushing to the wrong repository&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this guide I’ll walks you through setting up two GitHub accounts &lt;strong&gt;securely&lt;/strong&gt;, &lt;strong&gt;cleanly&lt;/strong&gt;, and with &lt;strong&gt;verified SSH-signed commits&lt;/strong&gt; all on a single machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Objectives
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Work with both &lt;strong&gt;personal and work GitHub repositories&lt;/strong&gt; (public &amp;amp; private).&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;two separate GitHub accounts&lt;/strong&gt; on one machine.&lt;/li&gt;
&lt;li&gt;Ensure &lt;strong&gt;verified commits&lt;/strong&gt; via SSH commit signing.&lt;/li&gt;
&lt;li&gt;Maintain a &lt;strong&gt;scalable, secure, and professional Git setup&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Generate Separate SSH Keys
&lt;/h2&gt;

&lt;p&gt;Create separate SSH key pairs for each GitHub account:&lt;/p&gt;

&lt;p&gt;You can name these according to your preferences while generating the SSH keys&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;for-personal&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for-work&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Personal Key&lt;/span&gt;
ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"you.email@gmail.com"&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/for-personal

&lt;span class="c"&gt;# Work Key&lt;/span&gt;
ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"you.workemail@gmail.com"&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/for-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Do not overwrite the default id_ed25519. Keeping keys separate ensures flexibility and security.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 2: Add Keys to SSH Agent
&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;# View loaded keys&lt;/span&gt;
ssh-add &lt;span class="nt"&gt;-l&lt;/span&gt;

&lt;span class="c"&gt;# Add new keys&lt;/span&gt;
ssh-add ~/.ssh/for-personal
ssh-add ~/.ssh/for-work

&lt;span class="c"&gt;# Remove all existing keys (optional reset)&lt;/span&gt;
ssh-add &lt;span class="nt"&gt;-D&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Configure SSH &lt;code&gt;config&lt;/code&gt; File
&lt;/h2&gt;

&lt;p&gt;Create or edit your SSH config file:&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;touch&lt;/span&gt; ~/.ssh/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Global settings
Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentitiesOnly yes
  ServerAliveInterval 60
  ServerAliveCountMax 3

# Personal GitHub
Host personal.github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/for-personal

# Work GitHub
Host work.github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/for-work
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Add Public Keys to GitHub
&lt;/h2&gt;

&lt;p&gt;Upload the corresponding &lt;code&gt;.pub&lt;/code&gt; files to each account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;~/.ssh/for-personal.pub&lt;/code&gt; → Personal GitHub&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;~/.ssh/for-work.pub&lt;/code&gt; → Work GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;GitHub → Settings → SSH and GPG Keys → New SSH Key&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 5: Clone Repositories Using SSH Host Aliases
&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;# Clone personal repo&lt;/span&gt;
git clone git@personal.github.com:your-username/my-repo.git

&lt;span class="c"&gt;# Clone work repo&lt;/span&gt;
git clone git@work.github.com:my-org/work-repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Configure Git Identity per Repository
&lt;/h2&gt;

&lt;p&gt;Set identity locally inside each project to avoid global conflicts:&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;# Inside Personal Repo&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/PersonalRepo

git config user.name &lt;span class="s2"&gt;"your name"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"your email"&lt;/span&gt;

&lt;span class="c"&gt;# Inside Work Repo&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/WorkRepo

git config user.name &lt;span class="s2"&gt;"your name"&lt;/span&gt;
git config user.email &lt;span class="s2"&gt;"your work email"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Enable Verified Commits with SSH Signing
&lt;/h2&gt;

&lt;p&gt;GitHub supports &lt;strong&gt;SSH-based commit signing&lt;/strong&gt;, separate from SSH authentication.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generate Signing Keys
&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;# Personal Signing Key&lt;/span&gt;
ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/id_ed25519_signing_personal &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"signing-personal"&lt;/span&gt;

&lt;span class="c"&gt;# Work Signing Key&lt;/span&gt;
ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.ssh/id_ed25519_signing_work &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"signing-work"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add Signing Keys to GitHub
&lt;/h3&gt;

&lt;p&gt;Go to &lt;strong&gt;GitHub → Settings → SSH and GPG Keys → New Signing Key&lt;/strong&gt; and paste the contents of each &lt;code&gt;.pub&lt;/code&gt; file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8: Configure Git to Use Signing Keys
&lt;/h2&gt;

&lt;p&gt;Set up commit signing in each repo:&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;# Personal Repo&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/PersonalRepo

git config commit.gpgsign &lt;span class="nb"&gt;true
&lt;/span&gt;git config gpg.format ssh
git config user.signingkey ~/.ssh/id_ed25519_signing_personal.pub

&lt;span class="c"&gt;# Work Repo&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/WorkRepo

git config commit.gpgsign &lt;span class="nb"&gt;true
&lt;/span&gt;git config gpg.format ssh
git config user.signingkey ~/.ssh/id_ed25519_signing_work.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Pre-Commit Workflow: Start SSH Agent and Test Connections
&lt;/h2&gt;

&lt;p&gt;Before making commits in any repository, ensure your SSH agent is running and keys are loaded:&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;# Ensure SSH agent is running and keys are loaded&lt;/span&gt;
&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;ssh-agent &lt;span class="nt"&gt;-s&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
ssh-add ~/.ssh/personal_github
ssh-add ~/.ssh/work_github

&lt;span class="c"&gt;# Test connections to verify which account will be used&lt;/span&gt;
ssh &lt;span class="nt"&gt;-T&lt;/span&gt; git@personal.github.com
&lt;span class="c"&gt;# or&lt;/span&gt;
ssh &lt;span class="nt"&gt;-T&lt;/span&gt; git@work.github.com

&lt;span class="c"&gt;# Now proceed with your git operations&lt;/span&gt;
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Your commit message"&lt;/span&gt;
git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Successful messages like Hi broh! You've successfully authenticated confirm proper setup.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This step is particularly important after system restarts or when opening new terminal sessions, as the SSH agent may not be running or may not have your keys loaded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Result
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Secure and clean GitHub SSH setup&lt;/strong&gt; for both accounts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verified commits&lt;/strong&gt; using SSH signing keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Separate identities&lt;/strong&gt; per project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Bonus Tip
&lt;/h3&gt;

&lt;p&gt;To view signed commits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--show-signature&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The end! - Thanks for reading…
&lt;/h2&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Automating The Deployment Spring Boot Deployment with AWS</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Wed, 28 May 2025 08:15:54 +0000</pubDate>
      <link>https://forem.com/surajkumar00/automating-the-deployment-spring-boot-deployment-with-aws-4hd</link>
      <guid>https://forem.com/surajkumar00/automating-the-deployment-spring-boot-deployment-with-aws-4hd</guid>
      <description>&lt;p&gt;In this comprehensive guide, I’ll walk through setting up a complete CI/CD pipeline using AWS CodePipeline to deploy a Spring Boot application to Elastic Beanstalk. Here's what we'll cover:&lt;/p&gt;

&lt;h3&gt;
  
  
  Tools Used
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CodeCommit&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Git repository for source code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CodeBuild&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Builds the Spring Boot app and outputs the &lt;code&gt;.jar&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CodePipeline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Orchestrates source → build → deploy stages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Elastic Beanstalk&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Deployment environment&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Let’s understand the architecture diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcrjoa8975bzedc64nrpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcrjoa8975bzedc64nrpk.png" alt="image" width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Source (GitHub Repository)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;The pipeline starts when a &lt;strong&gt;code change is pushed&lt;/strong&gt; (commit) to your GitHub repository.&lt;/li&gt;
&lt;li&gt;This event &lt;strong&gt;triggers the pipeline&lt;/strong&gt; automatically — no manual deployment needed.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build Phase (CodePipeline + CodeBuild)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS CodePipeline&lt;/strong&gt; detects the commit and &lt;strong&gt;initiates the CI/CD process&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It hands over the code to &lt;strong&gt;AWS CodeBuild&lt;/strong&gt;, which:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Builds the project&lt;/strong&gt; (compiles the Spring Boot application).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs tests&lt;/strong&gt; (unit/integration).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Returns the build status&lt;/strong&gt; (success or failure) back to CodePipeline.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy Phase (Elastic Beanstalk)&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;If the build is successful, CodePipeline proceeds to the &lt;strong&gt;Deploy&lt;/strong&gt; stage.&lt;/li&gt;
&lt;li&gt;It &lt;strong&gt;deploys the built Spring Boot application&lt;/strong&gt; to &lt;strong&gt;AWS Elastic Beanstalk&lt;/strong&gt;, a managed environment that handles infrastructure, load balancing, scaling, and app hosting.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Step-by-Step Follow-up:
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Step 1: Repository Setup
&lt;/h2&gt;

&lt;p&gt;First, create a GitHub repository for your Spring Boot project. This will serve as our source code repository.&lt;/p&gt;

&lt;p&gt;GitHub Repository: &lt;a href="https://github.com/Suraj-kumar00/aws-springboot-ecommerce" rel="noopener noreferrer"&gt;https://github.com/Suraj-kumar00/aws-springboot-ecommerce&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05vm5ay9bu8u5vlrxibo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F05vm5ay9bu8u5vlrxibo.png" alt="image" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Elastic Beanstalk Configuration
&lt;/h2&gt;

&lt;p&gt;Create your Elastic Beanstalk environment with these configurations:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F496sjyyzppq2y2z5wcwh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F496sjyyzppq2y2z5wcwh.png" alt="image" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give it the &lt;strong&gt;Application name&lt;/strong&gt; And the &lt;strong&gt;Domain Name&lt;/strong&gt; and also check the availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94yr2e0lnfh9ggv32zw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F94yr2e0lnfh9ggv32zw1.png" alt="image" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Java 17 as the platform&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrzee723upejw570tsos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvrzee723upejw570tsos.png" alt="image" width="800" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload your initial .jar file and set version to 1&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6owjw3bww9ogda53hrjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6owjw3bww9ogda53hrjh.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure service access settings:

&lt;ul&gt;
&lt;li&gt;Set up service role&lt;/li&gt;
&lt;li&gt;Configure EC2 key pair&lt;/li&gt;
&lt;li&gt;Set up AWS Elastic Beanstalk profile&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lb6hekewjii6ed7d9ji.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8lb6hekewjii6ed7d9ji.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In initial case there’s no EC2 instance profile so just click on the view permission details and create the role according to that in AWS IAM Role .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3qh4m369fu0exl8tlbv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy3qh4m369fu0exl8tlbv.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Database Configuration
&lt;/h2&gt;

&lt;p&gt;Choose the:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;VPC ( In my case I’m choosing default)&lt;/li&gt;
&lt;li&gt;Choose Instance subnets&lt;/li&gt;
&lt;li&gt;Choose Database subnets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftx46w4q3d0ruix7fmtvz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftx46w4q3d0ruix7fmtvz.png" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For the database setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable the RDS database integration&lt;/li&gt;
&lt;li&gt;Configure database username&lt;/li&gt;
&lt;li&gt;Set secure database password&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wnhrj0izddhemrllw14.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7wnhrj0izddhemrllw14.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that just click on next.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now in this step just choose the Security Group and we can edit it lated in the EC2 security group inbound rule for opening the custom ports:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5u0pko5hz9qsoxi2jn2j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5u0pko5hz9qsoxi2jn2j.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Other then that leave all the settings defalut and go to the next step.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now choose the system as Basic:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fct29ab1rx34cdo5ehlm5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fct29ab1rx34cdo5ehlm5.png" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;And leave all the setting as it is but change the &lt;code&gt;ENVIRONMENT VARIABLES&lt;/code&gt; :&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6ejmj8ktlrw734bj650.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh6ejmj8ktlrw734bj650.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that click on the next step.&lt;/p&gt;

&lt;p&gt;At the last step just review all the configuration and &lt;strong&gt;submit&lt;/strong&gt; it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Pipeline Setup
&lt;/h2&gt;

&lt;p&gt;Create your AWS CodePipeline:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigate to AWS CodePipeline and create a new pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthypm1gh7qx4qrg01gn6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthypm1gh7qx4qrg01gn6.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now chose the Custom build pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa34jhvme5yzwng48kzh6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa34jhvme5yzwng48kzh6.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now give the pipeline a name and leave all the setting default and click on the next.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69kyejd6ovwow86oiw4k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69kyejd6ovwow86oiw4k.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Now Select the provider which &lt;strong&gt;GitHub&lt;/strong&gt; in my case using OAuth.&lt;/p&gt;

&lt;p&gt;After Authenticating chose the &lt;code&gt;Repository name and the branch&lt;/code&gt; and click on next.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiy7jme4y4dk01tyug3u1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiy7jme4y4dk01tyug3u1.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now select the &lt;code&gt;Other build providers&lt;/code&gt; and create a new project:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frctxm3bg8kn58j64kr8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frctxm3bg8kn58j64kr8i.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Give the project name:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9vgy44qae2l0k6vw289.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb9vgy44qae2l0k6vw289.png" alt="image" width="596" height="663"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that chose the &lt;code&gt;buildspec.yml&lt;/code&gt; options and click on the &lt;strong&gt;create code pipeline.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2n8e8m74jtd5algklahm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2n8e8m74jtd5algklahm.png" alt="image" width="596" height="663"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;After that choose it will redirect you to the same page and just click on the next step:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftmdtwivxn843pqirqpce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftmdtwivxn843pqirqpce.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now the in the test stage choose the provder &lt;strong&gt;AWS CodeBuild and the project name and continute:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbgnur6js7a5sirc5spk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqbgnur6js7a5sirc5spk.png" alt="image" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Now in the deploy stage choose the provider as &lt;code&gt;AWS Elastic Beanstalk&lt;/code&gt; ,&lt;/p&gt;

&lt;p&gt;Region, Application Name and the Environment Name.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4f3s0pemcj2fxuzhtvv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4f3s0pemcj2fxuzhtvv.png" alt="image" width="800" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Essential Configuration Files
&lt;/h3&gt;

&lt;p&gt;Add this &lt;code&gt;buildspec.yml&lt;/code&gt; to your project root:&lt;/p&gt;

&lt;p&gt;You should change the &lt;code&gt;.jar&lt;/code&gt; because you name could be different.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.2&lt;/span&gt;
&lt;span class="na"&gt;phases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;install&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runtime-versions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;java&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;corretto17&lt;/span&gt;
  &lt;span class="na"&gt;pre_build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo Build started on `date`&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;mvn clean install&lt;/span&gt;
&lt;span class="na"&gt;artifacts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;files&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;target/Shopping_Cart-0.0.1-SNAPSHOT.jar&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Procfile&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.ebextensions/**/*&lt;/span&gt;
  &lt;span class="na"&gt;discard-paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;no&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Pipeline Execution Flow Diagram
&lt;/h2&gt;

&lt;p&gt;This is the execution result of the AWS Code Pipeline &lt;code&gt;Taking the source, Building it and Deploying the new verion of the application to AWS Elastic Beanstalk&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkn4jkuj10d7ex3ezzwb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhkn4jkuj10d7ex3ezzwb.png" alt="image" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Result:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The Application was deploy on this URL:&lt;/strong&gt; &lt;a href="http://aws-springboot-ecommerce.ap-south-1.elasticbeanstalk.com/" rel="noopener noreferrer"&gt;http://aws-springboot-ecommerce.ap-south-1.elasticbeanstalk.com/&lt;/a&gt; (This will not work now as I deleted the steup)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3cpiax1ck9812v86rt9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3cpiax1ck9812v86rt9t.png" alt="image" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkihcwb6d8p0u3rr7383f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkihcwb6d8p0u3rr7383f.png" alt="image" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1pdplhi7apy86opgd7rw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1pdplhi7apy86opgd7rw.png" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Common Challenges and Solutions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Database Connection Issues:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Problem&lt;/code&gt;: Build failures due to communication link issues&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Solution&lt;/code&gt;: Implement H2 in-memory database for testing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;JAR File Naming:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Problem&lt;/code&gt;: Deployment failures due to JAR file mismatches&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Solution&lt;/code&gt;: Maintain consistent artifactId naming across configurations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Key practices to follow:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separate test and production configurations&lt;/li&gt;
&lt;li&gt;Use environment variables for sensitive data&lt;/li&gt;
&lt;li&gt;Implement proper proxy configuration&lt;/li&gt;
&lt;li&gt;Add post-deployment hooks&lt;/li&gt;
&lt;li&gt;Maintain consistent artifact naming&lt;/li&gt;
&lt;li&gt;Implement proper error handling and logging&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Thanks for reading - See you in the next one!
&lt;/h3&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>cloud</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Deploying SpringBoot Application on AWS EC2: A Comprehensive Guide</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Wed, 21 May 2025 11:46:45 +0000</pubDate>
      <link>https://forem.com/surajkumar00/deploying-springboot-application-on-aws-ec2-a-comprehensive-guide-2l30</link>
      <guid>https://forem.com/surajkumar00/deploying-springboot-application-on-aws-ec2-a-comprehensive-guide-2l30</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This guide outlines the process of deploying a SpringBoot application on AWS EC2 with GitHub Actions for automated deployment. The setup includes Docker containers and proper security configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;AWS Account&lt;/li&gt;
&lt;li&gt;GitHub Repository&lt;/li&gt;
&lt;li&gt;Basic knowledge of Docker and AWS services&lt;/li&gt;
&lt;li&gt;SpringBoot application ready for deployment&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTE: While working on this project I have made the repository private, so remember&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your &lt;strong&gt;repo is private&lt;/strong&gt;, then you &lt;strong&gt;must configure SSH or PAT&lt;/strong&gt; on EC2 to interact with it.&lt;/li&gt;
&lt;li&gt;If your &lt;strong&gt;repo is public&lt;/strong&gt;, &lt;strong&gt;no key setup is needed&lt;/strong&gt; to clone it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But for your reference if you want the application I’m making it public&lt;/p&gt;

&lt;p&gt;Here is the Repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/Suraj-kumar00/scm-springboot-application-devops" rel="noopener noreferrer"&gt;https://github.com/Suraj-kumar00/scm-springboot-application-devops&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  First let’s understand the architecture Diagram
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93rxhndtk4ie8r6njyd8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F93rxhndtk4ie8r6njyd8.png" alt="image" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Architecture Overview&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;User&lt;/strong&gt; accesses the app via a web browser using the &lt;strong&gt;HTTP.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;The request hits &lt;strong&gt;Nginx&lt;/strong&gt; running on the &lt;strong&gt;EC2 instance&lt;/strong&gt;, which listens on port 80.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nginx&lt;/strong&gt; acts as a &lt;strong&gt;reverse proxy&lt;/strong&gt; and forwards the request to the &lt;strong&gt;Spring Boot application&lt;/strong&gt; running inside a Docker container on port 8081.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Spring Boot app&lt;/strong&gt; processes the request and, if needed, communicates with the &lt;strong&gt;MySQL database&lt;/strong&gt; (also running in a Docker container on the same EC2 instance).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The response is sent back through the same path:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;MySQL → Spring Boot → Nginx → User's browser.&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;GitHub Actions&lt;/strong&gt; is used to automatically deploy updates to the EC2 instance by SSHing in and running the necessary Docker commands (e.g., &lt;code&gt;docker-compose up&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Launch EC2 Instance
&lt;/h2&gt;

&lt;p&gt;Begin by setting up your EC2 instance with these specifications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose Ubuntu as the operating system&lt;/li&gt;
&lt;li&gt;Select t2.medium instance type&lt;/li&gt;
&lt;li&gt;Create and download a new key pair for SSH access&lt;/li&gt;
&lt;li&gt;Configure security group with the following ports:&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP 22 (SSH)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP 80 (HTTP for Nginx)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP 443 (HTTPS)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP 8081 (Spring Boot via Docker)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TCP 3000 (phpMyAdmin)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Set EBS volume size (20GB recommended for free tier)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 2: Configure Elastic IP
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to Elastic IP section in AWS Console&lt;/li&gt;
&lt;li&gt;Allocate new Elastic IP address&lt;/li&gt;
&lt;li&gt;Associate it with your EC2 instance&lt;/li&gt;
&lt;li&gt;Note down the Elastic IP for future use&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 3: SSH Into EC2 Instance
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"your-key.pem"&lt;/span&gt; ubuntu@your-elastic-ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Install Docker and Docker Compose
&lt;/h2&gt;

&lt;p&gt;Create and execute this installation script:&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;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;# Install Docker&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;docker.io &lt;span class="nt"&gt;-y&lt;/span&gt;
&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;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; docker &lt;span class="nv"&gt;$USER&lt;/span&gt;

&lt;span class="c"&gt;# Install Docker Compose&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;https://github.com/docker/compose/releases/latest/download/docker-compose-&lt;/span&gt;&lt;span class="nv"&gt;$&amp;gt;&lt;/span&gt;&lt;span class="s2"&gt;(uname -s)-&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;uname&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\\&lt;/span&gt;
  &lt;span class="nt"&gt;-o&lt;/span&gt; /usr/local/bin/docker-compose
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; +x /usr/local/bin/docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Set Up SSH for GitHub
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Generate SSH key on EC2:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; rsa &lt;span class="nt"&gt;-b&lt;/span&gt; 4096 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"ec2-rsa-key"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Add the public key to GitHub:&lt;/li&gt;
&lt;li&gt;Copy the content of ~/.ssh/id_&lt;a href="http://rsa.pub/" rel="noopener noreferrer"&gt;rsa.pub&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Add it to GitHub under Settings &amp;gt; SSH and GPG Keys&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 6: Clone and Deploy Application
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone git@github.com:your-username/your-repo.git
&lt;span class="nb"&gt;cd &lt;/span&gt;your-repo
docker-compose up &lt;span class="nt"&gt;--build&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Configure Nginx as Reverse Proxy
&lt;/h2&gt;

&lt;p&gt;Install and configure Nginx:&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;apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /etc/nginx/sites-available/default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add this configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;server {&lt;/span&gt;
    &lt;span class="s"&gt;listen 80;&lt;/span&gt;
    &lt;span class="s"&gt;server_name your-elastic-ip;&lt;/span&gt;

    &lt;span class="s"&gt;location / {&lt;/span&gt;
        &lt;span class="s"&gt;proxy_pass &amp;lt;http://localhost:8081&amp;gt;;&lt;/span&gt;
        &lt;span class="s"&gt;proxy_set_header Host $host;&lt;/span&gt;
        &lt;span class="s"&gt;proxy_set_header X-Real-IP $remote_addr;&lt;/span&gt;
    &lt;span class="s"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart Nginx:&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;systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 8: Set Up GitHub Actions
&lt;/h2&gt;

&lt;p&gt;Create .github/workflows/deploy.yml in your repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy to EC2&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Setup SSH Key&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;echo "${{ secrets.EC2_SSH_PRIVATE_KEY }}" &amp;gt; key.pem&lt;/span&gt;
          &lt;span class="s"&gt;chmod 600 key.pem&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deploy via SSH&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;ssh -o StrictHostKeyChecking=no -i key.pem ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} &amp;lt;&amp;lt; 'EOF'&lt;/span&gt;
            &lt;span class="s"&gt;cd /home/ubuntu/your-repo&lt;/span&gt;
            &lt;span class="s"&gt;git pull origin main&lt;/span&gt;
            &lt;span class="s"&gt;docker-compose down&lt;/span&gt;
            &lt;span class="s"&gt;docker-compose build --no-cache&lt;/span&gt;
            &lt;span class="s"&gt;docker-compose up -d&lt;/span&gt;
          &lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 9: Configure Auto-restart on Reboot
&lt;/h2&gt;

&lt;p&gt;Set up a cron job:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;span class="c"&gt;# Add this line:&lt;/span&gt;
@reboot &lt;span class="nb"&gt;cd&lt;/span&gt; /home/ubuntu/your-repo &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; docker-compose up &lt;span class="nt"&gt;--build&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Result!!
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6bp57qyz67u0m564jncf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6bp57qyz67u0m564jncf.png" alt="image" width="800" height="300"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Challenges and Solutions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Permission Issues

&lt;ul&gt;
&lt;li&gt;Docker permission denied: Run &lt;code&gt;sudo usermod -aG docker $USER&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;SSH key issues: Verify proper key permissions (&lt;code&gt;chmod 600&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Networking Issues

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;502 Bad Gateway&lt;/code&gt;: Check if Spring Boot container is running&lt;/li&gt;
&lt;li&gt;Connection refused: Verify security group settings&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Always use environment variables for sensitive data&lt;/li&gt;
&lt;li&gt;Regularly backup your application data&lt;/li&gt;
&lt;li&gt;Monitor application logs and performance&lt;/li&gt;
&lt;li&gt;Keep Docker images updated with security patches&lt;/li&gt;
&lt;li&gt;Use proper version tagging for Docker images&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Thanks for reading - see you in the next one!
&lt;/h2&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>githubactions</category>
      <category>springboot</category>
    </item>
    <item>
      <title>You Need to Learn Docker Right Now! (Part 1)</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Tue, 25 Mar 2025 13:21:46 +0000</pubDate>
      <link>https://forem.com/surajkumar00/you-need-to-learn-docker-right-now-part-1-7fj</link>
      <guid>https://forem.com/surajkumar00/you-need-to-learn-docker-right-now-part-1-7fj</guid>
      <description>&lt;h1&gt;
  
  
  Let’s Understand the Problem
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2qz6fxbkypdj325rwjrb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2qz6fxbkypdj325rwjrb.gif" alt="image" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's say a developer is working on a project and has set up all the required dependencies and configurations. Everything works fine. However, when a team collaborates on the same project across different operating systems, they may have different dependencies and setups, making it a hassle to configure the environment repeatedly.&lt;/p&gt;

&lt;p&gt;For example, if a tool is built for Windows, it won’t run on macOS or Linux, making setup even more difficult. Managing multiple environments and ensuring consistency becomes a challenge.&lt;/p&gt;

&lt;p&gt;Docker solves this problem by creating a standardized, portable environment that works the same across all systems, eliminating compatibility issues and simplifying setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1742579619351%2Fc62e692c-10b7-4921-a569-20d2f2be5b35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1742579619351%2Fc62e692c-10b7-4921-a569-20d2f2be5b35.png" alt="image" width="800" height="273"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Before Docker:&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each application required a &lt;strong&gt;dedicated server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Running multiple applications on the same server was difficult due to conflicts between &lt;strong&gt;dependencies and configurations&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Companies had to invest in more &lt;strong&gt;servers&lt;/strong&gt; and &lt;strong&gt;powerful CPUs&lt;/strong&gt;, leading to &lt;strong&gt;high costs&lt;/strong&gt; and &lt;strong&gt;inefficient resource utilization&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;This approach was not &lt;strong&gt;scalable&lt;/strong&gt;, &lt;strong&gt;cost-effective&lt;/strong&gt;, or &lt;strong&gt;environmentally friendly&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Who Solved This Problem?&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Machines (VMs)&lt;/strong&gt; provided a solution by allowing multiple applications to run on the same physical server.&lt;/li&gt;
&lt;li&gt;This was an improvement but still had limitations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Problems with Virtual Machines:&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each VM required its own full operating system, consuming significant resources.&lt;/li&gt;
&lt;li&gt;Managing dependencies across different environments was still complex.&lt;/li&gt;
&lt;li&gt;“Works on my machine” issues persisted, making development and deployment inconsistent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Then Containers Came into the Picture&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Containers allow applications to run &lt;strong&gt;without needing multiple OS installations&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Docker &lt;strong&gt;simplified&lt;/strong&gt; containerization, making it easier to build, share, and deploy applications.&lt;/li&gt;
&lt;li&gt;Containers are &lt;strong&gt;lightweight, fast, and portable&lt;/strong&gt; across environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better resource utilization&lt;/strong&gt;, run more apps on the same hardware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quick to build, destroy, and deploy&lt;/strong&gt;, ideal for cloud scaling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standardized workflow&lt;/strong&gt; from development to production.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Difference between Virtual Machine &amp;amp; Containers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Virtual Machines (VMs)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Each VM runs on a &lt;strong&gt;Hypervisor&lt;/strong&gt;, which allows multiple VMs to share the same physical infrastructure.&lt;/li&gt;
&lt;li&gt;Every VM has its own &lt;strong&gt;Guest OS&lt;/strong&gt;, making it &lt;strong&gt;heavyweight&lt;/strong&gt; since each OS requires its own resources (RAM, CPU, Storage).&lt;/li&gt;
&lt;li&gt;Applications inside VMs come with their own dependencies (Bins/Libs), which can lead to duplication of resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Overhead:&lt;/strong&gt; Since each VM has a separate OS, it consumes more CPU and memory, making it less efficient for running multiple applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Containers&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Containers share the same &lt;strong&gt;Host OS&lt;/strong&gt; but are managed by a &lt;strong&gt;Container Engine&lt;/strong&gt; (e.g., Docker, CRI-O, etc.), eliminating the need for separate Guest OS instances.&lt;/li&gt;
&lt;li&gt;Each container has its own dependencies (Bins/Libs) but shares the OS kernel with other containers, making them &lt;strong&gt;lightweight&lt;/strong&gt; and efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Faster startup and lower overhead&lt;/strong&gt; compared to VMs since containers don’t require a full OS boot.&lt;/li&gt;
&lt;li&gt;Ideal for &lt;strong&gt;microservices&lt;/strong&gt; and scalable applications since they consume fewer resources and can be deployed rapidly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy1avqs2ocwc1yy2rcgvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy1avqs2ocwc1yy2rcgvq.png" alt="image" width="800" height="768"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key differences in short:&lt;/strong&gt;
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Virtual Machines (VMs)&lt;/th&gt;
&lt;th&gt;Containers&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;OS Overhead&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Each VM has a full Guest OS&lt;/td&gt;
&lt;td&gt;Share the same Host OS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Startup Time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slower (OS boot required)&lt;/td&gt;
&lt;td&gt;Faster (lightweight)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Resource Usage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Heavy (CPU &amp;amp; RAM overhead)&lt;/td&gt;
&lt;td&gt;Efficient &amp;amp; lightweight&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scalability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Harder to scale due to overhead&lt;/td&gt;
&lt;td&gt;Easily scalable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Isolation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Stronger (Separate OS per VM)&lt;/td&gt;
&lt;td&gt;Process-level isolation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Slower due to OS duplication&lt;/td&gt;
&lt;td&gt;Faster &amp;amp; optimized&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  What is Docker?
&lt;/h1&gt;

&lt;p&gt;Docker is a &lt;strong&gt;containerization platform&lt;/strong&gt; that simplifies the process of building, shipping, and running applications in isolated environments called &lt;strong&gt;containers&lt;/strong&gt;. Under the hood, Docker utilizes Linux namespaces and cgroups to create lightweight, portable containers. Initially, Docker used LXC (Linux Containers), but later switched to its own container runtime called &lt;code&gt;containerd&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;According to Docker’s official site:&lt;/strong&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Docker is an open platform for developing, shipping, and running applications. It allows developers to package software into standardized units called containers, which include everything needed to run: libraries, system tools, code, and runtime.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Why Docker?&lt;/strong&gt;
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Manages Containers Easily&lt;/strong&gt; – It provides tooling to handle containers efficiently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplifies Deployment&lt;/strong&gt; – Packages an app and its dependencies into a single unit (&lt;strong&gt;Docker container&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build Once, Run Anywhere&lt;/strong&gt; – Ensures consistency across development, testing, and production.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast &amp;amp; Lightweight&lt;/strong&gt; – Containers are quick to create, destroy, and scale.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Installation of Docker
&lt;/h1&gt;

&lt;p&gt;I have listed the official website to install the &lt;strong&gt;Docker Engine&lt;/strong&gt; and &lt;strong&gt;Docker Desktop&lt;/strong&gt; for up to date installation steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Official Documentation for Installation(Check according to your device)
&lt;/h3&gt;

&lt;p&gt;Website: &lt;a href="https://docs.docker.com/desktop/setup/install/linux/" rel="noopener noreferrer"&gt;&lt;strong&gt;Install Docker Desktop&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Website: &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;&lt;strong&gt;Install Docker Engine&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Docker Daemon:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Docker Daemon (&lt;code&gt;dockerd&lt;/code&gt;) is the core engine that runs in the background. It listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. The daemon handles all the container operations like starting, stopping, and scaling containers, as well as pulling and creating images.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Docker Desktop:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker Desktop is an application for MacOS and Windows that provides a GUI for managing Docker environments. It includes Docker Engine, Docker CLI client, Docker Compose, Kubernetes, and a graphical user interface that allows users to manage containers, images, and other Docker resources visually. Docker Desktop simplifies the process of setting up and using Docker on your local machine.&lt;/p&gt;

&lt;h1&gt;
  
  
  How Docker Works?
&lt;/h1&gt;

&lt;p&gt;Docker follows a simple process to create, distribute, and run containers. Here’s how it works step by step:&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker Architecture
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgosluqkgv8obiv9ruq0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgosluqkgv8obiv9ruq0x.png" alt="image" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Docker Client&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The developer interacts with Docker using commands like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;docker build&lt;/code&gt; → Creates a &lt;strong&gt;Docker Image&lt;/strong&gt; from a &lt;strong&gt;Dockerfile&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker pull&lt;/code&gt; → Downloads an existing image from the &lt;strong&gt;Docker Registry&lt;/strong&gt; (like Docker Hub).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker run&lt;/code&gt; → Creates and starts a container from an image.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Docker Daemon&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Docker Daemon&lt;/strong&gt; runs in the background and manages everything, including images, containers, networks, and storage.&lt;/li&gt;
&lt;li&gt;It processes the client commands and does the actual work of building, pulling, and running containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Docker Host&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;Docker Host&lt;/strong&gt; is where containers run.&lt;/li&gt;
&lt;li&gt;It holds two key components:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Images:&lt;/strong&gt; Pre-built packages that contain applications and dependencies (e.g., Ubuntu, Nginx).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containers:&lt;/strong&gt; Running instances of Docker images that execute applications.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Docker Registry&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;This is a storage location for Docker images like you store you code on GitHub.&lt;/li&gt;
&lt;li&gt;Common registries include &lt;strong&gt;Docker Hub, Google Artifact Registry,Azure container registry, Amazon Elastic Container Registry (ECR), GitHub Conainer registry(GCR) and private registries&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Images can be &lt;strong&gt;pulled&lt;/strong&gt; (&lt;code&gt;docker pull&lt;/code&gt;) from here or &lt;strong&gt;pushed&lt;/strong&gt; (&lt;code&gt;docker push&lt;/code&gt;) to share with others.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Process Flow&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; You &lt;strong&gt;build&lt;/strong&gt; an image using &lt;code&gt;docker build&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; If the image isn’t available locally, Docker &lt;strong&gt;pulls&lt;/strong&gt; it from the registry using &lt;code&gt;docker pull&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; You &lt;strong&gt;run&lt;/strong&gt; a container using &lt;code&gt;docker run&lt;/code&gt;, which creates an instance from the image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xpxh9mdi73lr5ftlbfo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0xpxh9mdi73lr5ftlbfo.gif" alt="image" width="720" height="720"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What is a Dockerfile?
&lt;/h1&gt;

&lt;p&gt;A &lt;strong&gt;Dockerfile&lt;/strong&gt; is a script containing a set of instructions to build a &lt;strong&gt;Docker Image&lt;/strong&gt;. It defines the base OS, dependencies, and commands required to set up an environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker Image
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Docker Image&lt;/strong&gt; is a lightweight, standalone, and executable software package that includes everything needed to run an application: &lt;strong&gt;code, runtime, system tools, libraries, and dependencies&lt;/strong&gt;. A docker image is built in &lt;strong&gt;layers&lt;/strong&gt;, where each instruction in the &lt;code&gt;Dockerfile&lt;/code&gt; creates a new &lt;strong&gt;layer&lt;/strong&gt;. These layers stack on top of each other to form the final image.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;FROM&lt;/code&gt; → Base image layer (e.g., Ubuntu, Node.js, or Alpine).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;WORKDIR&lt;/code&gt; → Sets the working directory inside the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;COPY&lt;/code&gt; → Copies files from the host to the container.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;RUN&lt;/code&gt; → Executes commands inside the image (e.g., installing dependencies).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;EXPOSE&lt;/code&gt; → Declares which ports the container will use.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CMD&lt;/code&gt; / &lt;code&gt;ENTRYPOINT&lt;/code&gt; → Defines the default command when the container starts.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each layer is &lt;strong&gt;immutable&lt;/strong&gt;—once created, it doesn’t change. Instead, new layers are added when modifications are made.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Images are immutable&lt;/strong&gt; (cannot be changed).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stored locally or on Docker Hub&lt;/strong&gt; for sharing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Writing your first Dockerfile:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM ubuntu:latest

WORKDIR /app

COPY package.json package-lock.json ./

COPY . .

EXPOSE 3000

CMD ["npm", "start"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Docker Layer Caching&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker optimizes image builds by &lt;strong&gt;caching layers&lt;/strong&gt;. If a layer hasn’t changed, Docker reuses the cached version instead of rebuilding it.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How caching works:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Docker runs through the &lt;code&gt;Dockerfile&lt;/code&gt; line by line.&lt;/li&gt;
&lt;li&gt;If a layer hasn’t changed, it is pulled from cache.&lt;/li&gt;
&lt;li&gt;If a layer &lt;strong&gt;changes&lt;/strong&gt;, all layers &lt;strong&gt;after it&lt;/strong&gt; must be rebuilt.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Containers
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Docker Container&lt;/strong&gt; is a running instance of an image. It provides a lightweight and isolated environment to run applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnvwgmr1vbkvvbzvm6fgy.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnvwgmr1vbkvvbzvm6fgy.jpeg" alt="image" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ephemeral&lt;/strong&gt; (data is lost when deleted unless using volumes).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiple containers can be created from the same image.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Recap with Demo: Dockerizing a Nodejs application
&lt;/h1&gt;

&lt;p&gt;Remember above we have written our first &lt;strong&gt;Dockerfile&lt;/strong&gt; we will be using that.&lt;/p&gt;

&lt;p&gt;Now for the practice at your own you can use this github repository, here you will find the nodejs applicaiton code okay: &lt;a href="https://github.com/piyushgarg-dev/nodejs-docker-example" rel="noopener noreferrer"&gt;&lt;strong&gt;Nodejs Application Code&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Dockerfile&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Writing the Dockerfile&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use the latest Ubuntu image as the base
FROM ubuntu:latest

# Set the working directory inside the container
WORKDIR /app

# Copy package files first (helps with caching layers efficiently)
COPY package.json package-lock.json ./

# Install dependencies
RUN apt update &amp;amp;&amp;amp; apt install -y nodejs npm &amp;amp;&amp;amp; npm install

# Copy all remaining project files
COPY . .

# Expose port 3000 to allow external access to the application
EXPOSE 3000

# Start the application using npm
CMD ["npm", "start"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Build the Docker Image&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now, let's &lt;strong&gt;build the image&lt;/strong&gt; using the Dockerfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; mynodeapp &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;t mynodeapp&lt;/code&gt; → Gives the name &lt;strong&gt;mynodeapp&lt;/strong&gt; to the image.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.&lt;/code&gt; → Refers to the current directory where the Dockerfile is located.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Run the Container&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Once the image is built, we can &lt;strong&gt;start a container&lt;/strong&gt; from it:&lt;br&gt;
&lt;/p&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;-p&lt;/span&gt; 3000:3000 &lt;span class="nt"&gt;--name&lt;/span&gt; mynodejscontainer mynodeapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;d&lt;/code&gt; → Runs the container in &lt;strong&gt;detached mode&lt;/strong&gt; (in the background).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;p 3000:3000&lt;/code&gt; → Maps port &lt;strong&gt;3000 of the container&lt;/strong&gt; to port &lt;strong&gt;3000 of the host&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;name mynodejscontainer&lt;/code&gt; → Names the running container &lt;strong&gt;mynodejscontainer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mynodeapp&lt;/code&gt; → Uses the &lt;strong&gt;mynodeapp&lt;/strong&gt; image to create the container.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Verify the Running Container&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To check if the container is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker ps

CONTAINER ID   IMAGE       COMMAND        STATUS        PORTS                  NAMES
abcdef123456   mynodeapp   &lt;span class="s2"&gt;"npm start"&lt;/span&gt;    Up 5 minutes  0.0.0.0:3000-&amp;gt;3000/tcp  mynodejscontainer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 5: View Logs of the Application&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To check logs and ensure the app is running properly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker logs &lt;span class="nt"&gt;-f&lt;/span&gt; mycontainer

&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; mynodeapp@1.0.0 start /
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; node server.js
Server is running on port 3000...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 6: Access the Application&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now, open your browser and go to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we have successfully dockerized our &lt;strong&gt;Node.js application&lt;/strong&gt; running inside a &lt;strong&gt;Docker container&lt;/strong&gt;!&lt;/p&gt;

&lt;h3&gt;
  
  
  This is the flow form writing a dockerfile, building the image out of it and running the container of the image.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4vt52fz66kof76drhxc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl4vt52fz66kof76drhxc.gif" alt="image" width="1332" height="422"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Basic Docker Commands&lt;/strong&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Run a container interactively&lt;/strong&gt;
&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;# Runs an Ubuntu container in interactive mode (-it)&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; ubuntu

&lt;span class="c"&gt;# Run the container using port you have exposed in dockerfile, for example -p (publish)&lt;/span&gt;
docker run &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; hostPort:containerPort &amp;lt;name-of-the-image&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;List all running containers&lt;/strong&gt;
&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;# Shows currently running container&lt;/span&gt;
docker container &lt;span class="nb"&gt;ls&lt;/span&gt;

&lt;span class="c"&gt;# or&lt;/span&gt;
docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;List all containers (including stopped ones)&lt;/strong&gt;
&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;# Lists all containers, including stopped ones&lt;/span&gt;
docker container &lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Stop a running container&lt;/strong&gt;
&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;# Stops a running container using its container ID&lt;/span&gt;
docker container stop &lt;span class="o"&gt;[&lt;/span&gt;container_id]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Remove all stopped containers, unused volumes, and networks&lt;/strong&gt;
&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;# Cleans up unused containers, networks, and images&lt;/span&gt;
docker system prune
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Exec into the running container&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;docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; &amp;lt;name-of-your-container&amp;gt; bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Inspect running processes in a container&lt;/strong&gt;
&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;# Lists all running processes inside the container after you exec into the container&lt;/span&gt;
ps &lt;span class="nt"&gt;-ef&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Image &amp;amp; Container Management&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;List all Docker images&lt;/strong&gt;
&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;# Shows all locally available Docker images&lt;/span&gt;
docker images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Pull an image from Docker Hub&lt;/strong&gt;
&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;# Downloads the latest Nginx image&lt;/span&gt;
docker pull nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Remove an image&lt;/strong&gt;
&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;# Deletes the specified Docker image&lt;/span&gt;
docker rmi nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Start a stopped container&lt;/strong&gt;
&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;# Restarts a stopped container&lt;/span&gt;
docker start &lt;span class="o"&gt;[&lt;/span&gt;container_id]

&lt;span class="c"&gt;# Or you can use the name of the container as well&lt;/span&gt;
docker start &amp;lt;name-of-the-conatiner&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Restart a container&lt;/strong&gt;
&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;# Stops and starts a container again&lt;/span&gt;
docker restart &lt;span class="o"&gt;[&lt;/span&gt;container_id]

&lt;span class="c"&gt;# Or you can use the name of the container as well&lt;/span&gt;
docker restart &amp;lt;name-of-the-conatiner&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Delete a container&lt;/strong&gt;
&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;# Removes a stopped container permanently&lt;/span&gt;
docker &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;container_id]

&lt;span class="c"&gt;# Or you can use the name of the container as well&lt;/span&gt;
docker &lt;span class="nb"&gt;rm&lt;/span&gt; &amp;lt;name-of-the-conatiner&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Container Logs &amp;amp; Inspection&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;View container logs&lt;/strong&gt;
&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;# Shows logs of a specific container&lt;/span&gt;
docker logs &lt;span class="o"&gt;[&lt;/span&gt;container_id]

&lt;span class="c"&gt;# Or you can use the name of the container as well&lt;/span&gt;
docker logs &amp;lt;name-of-the-conatiner&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Check container details&lt;/strong&gt;
&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;# Displays detailed information about a container&lt;/span&gt;
docker inspect &lt;span class="o"&gt;[&lt;/span&gt;container_id]

&lt;span class="c"&gt;# Or you can use the name of the container as well&lt;/span&gt;
docker inspect &amp;lt;name-of-the-conatiner&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Monitor real-time container stats&lt;/strong&gt;
&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;# Shows real-time CPU, memory, and network stats of containers&lt;/span&gt;
docker stats
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  I’ll be covering these advanced and Important topics in next blog
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Docker Compose&lt;/li&gt;
&lt;li&gt;Docker Networking&lt;/li&gt;
&lt;li&gt;Docker Volumes&lt;/li&gt;
&lt;li&gt;Docker Swarm&lt;/li&gt;
&lt;li&gt;Docker Vs Kubernetes&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  The End!
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;I hope you enjoyed this blog and have learned about docker today. See you in the next one.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>devops</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Building a Secure, Fast &amp; Scalable Static Website on AWS - MindfulCloud</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Sat, 15 Mar 2025 06:38:29 +0000</pubDate>
      <link>https://forem.com/surajkumar00/building-a-secure-fast-scalable-static-website-on-aws-mindfulcloud-567k</link>
      <guid>https://forem.com/surajkumar00/building-a-secure-fast-scalable-static-website-on-aws-mindfulcloud-567k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Problem It Solves
&lt;/h3&gt;

&lt;p&gt;Anyone can host a static website on AWS, but that’s not enough in today's landscape. The real challenge is building a &lt;strong&gt;secure, fast, and scalable&lt;/strong&gt; website that efficiently uses AWS resources.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Security Risks:&lt;/strong&gt; Hackers are everywhere, and a simple HTML file won’t stop them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance Issues:&lt;/strong&gt; Users expect lightning-fast websites. Anything over a second and they bounce.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost Management:&lt;/strong&gt; Resources need to be allocated smartly to avoid unnecessary spending.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This blog walks you through building a &lt;strong&gt;highly secure, performance-optimized&lt;/strong&gt; static website leveraging AWS services.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Built It
&lt;/h2&gt;

&lt;p&gt;The AWS services used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS S3:&lt;/strong&gt; Foundation for static site storage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudFront:&lt;/strong&gt; Distributes content worldwide for ultra-fast loading.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate Manager:&lt;/strong&gt; Manages HTTPS encryption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS WAF:&lt;/strong&gt; Protects against cyber threats like DDoS, XSS, and SQL Injection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudWatch:&lt;/strong&gt; Monitors traffic, security, and performance with alerts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS Route 53:&lt;/strong&gt; Manages the custom domain.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  This is the architecture for Hosting a Static Website
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxpxhxtubv6c863vcg9h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxpxhxtubv6c863vcg9h.png" alt="image" width="800" height="155"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding the Architecture: The Complete Flow
&lt;/h2&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;User Request (Entry Point)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A user visits &lt;strong&gt;&lt;a href="https://mindfulcloud.devsuraj.me" rel="noopener noreferrer"&gt;https://mindfulcloud.devsuraj.me&lt;/a&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The request is sent to &lt;strong&gt;Amazon Route 53&lt;/strong&gt;, which maps the domain to CloudFront.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;2️⃣ &lt;strong&gt;Route 53 → CloudFront&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Route 53 forwards the request to &lt;strong&gt;Amazon CloudFront (CDN)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;CloudFront serves cached content to it’s edge locations near to the users for lower latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;3️⃣ &lt;strong&gt;Security Layer&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS WAF&lt;/strong&gt; protects against:

&lt;ul&gt;
&lt;li&gt;SQL Injection&lt;/li&gt;
&lt;li&gt;Cross-site Scripting (XSS)&lt;/li&gt;
&lt;li&gt;DDoS attacks&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;AWS ACM (AWS Certificate Manager)&lt;/strong&gt; enables &lt;strong&gt;SSL/TLS encryption&lt;/strong&gt;.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;4️⃣ &lt;strong&gt;Fetching Content from S3&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If CloudFront doesn’t have the content cached, it fetches it from &lt;strong&gt;Amazon S3&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;S3 acts as the &lt;strong&gt;origin server&lt;/strong&gt; for static assets like HTML, CSS, JavaScript, and images.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;5️⃣ &lt;strong&gt;Monitoring &amp;amp; Logging&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS CloudWatch&lt;/strong&gt; tracks:

&lt;ul&gt;
&lt;li&gt;CloudFront request logs, cache hit ratio, and performance metrics.&lt;/li&gt;
&lt;li&gt;S3 storage access patterns.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Alerts notify about security threats or traffic spikes.&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Step 1: Setting Up an S3 Bucket for Static Website Hosting
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;AWS Console&lt;/strong&gt; &lt;strong&gt;S3&lt;/strong&gt; service and &lt;strong&gt;Create Bucket&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq9klwp4wj57p2pq1ncs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvq9klwp4wj57p2pq1ncs.png" alt="image" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter a &lt;strong&gt;unique bucket name&lt;/strong&gt; (e.g., &lt;a href="http://mindfulcloud.devsuraj.me/" rel="noopener noreferrer"&gt;mindfulcloud.devsuraj.me&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fplgfughvtqfmaftasprm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fplgfughvtqfmaftasprm.png" alt="image" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose &lt;strong&gt;public or private access&lt;/strong&gt; (public if hosting static content).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpk6jjakemb0s129q3yl2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpk6jjakemb0s129q3yl2.png" alt="image" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable &lt;strong&gt;static website hosting&lt;/strong&gt; under &lt;strong&gt;Properties&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvponov78qiresiczm1ec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvponov78qiresiczm1ec.png" alt="image" width="800" height="191"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scroll down below and enter the Index document and save it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i1dhnihd7zhgic69qmz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6i1dhnihd7zhgic69qmz.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Upload your static website files (HTML, CSS, JS).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9dltlr0593mmvat355c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9dltlr0593mmvat355c.png" alt="image" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 2: Configuring AWS ACM (SSL Certificate) for HTTPS
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;AWS Certificate Manager (ACM)&lt;/strong&gt; → &lt;strong&gt;Request a Certificate&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You should create the certificate in the N.Verginia otherwise you’ll not be able to see it when you select the certificate in the cloudfront.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwb4ac9iy2dn4huzko369.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwb4ac9iy2dn4huzko369.png" alt="image" width="800" height="313"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose &lt;strong&gt;Public Certificate&lt;/strong&gt; → &lt;strong&gt;Enter domain name&lt;/strong&gt; (e.g., &lt;a href="http://mindfulcloud.devsuraj.me/" rel="noopener noreferrer"&gt;mindfulcloud.devsuraj.me&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;In my case I have my root domain which &lt;code&gt;devsuraj.me&lt;/code&gt; so I want subdomain to attach it and above I have mentioned.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose &lt;strong&gt;DNS validation&lt;/strong&gt; (faster &amp;amp; recommended).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg5e07utayl99l07hai2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgg5e07utayl99l07hai2.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ACM provides &lt;strong&gt;CNAME records&lt;/strong&gt;; add them to your &lt;strong&gt;Namecheap DNS settings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Copy the CNAME name and CNAME value.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdz4gqr3c6cuhjvxpu8a4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdz4gqr3c6cuhjvxpu8a4.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add it to the DNS service provide you have in my case I have Namecheap:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;After login to you namecheap to &lt;strong&gt;domain list and click on manage and go to the advanced DNS.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwea1p9bpzbttjphwsn53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwea1p9bpzbttjphwsn53.png" alt="image" width="800" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fte08w9dydv5y2glmihbs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fte08w9dydv5y2glmihbs.png" alt="image" width="800" height="257"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now create new record&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc07vy4gzhcfie72ft9i9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc07vy4gzhcfie72ft9i9.png" alt="image" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter the CNAME and The Value&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5itjme4x5zmxiqr251hf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5itjme4x5zmxiqr251hf.png" alt="image" width="800" height="62"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Now you’re done with ACM, wait for validation (may take a few minutes to hours).&lt;/p&gt;&lt;/li&gt;

&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 3: Setting Up a Route 53 Hosted Zone
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;AWS Route 53&lt;/strong&gt; → &lt;strong&gt;Create Hosted Zone&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd12w6s37yn2ax490mktv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd12w6s37yn2ax490mktv.png" alt="image" width="800" height="124"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enter your subdomain (e.g., &lt;a href="http://mindfulcloud.devsuraj.me/" rel="noopener noreferrer"&gt;mindfulcloud.devsuraj.me&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mmmbxuvp87nbogudet1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mmmbxuvp87nbogudet1.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy the provided &lt;strong&gt;NS (Name Server) records&lt;/strong&gt; and update them in &lt;strong&gt;Namecheap’s DNS settings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi56ubzf5rdt888idffm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxi56ubzf5rdt888idffm.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2czb7a7n56vqjuitk5wc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2czb7a7n56vqjuitk5wc.png" alt="image" width="800" height="119"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create an &lt;strong&gt;A record&lt;/strong&gt; (alias) pointing to &lt;strong&gt;CloudFront Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdgc3tmnzrfz2thlj25p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdgc3tmnzrfz2thlj25p.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 4: Setting Up CloudFront for CDN &amp;amp; Caching
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;AWS CloudFront&lt;/strong&gt; → &lt;strong&gt;Create Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvbolvq2f5bz0os620q6e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvbolvq2f5bz0os620q6e.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set &lt;strong&gt;Origin Domain&lt;/strong&gt; as your S3 bucket.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpqr95bgfi612wizezgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpqr95bgfi612wizezgb.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable &lt;strong&gt;HTTPS&lt;/strong&gt; using your ACM certificate.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1irvh81twu6k5z4bfn44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1irvh81twu6k5z4bfn44.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Select you ACM certificate:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4q5d7tfcr19xqv4jsw4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4q5d7tfcr19xqv4jsw4.png" alt="image" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Configure &lt;strong&gt;default root object&lt;/strong&gt; (index.html).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiawe3piut4a7fbj55u7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiawe3piut4a7fbj55u7c.png" alt="image" width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deploy the distribution and note the &lt;strong&gt;CloudFront URL&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;After creating the distribution it you’ll give you the bucket policy to you just copy that and paste it in the bucket you created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0trxyttgzn1jk1nqf68d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0trxyttgzn1jk1nqf68d.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Step 5: Connecting Namecheap Domain to AWS&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1️⃣ Go to Namecheap DNS Settings&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Log in to &lt;strong&gt;Namecheap&lt;/strong&gt; → &lt;strong&gt;Domain List&lt;/strong&gt; → &lt;strong&gt;Manage&lt;/strong&gt; your domain → &lt;strong&gt;Advanced DNS&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2️⃣ Verify NS Records are correct( as we did this in step 3)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Ensure &lt;strong&gt;Nameservers&lt;/strong&gt; are set to &lt;strong&gt;Custom DNS&lt;/strong&gt; with Route 53 NS records.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3️⃣ Save &amp;amp; Wait for Propagation&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Save Changes&lt;/strong&gt; → Wait &lt;strong&gt;a few minutes to 24 hours&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Open &lt;a href="https://mindfulcloud.devsuraj.me/" rel="noopener noreferrer"&gt;&lt;code&gt;https://yourdomain.com&lt;/code&gt;&lt;/a&gt; in a browser to confirm it works.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flduqgphnmjbnyp6iezid.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flduqgphnmjbnyp6iezid.png" alt="image" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Enhancing Security with AWS WAF
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Go to &lt;strong&gt;AWS WAF&lt;/strong&gt; → &lt;strong&gt;Create WebACL&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flc7d0xeeblvlivs6syrk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flc7d0xeeblvlivs6syrk.png" alt="image" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Attach it to &lt;strong&gt;CloudFront Distribution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9tg9p1mpjb9cbqwwaw1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff9tg9p1mpjb9cbqwwaw1.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add security rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Block common threats&lt;/strong&gt; (DDoS, SQL Injection, XSS attacks).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate limiting&lt;/strong&gt; for excessive requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geo-restriction&lt;/strong&gt; to block traffic from unwanted locations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykgns4g1dwnv1sbhnae2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykgns4g1dwnv1sbhnae2.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Enable &lt;strong&gt;AWS WAF logging&lt;/strong&gt; to monitor security threats.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83kqu827hzy6vzrmh67a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F83kqu827hzy6vzrmh67a.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 7: Enabling CloudWatch Monitoring &amp;amp; Logging
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enable CloudFront Logging&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;CloudFront&lt;/strong&gt; → &lt;strong&gt;Enable Standard Logging&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose an &lt;strong&gt;S3 bucket&lt;/strong&gt; to store logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1nltg090dkufpfhbzebs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1nltg090dkufpfhbzebs.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create CloudWatch Dashboards&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitor &lt;strong&gt;requests, latency, cache hit ratio&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Set up &lt;strong&gt;CloudWatch alarms&lt;/strong&gt; for security events.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rjhhywbnujpcwrld3xn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9rjhhywbnujpcwrld3xn.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2jqpmyaza6138yxg5c7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2jqpmyaza6138yxg5c7.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Set Up Alerts&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;AWS SNS (Simple Notification Service)&lt;/strong&gt; to receive alerts via email/SMS.&lt;/li&gt;
&lt;li&gt;Example: Alert if &lt;strong&gt;CloudFront request count exceeds a threshold&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprclh9dt26ffnj7hsl6k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fprclh9dt26ffnj7hsl6k.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwfp60ia55tvyg77mkqcj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwfp60ia55tvyg77mkqcj.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyx7jbbndodzrooeoixj2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyx7jbbndodzrooeoixj2.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Select The SNS topic or create one:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxwsekljatqhvrqezx2bx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxwsekljatqhvrqezx2bx.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And just complete the step 3 and step 4 in creating the alarm and you’re good go.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 8: Implementing Reliability &amp;amp; Disaster Recovery
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enable S3 Versioning&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;S3&lt;/strong&gt; → &lt;strong&gt;Properties&lt;/strong&gt; → &lt;strong&gt;Enable Versioning&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;This helps rollback in case of accidental file deletion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44l3ss0163cvxkeugjw3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F44l3ss0163cvxkeugjw3.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Enable Cross-Region Replication&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;strong&gt;S3&lt;/strong&gt; → &lt;strong&gt;Replication Rules&lt;/strong&gt; → &lt;strong&gt;Set up a backup region&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Choose a different AWS region for redundancy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7a0o81v5objgsnd2tb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7a0o81v5objgsnd2tb7.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lkyrisl0nfyu4r2mdaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6lkyrisl0nfyu4r2mdaf.png" alt="image" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Send the requests to your website to check the performance, WAF security and other metrics.&lt;/strong&gt;
&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;#!/bin/bash&lt;/span&gt;

&lt;span class="nv"&gt;URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your website url"&lt;/span&gt;
&lt;span class="nv"&gt;REQUESTS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt; &lt;span class="c"&gt;# include the number of requrests you want to send&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Starting load test on &lt;/span&gt;&lt;span class="nv"&gt;$URL&lt;/span&gt;&lt;span class="s2"&gt; with &lt;/span&gt;&lt;span class="nv"&gt;$REQUESTS&lt;/span&gt;&lt;span class="s2"&gt; requests..."&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1&lt;span class="p"&gt;;&lt;/span&gt; i&amp;lt;&lt;span class="o"&gt;=&lt;/span&gt;REQUESTS&lt;span class="p"&gt;;&lt;/span&gt; i++&lt;span class="o"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;do
  &lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; /dev/null &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"Request &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;: HTTP %{http_code}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;$URL&lt;/span&gt; &amp;amp;
&lt;span class="k"&gt;done

&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Load test initiated!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;How to Run&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Save this script as &lt;code&gt;simple_load_[test.sh](http://test.sh/)&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Give it execution permission:
&lt;/li&gt;
&lt;/ol&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; +x simple_load_test.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run it:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./simple_load_test.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The end!!!
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Thanks for the reading guys, see you in the next one…
&lt;/h3&gt;

</description>
      <category>aws</category>
      <category>cloudcomputing</category>
      <category>webdev</category>
      <category>devops</category>
    </item>
    <item>
      <title>Build &amp; Package Manager tools in DevOps</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Mon, 10 Mar 2025 06:49:14 +0000</pubDate>
      <link>https://forem.com/surajkumar00/build-package-manager-tools-in-devops-658</link>
      <guid>https://forem.com/surajkumar00/build-package-manager-tools-in-devops-658</guid>
      <description>&lt;h3&gt;
  
  
  Introduction to Build &amp;amp; Package Manager Tools:
&lt;/h3&gt;

&lt;p&gt;What are built and package manager tools?&lt;/p&gt;

&lt;p&gt;When developers create an application, it needs to be available to end users. This involves deploying the application on a production server, which requires moving the application code and its dependencies to the server. This is where build and package manager tools come into play.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Package&lt;/strong&gt; application into a &lt;strong&gt;single movable file&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;And this single movable file is called &lt;strong&gt;an artifact&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Packaging = “&lt;strong&gt;building the code&lt;/strong&gt;”&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Building the code involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compiling (Hundreds of files into 1 single file)&lt;/li&gt;
&lt;li&gt;Compress (Hundreds of files into 1 single file)&lt;/li&gt;
&lt;li&gt;After the artifact was built we kept artifacts in storage also&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In case we need to deploy multiple times, have a backup, etc.&lt;/p&gt;

&lt;p&gt;E.g.: If we deploy the artifact on the &lt;strong&gt;dev&lt;/strong&gt; server, we deploy the &lt;strong&gt;test environment,&lt;/strong&gt; or later on the &lt;strong&gt;production environment.&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Artifact repository:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The storage location where we keep the artifact once we build it is called the artifact repository, an example is &lt;strong&gt;Nexus&lt;/strong&gt;, &lt;strong&gt;JFrogArtifactory&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What kind of file is in the artifact?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The artifact file looks different for each programming language&lt;/li&gt;
&lt;li&gt;E.g., if you have a &lt;strong&gt;Java&lt;/strong&gt; Application the artifact file will be a &lt;strong&gt;JAR&lt;/strong&gt; or &lt;strong&gt;WAR&lt;/strong&gt; file&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JAR&lt;/strong&gt; = Java Archive&lt;/li&gt;
&lt;li&gt;These include whole code and dependencies like:

&lt;ul&gt;
&lt;li&gt;Spring Framework&lt;/li&gt;
&lt;li&gt;datetime libraries&lt;/li&gt;
&lt;li&gt;Pdf processing libraries&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install Java and Build tools
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Install java&lt;/li&gt;
&lt;li&gt;Install Maven&lt;/li&gt;
&lt;li&gt;install Node + npm&lt;/li&gt;
&lt;li&gt;Download IntelliJ or VSCode&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to build the artifact with dependencies?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Using a Build Tool, so there are special tools to build the artifact&lt;/li&gt;
&lt;li&gt;These tools are specific to the programming language&lt;/li&gt;
&lt;li&gt;For Java:

&lt;ul&gt;
&lt;li&gt;There is &lt;strong&gt;Maven&lt;/strong&gt; and &lt;strong&gt;Gradle&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;For NodeJs Or JavaScritp

&lt;ul&gt;
&lt;li&gt;There are &lt;strong&gt;npm&lt;/strong&gt; and &lt;strong&gt;yarn&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;What These tools do:

&lt;ul&gt;
&lt;li&gt;Install dependencies&lt;/li&gt;
&lt;li&gt;Compile and compress your code&lt;/li&gt;
&lt;li&gt;And can do some other different tasks&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Build tools in Java
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;JAR or WAR file&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maven&lt;/strong&gt;: Uses XML for configuration and is widely used for managing dependencies and building projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gradle:&lt;/strong&gt; Uses Groovy for configuration and is known for its flexibility and performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tools&lt;/th&gt;
&lt;th&gt;Maven&lt;/th&gt;
&lt;th&gt;Gradle&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Language uses&lt;/td&gt;
&lt;td&gt;XML&lt;/td&gt;
&lt;td&gt;Groovy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Which is more convenient for scripting and writing all those tasks for building the code or compiling etc.&lt;/li&gt;
&lt;li&gt;Both have command line tools and commands to execute the tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Gradle commands to execute the Java file (Doing Hands-On)
&lt;/h3&gt;

&lt;p&gt;This command will compile the code, resolve dependencies, and package the application into an artifact using Gradle.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./gradlew build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Gradle, we don’t need to configure how the JAR file is built.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1o9wmqplm3ib0dxksf5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1o9wmqplm3ib0dxksf5h.png" alt="image" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Maven command to execute the Java file
&lt;/h3&gt;

&lt;p&gt;Add this plugin to your &lt;code&gt;pom.xml&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;org&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;springframework&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;groupId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;spring&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;maven&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;artifactId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;!--&lt;/span&gt; &lt;span class="nc"&gt;Specify&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="n"&gt;here&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;executions&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;execution&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;goals&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
               &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;repackage&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;goal&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;goals&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;execution&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;executions&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;plugin&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command will compile the code, run tests, package the application into an artifact, and install it into the local Maven repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0bixh4gf3nsihpdyvlb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm0bixh4gf3nsihpdyvlb.png" alt="image" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Tools for Development (Managing Dependencies)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It would help if you had the build tools also locally when developing the App&lt;/li&gt;
&lt;li&gt;Because you need to run the app locally&lt;/li&gt;
&lt;li&gt;run tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Maven and Gradle have their own dependency files&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dependencies file = Managing the dependencies for the project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Where these Dependencies files lies:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For the maven its - pom.xml&lt;/li&gt;
&lt;li&gt;For the Gradle it's - build.gradle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You need a library to connect your Java application to &lt;strong&gt;ElasticSearch&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find a dependency with name and version&lt;/li&gt;
&lt;li&gt;You add it to the dependencies file (e.g. &lt;code&gt;pom.xml&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Dependency gets downloaded locally (e.g local maven repo)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Run the application
&lt;/h2&gt;

&lt;p&gt;Now let’s say we’ve built an artifact, stored it in the artifact repository, and copied it also on the server.&lt;/p&gt;

&lt;p&gt;Now the question is how do you run the application with the artifact&lt;/p&gt;

&lt;p&gt;This is the command to execute the &lt;code&gt;.jar&lt;/code&gt; file for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// This example is for gradle&lt;/span&gt;
&lt;span class="n"&gt;java&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c1"&gt;//This is an example of Gradle&lt;/span&gt;
&lt;span class="n"&gt;java&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;libs&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;SNAPSHOT&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;jar&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// This example is for Maven&lt;/span&gt;
&lt;span class="n"&gt;java&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="c1"&gt;//This is an example of Maven&lt;/span&gt;
&lt;span class="n"&gt;java&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;jar&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;java&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;maven&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;SNAPSHOT&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;jar&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So if you are on a fresh server where and you have Java installed you can download the artifact from the repository and start the application using above commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build JavaScript application
&lt;/h2&gt;

&lt;p&gt;What about the JavaScrip Application&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JS doesn’t have a special artifact type&lt;/li&gt;
&lt;li&gt;So it can’t be built in ZIP or TAR file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So how do we build a js artifact file as a zip or tar file&lt;/p&gt;

&lt;p&gt;These are the alternatives over Gradle and Maven in JavaScript&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm&lt;/code&gt; - much more widely used&lt;/li&gt;
&lt;li&gt;&lt;code&gt;yarn&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These both contain &lt;strong&gt;package.json&lt;/strong&gt; file for dependencies&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;npm&lt;/strong&gt; and &lt;strong&gt;yarn&lt;/strong&gt; are package managers and &lt;strong&gt;NOT&lt;/strong&gt; build tools&lt;/p&gt;

&lt;p&gt;These package managers install dependencies, but not used for transpiling JavaScript code or JavaScript artifact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;npm repository for dependencies :&lt;/strong&gt; It refers to the npm registry, which is a public repository of JavaScript packages. It is used to find and install dependencies (libraries or modules) required for JavaScript projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Command Line Tools - npm&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;npm start&lt;/code&gt; - start the application&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm stop&lt;/code&gt; - stop the application&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm test&lt;/code&gt; - run the test&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm publish&lt;/code&gt; - publish the artifact&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What does the zip/tar file include?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;application code, but not the dependencies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you &lt;strong&gt;Run the app on the server&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You must install the dependencies first&lt;/li&gt;
&lt;li&gt;Unpack zip/tar&lt;/li&gt;
&lt;li&gt;Run the app&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You need to copy the artifact &amp;amp; package.json file to the server to run the application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To create an artifact file from our node js application&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;npm&lt;/span&gt; &lt;span class="n"&gt;pack&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;JavaScript world is much more flexible than the Java world&lt;/li&gt;
&lt;li&gt;But not as structured and standardized&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the above is about nodejs a backed application but what about frontend application when it comes to package.&lt;/p&gt;

&lt;h2&gt;
  
  
  Package Frontend Code
&lt;/h2&gt;

&lt;p&gt;Different ways to package this&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Package fronted and backend code separately&lt;/li&gt;
&lt;li&gt;Common artifact file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, if we have &lt;strong&gt;reactjs&lt;/strong&gt; and &lt;strong&gt;nodejs&lt;/strong&gt; application both in &lt;strong&gt;Javascript&lt;/strong&gt; than we can have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separate pakcage.json file for frontend and backend&lt;/li&gt;
&lt;li&gt;Common package.json file&lt;/li&gt;
&lt;li&gt;Frontend/react code needs to be &lt;strong&gt;transpiled&lt;/strong&gt;!&lt;/li&gt;
&lt;li&gt;Browser don’t support latest JS versions or other fancy code decorations, like JSX&lt;/li&gt;
&lt;li&gt;The code needs to be &lt;strong&gt;compressed/minified!&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Separate tools for that - Build Tools/Bundler!&lt;/p&gt;

&lt;p&gt;e.g.: &lt;strong&gt;webpack&lt;/strong&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Build Tools - Webpack
&lt;/h3&gt;

&lt;p&gt;Webpack is a build tool that bundles, transpiles, and minifies JavaScript and other assets for frontend applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyovfwzvfch7nbpum0duk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyovfwzvfch7nbpum0duk.png" alt="iamge" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will transpiles, minified, bundles, compresses the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// install the webpack&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt;

&lt;span class="c1"&gt;// It is used to bundle or compress the javascript code&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="nx"&gt;build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Dependencies for Frontend Code
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm&lt;/strong&gt; and &lt;strong&gt;yarn&lt;/strong&gt; for dependencies&lt;/li&gt;
&lt;li&gt;Separate &lt;strong&gt;package.json&lt;/strong&gt; vs. &lt;strong&gt;common package.json&lt;/strong&gt; with backend code&lt;/li&gt;
&lt;li&gt;Can be an advantage to have the same build and package management tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In case react has Java as a backend:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bundle-fronted app with webpack&lt;/li&gt;
&lt;li&gt;manage dependencies with npm or yarn&lt;/li&gt;
&lt;li&gt;package everything into a WAR file&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What are Build tools for other programming languages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;These concepts are similar to other languages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pip&lt;/strong&gt; package manager for python&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkvhlpvnmo8btxka3lbr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkvhlpvnmo8btxka3lbr6.png" alt="image" width="800" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Publish an artifact into the repository
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1721458301213%2Fc3f3a4cd-163d-4f4c-aacc-349db7ddcd41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1721458301213%2Fc3f3a4cd-163d-4f4c-aacc-349db7ddcd41.png" alt="image" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You build the artifact you need to push it to the artifact repository&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build tools have commands for that&lt;/li&gt;
&lt;li&gt;Then you can download (curl, get) it anywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;NOTE: we don’t fetch or push the artifact like that because of Docker.&lt;/p&gt;

&lt;p&gt;The two important things to understand related to these package managers and build tools that we use for different programming languages Docker and another CI/CS pipeline(Jenkins)&lt;/p&gt;

&lt;h2&gt;
  
  
  Build tools &amp;amp; Docker
&lt;/h2&gt;

&lt;p&gt;With Docker, the need to create zip or tar files is reduced. Docker images can directly contain the application code, simplifying the deployment process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With docker, we don't need to build and move different artifact types.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;There is just one artifact type - Docker images&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Now, we build Docker images from the application and we don't need a repository for each file type, no need to move multiple files to the server like package.json, no need to zip, just copy everything into the docker filesystem and run it from docker image.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Docker image is also an artifact&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;In order to start the application you don't need npm or java on the server, execute everything ( command to run the JAR or node application) inside the docker image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpe2fw750dpu879aywkbt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpe2fw750dpu879aywkbt.png" alt="image" width="800" height="768"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;NOTE: For the different Java and javascript applications - we don’t need to create zip or tar files anymore because of docker images because we can directly copy and paste the JS code files into docker image but we have to build the application&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Docker file for Javascript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcsu0k1af234yv80j4nn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcsu0k1af234yv80j4nn.png" alt="image" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker file for java&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9rqe2i90y066w3y4hoy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy9rqe2i90y066w3y4hoy.png" alt="image" width="800" height="259"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Tools for DevOps Engineers
&lt;/h2&gt;

&lt;p&gt;Why should you know these Build Tools?&lt;/p&gt;

&lt;p&gt;DevOps engineers need to understand build tools to assist developers, automate builds, and manage CI/CD pipelines. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Developers install dependencies locally and run the application, but don’t build it locally&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You need to execute tests on the build servers&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm/yarn test&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gradle/mvn test&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Help Developers for building the application&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Because you know where and how it will run&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Build Docker image ⇒ Push to Repo ⇒ Run on Server&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need to configure the build automation tool CI/Cd pipeline&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install dependencies ⇒ run tests ⇒ build/bundle app ⇒ push to repo&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: You don’t run the app locally&lt;/p&gt;

</description>
      <category>npm</category>
      <category>devops</category>
      <category>gradle</category>
      <category>maven</category>
    </item>
    <item>
      <title>You need to learn AWS right Now!</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Mon, 10 Mar 2025 06:39:00 +0000</pubDate>
      <link>https://forem.com/surajkumar00/you-need-to-learn-aws-right-now-49pi</link>
      <guid>https://forem.com/surajkumar00/you-need-to-learn-aws-right-now-49pi</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Amazon Web Services (AWS) is a cloud computing platform that offers a wide range of services such as computing power, storage, databases, and networking. If you're a beginner I’m here to help you with my experience of learning and building project in AWS infrastructure, AWS provides scalable and flexible solutions for building applications.&lt;/p&gt;

&lt;p&gt;In this guide, we'll be exploring the fundamentals of AWS and walk through the setup of &lt;strong&gt;Identity and Access Management (IAM)&lt;/strong&gt;, which is essential for securing your AWS environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvk535g5zpf8903lgs14p.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvk535g5zpf8903lgs14p.gif" alt="image" width="200" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is AWS?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AWS is a &lt;strong&gt;cloud computing service provided&lt;/strong&gt; by &lt;strong&gt;Amazon&lt;/strong&gt; that offers &lt;strong&gt;on-demand computing resources&lt;/strong&gt; over the internet with &lt;strong&gt;pay-as-you-go pricing&lt;/strong&gt;. It eliminates the need for physical hardware, reducing costs and increasing efficiency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfeigys26aygte7qk146.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkfeigys26aygte7qk146.png" alt="image" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Key Features of AWS:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;✅ &lt;strong&gt;Scalability&lt;/strong&gt; – Automatically scales based on demand.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Pay-as-you-go Pricing&lt;/strong&gt; – No upfront costs; pay only for what you use.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Security &amp;amp; Compliance&lt;/strong&gt; – Built-in security measures and compliance with industry standards.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Global Infrastructure&lt;/strong&gt; – Data centers across multiple regions for high availability.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Wide Range of Services&lt;/strong&gt; – Compute, storage, databases, AI/ML, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Popular AWS Services:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;EC2&lt;/strong&gt; – Virtual machines for computing power.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S3&lt;/strong&gt; – Secure object storage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;RDS&lt;/strong&gt; – Managed relational database service.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda&lt;/strong&gt; – Serverless computing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPC&lt;/strong&gt; – Private cloud networking.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’ll discuss most used AWS services in the Cloud/DevOps space in the next blog.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create your AWS account now!
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Prerequisites:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;You’ll need a valid Email Address&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Payment Method (debit card for example) -&lt;/strong&gt; don’t worry, broh 😂, they’re not here to swipe your cash!&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Steps to Create an AWS Account:&lt;/strong&gt;
&lt;/h3&gt;

&lt;h2&gt;
  
  
  My AWS Console:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mfe00dgn2lz5l6rcmfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7mfe00dgn2lz5l6rcmfb.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Understanding IAM (Identity and Access Management)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;AWS IAM is a security service that allows you to manage users, permissions, and access to AWS resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why is IAM Important?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;🔒 &lt;code&gt;Access Control:&lt;/code&gt; Defines who can access AWS resources.&lt;/p&gt;

&lt;p&gt;🔒 &lt;code&gt;Least Privilege Principle:&lt;/code&gt; Assigns only the required permissions to users.&lt;/p&gt;

&lt;p&gt;🔒 &lt;code&gt;Multi-Factor Authentication (MFA):&lt;/code&gt; Enhances security with an additional authentication step.&lt;/p&gt;

&lt;p&gt;🔒 &lt;code&gt;AWS Root User Protection:&lt;/code&gt; Avoid using the root account for daily tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;IAM Components:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Users:&lt;/strong&gt; Individual AWS accounts that have credentials (such as a username, password, or access keys). Each user represents a person or an application that interacts with AWS resources.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fac8q9fgztips5fdr31tk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fac8q9fgztips5fdr31tk.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Groups:&lt;/strong&gt; Collections of users that share the same set of permissions. This makes it easier to manage access controls for multiple users at once.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffeoa1p6b6ixkipfhcwvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffeoa1p6b6ixkipfhcwvq.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Roles:&lt;/strong&gt; Entities that define a set of permissions for AWS services or external identities. Roles allow you to grant temporary access without having to share long-term credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57oco2k2n0j9ztvu4hs2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57oco2k2n0j9ztvu4hs2.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Policies:&lt;/strong&gt; JSON-based documents that define permissions. They specify what actions are allowed or denied on which AWS resources. We can create custom policies which is the used according to use-case.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Example&lt;/code&gt;: A policy is a JSON document that specifies allowed or denied actions. For example, the &lt;strong&gt;S3ReadOnlyAccess&lt;/strong&gt; policy grants read-only access to an S3 bucket.&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"Statement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Effect"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"s3:GetObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"Resource"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:s3:::example-bucket/*"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9rgj7m638g4o7c6zj5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9rgj7m638g4o7c6zj5n.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Setting Up IAM in AWS&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  IAM Dashboard:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2vddp8ki4nqy097dy3i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2vddp8ki4nqy097dy3i.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow these steps to configure IAM for a secure AWS environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Create an AWS IAM User&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Log in to &lt;strong&gt;AWS Management Console&lt;/strong&gt; using the &lt;strong&gt;root account&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;strong&gt;IAM&lt;/strong&gt; → Click on &lt;strong&gt;Users&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Add user&lt;/strong&gt; and specify the user details&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffophcuuo5lqa2fi3fl3n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffophcuuo5lqa2fi3fl3n.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Next&lt;/strong&gt; → set &lt;strong&gt;Permissions&lt;/strong&gt;, Choose the permission options and if you have created group you can attack to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqajfgsr1m9bkkj9uzxos.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqajfgsr1m9bkkj9uzxos.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Next&lt;/strong&gt; → Add &lt;strong&gt;Tags&lt;/strong&gt; (Optional).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Create User&lt;/strong&gt; → Download credentials (.csv file).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Create an IAM Group &amp;amp; Assign Policies&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM&lt;/strong&gt; → Click on &lt;strong&gt;Groups&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create Group&lt;/strong&gt; → Enter &lt;strong&gt;Group Name&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Attach a predefined &lt;strong&gt;IAM policy&lt;/strong&gt; (e.g., &lt;code&gt;AdministratorAccess&lt;/code&gt;, &lt;code&gt;ReadOnlyAccess&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;Users&lt;/strong&gt; to the group → Click &lt;strong&gt;Create Group&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Enable MFA for Extra Security&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;IAM Users&lt;/strong&gt; → Select the &lt;strong&gt;User&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click &lt;strong&gt;Security Credentials&lt;/strong&gt; → Enable &lt;strong&gt;Multi-Factor Authentication (MFA)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5byopr7xtq5ysluzf1h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5byopr7xtq5ysluzf1h.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use an &lt;strong&gt;Authenticator App (Google Authenticator/AWS MFA)&lt;/strong&gt; to scan the QR code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enter the &lt;strong&gt;generated MFA codes&lt;/strong&gt; → Click &lt;strong&gt;Assign MFA&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Use IAM Role for AWS Services&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;An &lt;strong&gt;IAM Role&lt;/strong&gt; is an AWS identity with a set of permissions that determine what actions are allowed or denied. Unlike IAM users, roles do not have long-term credentials (passwords or access keys). Instead, they provide &lt;strong&gt;temporary security credentials&lt;/strong&gt; to AWS services or external identities.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;strong&gt;IAM&lt;/strong&gt; → Click &lt;strong&gt;Roles&lt;/strong&gt; → &lt;strong&gt;Create Role&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Choose &lt;strong&gt;AWS Service&lt;/strong&gt; (e.g., EC2, Lambda).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8apw2s9j0bizn6scorok.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8apw2s9j0bizn6scorok.png" alt="image" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attach a &lt;strong&gt;Policy&lt;/strong&gt; (e.g., &lt;code&gt;AmazonS3FullAccess&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click &lt;strong&gt;Create Role&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Best Practices for AWS IAM Security&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;✅ &lt;strong&gt;Use IAM Users Instead of Root Account&lt;/strong&gt; – The root account should be used only for account setup and billing.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Follow the Principle of Least Privilege&lt;/strong&gt; – Grant only necessary permissions.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Enable MFA for All Users&lt;/strong&gt; – Adds an extra layer of security.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Rotate Access Keys Regularly&lt;/strong&gt; – Prevents unauthorized access.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Monitor IAM Activity with CloudTrail&lt;/strong&gt; – Track API calls and security events.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Use IAM Roles for Applications&lt;/strong&gt; – Avoid hardcoding credentials in code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The end!
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Hey guys, thanks for the reading, I hope you have learned something valuable today via this blog. Let me know in the comment if you have any doubt or anything you want to say. I would love to reply.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>devops</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>95% Of Software Engineers Aren't Using This Simple Git Trick</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Tue, 18 Feb 2025 11:17:17 +0000</pubDate>
      <link>https://forem.com/surajkumar00/95-of-software-engineers-arent-using-this-simple-git-trick-1kh</link>
      <guid>https://forem.com/surajkumar00/95-of-software-engineers-arent-using-this-simple-git-trick-1kh</guid>
      <description>&lt;p&gt;If you work with Git regularly, you know that &lt;code&gt;git log&lt;/code&gt; can be overwhelming, displaying a long list of commit hashes, authors, dates, and messages in a cluttered format.&lt;/p&gt;

&lt;p&gt;To make your logs more readable and visually appealing, you can create a custom Git alias:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias glp='git log --pretty=format:"%C(yellow)%h%Creset - %C(green)%an%Creset, %ar : %s"'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What This Alias Does:
&lt;/h3&gt;

&lt;p&gt;Instead of the default &lt;code&gt;git log&lt;/code&gt; output, this alias presents commit history in a concise, color-coded format:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;%h&lt;/strong&gt; → Shows the short commit hash in &lt;strong&gt;yellow&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;%an&lt;/strong&gt; → Displays the author’s name in &lt;strong&gt;green&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;%ar&lt;/strong&gt; → Indicates the commit time relative to now (e.g., &lt;em&gt;"2 hours ago"&lt;/em&gt; or &lt;em&gt;"3 days ago"&lt;/em&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;%s&lt;/strong&gt; → Displays the commit message.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example Output:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ro3lzuwt9av7lk43mdh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ro3lzuwt9av7lk43mdh.png" alt="Image" width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Making the Alias Permanent
&lt;/h3&gt;

&lt;p&gt;By default, the alias will only work in the current terminal session. Once you close the terminal, it will be lost. Follow these steps to make it permanent:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Check Your Current Shell&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before adding the alias, check which shell you are using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $SHELL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the output is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/bin/bash&lt;/code&gt; → You are using &lt;strong&gt;Bash&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/bin/zsh&lt;/code&gt; → You are using &lt;strong&gt;Zsh&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is important because the alias should be added to the correct configuration file.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Add the Alias to the Correct File&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;✅ &lt;strong&gt;For Bash Users:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Edit the &lt;code&gt;~/.bashrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following line at the end of the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias glp='git log --pretty=format:"%C(yellow)%h%Creset - %C(green)%an%Creset, %ar : %s"'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file (&lt;code&gt;CTRL + X&lt;/code&gt;, then &lt;code&gt;Y&lt;/code&gt;, then &lt;code&gt;Enter&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;For Zsh Users:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Edit the &lt;code&gt;~/.zshrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the alias at the end of the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias glp='git log --pretty=format:"%C(yellow)%h%Creset - %C(green)%an%Creset, %ar : %s"'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file (&lt;code&gt;CTRL + X&lt;/code&gt;, then &lt;code&gt;Y&lt;/code&gt;, then &lt;code&gt;Enter&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Apply the Changes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For &lt;strong&gt;Bash&lt;/strong&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;Zsh&lt;/strong&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Test the Alias&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Now, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;glp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the alias works, you’ll see a clean and structured Git log output.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What If the Alias Still Doesn't Work?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you are using &lt;strong&gt;Bash&lt;/strong&gt; and see errors like &lt;code&gt;command not found: shopt&lt;/code&gt;, your &lt;code&gt;~/.bashrc&lt;/code&gt; file might be corrupted.&lt;/p&gt;

&lt;p&gt;To fix it, reset your Bash configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv ~/.bashrc ~/.bashrc.bak  # Backup old file
cp /etc/skel/.bashrc ~/.bashrc  # Restore default bashrc
source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, re-add the alias and try again.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why Use This?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Improved readability&lt;/strong&gt; – No more overwhelming logs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quick insights&lt;/strong&gt; – Easily see who made a commit and when.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better debugging&lt;/strong&gt; – Quickly locate specific changes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By customizing your Git workflow with aliases like this, you can make working with Git much more efficient. 🚀&lt;/p&gt;

&lt;p&gt;Try it out and streamline your Git experience!&lt;/p&gt;

</description>
      <category>git</category>
      <category>developers</category>
    </item>
    <item>
      <title>Let's Learn Linux: Introduction</title>
      <dc:creator>Suraj</dc:creator>
      <pubDate>Tue, 18 Feb 2025 08:19:55 +0000</pubDate>
      <link>https://forem.com/surajkumar00/introduction-to-linux-1nnl</link>
      <guid>https://forem.com/surajkumar00/introduction-to-linux-1nnl</guid>
      <description>&lt;h2&gt;
  
  
  Let's first understand what is Operating System(O.S):
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;strong&gt;OS is system software&lt;/strong&gt; that &lt;strong&gt;manages&lt;/strong&gt; &lt;strong&gt;computer hardware&lt;/strong&gt; and &lt;strong&gt;software resources&lt;/strong&gt; and provides common services for computer programs.&lt;/li&gt;
&lt;li&gt;In a nutshell, An OS is software that &lt;strong&gt;acts as a middleman&lt;/strong&gt; or &lt;strong&gt;a bridge&lt;/strong&gt; between c*&lt;em&gt;omputer hardware and the computer user&lt;/em&gt;*. It provides a user interface and controls the computer hardware so that software can function.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Types of OS:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Desktop OS&lt;/strong&gt;: Windows, macOS, Linux such as Ubuntu&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server OS:&lt;/strong&gt; Windows server, Linux distributions like CentOs, Red Hat Enterprise Linux&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mobile OS:&lt;/strong&gt; Android, iOS, Windows Mobile&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Embedded OS&lt;/strong&gt;: used in devices like routers, smart TVs, automobiles, home appliances, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-Time OS&lt;/strong&gt;: used in critical systems like medical equipment, car ECUs, aerospace, defense, network firewalls, home security systems, etc.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is Linux:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It is a free and open-source OS, and it is:

&lt;ul&gt;
&lt;li&gt;Secure&lt;/li&gt;
&lt;li&gt;Distributed&lt;/li&gt;
&lt;li&gt;Fast&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Its open-source nature means that a community of developers and users contribute to its development.&lt;/li&gt;

&lt;li&gt;It’s similar to Windows and macOS, but it’s different in several ways&lt;/li&gt;

&lt;li&gt;Linux is very popular for its &lt;strong&gt;stability&lt;/strong&gt;, &lt;strong&gt;security&lt;/strong&gt;, and &lt;strong&gt;flexibility&lt;/strong&gt;. It can be modified and distributed by anyone, which has led to many different versions, known as “&lt;strong&gt;distributions&lt;/strong&gt;” and each distribution is tailored(for a particular purpose) for different users.&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why learn Linux or its importance:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Widely used in servers and cloud computing&lt;/li&gt;
&lt;li&gt;corporate world uses Linux as their primary OS&lt;/li&gt;
&lt;li&gt;Free software philosophy&lt;/li&gt;
&lt;li&gt;Strong command line interface&lt;/li&gt;
&lt;li&gt;Faster processing (because of CLI)&lt;/li&gt;
&lt;li&gt;Enhanced security&lt;/li&gt;
&lt;li&gt;Customization because of the open-source nature&lt;/li&gt;
&lt;li&gt;Community support&lt;/li&gt;
&lt;li&gt;Understanding of other OS&lt;/li&gt;
&lt;li&gt;Career opportunities&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Linus is a kernel-based Operating System:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;What is the kernel:&lt;/strong&gt; The core of the &lt;strong&gt;UNIX&lt;/strong&gt; system. &lt;strong&gt;Kernel&lt;/strong&gt; is the &lt;strong&gt;heart&lt;/strong&gt; of your operating system because it establishes the communication between the hardware and the software.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Below is the Architecture:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0k27qcks9xmpytagptct.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0k27qcks9xmpytagptct.png" alt="Image" width="516" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyjox7enjx5touczv8rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbyjox7enjx5touczv8rk.png" alt="image" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Basically, kernel has four primary responsibilities:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Device managemant&lt;/li&gt;
&lt;li&gt;Memory management&lt;/li&gt;
&lt;li&gt;Process management&lt;/li&gt;
&lt;li&gt;Handling for your &lt;strong&gt;system calls&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  History of Linux:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Before Linux:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;UNIX&lt;/strong&gt;: Developed in the 1970s at AT&amp;amp;T Bell Labs by Ken Thompson and Dennis Ritchie - &lt;strong&gt;UNIX is a proprietary operating system&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GNU Project&lt;/strong&gt;: In 1983, Richard Stallman launched the GNU(GNU’s Not UNIX) project - &lt;strong&gt;GNU is a free and open-source software&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;While many tools and utilities were developed under the GNU project, a completely free OS was missing &lt;strong&gt;a kernel.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Birth of Linux:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;1991: A 21-year-old Finland student named &lt;strong&gt;Linus Torvalds&lt;/strong&gt; started developing a free OS kernel as a hobby project.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On August 25, 1991, Linus announced his project on the Minix newsgroup.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I’m doing a (free) operating system (just a hobby, won’t be big and professional like GNU”)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Version 0.01 was released in September 1991&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not Functional&lt;/li&gt;
&lt;li&gt;Released to the public&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Version 0.02 Later in 1991&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functional&lt;/li&gt;
&lt;li&gt;Combined with the utilities from the GNU project&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;It formed a completely free operating system.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Growth and Evolution:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The early 1990s: Linux rapidly evolved through collaboration over the Internet.

&lt;ul&gt;
&lt;li&gt;So many distributions came like &lt;strong&gt;Slackware and Debian.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;1993: Linux 1.0 was released with &lt;strong&gt;176k lines of code.&lt;/strong&gt;
&lt;/li&gt;

&lt;li&gt;Late 1990s: Commercial interest in Linux grew.

&lt;ul&gt;
&lt;li&gt;Like &lt;strong&gt;Red Hat and SUSE&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;2000s: Linux saw significant adoption in server markets.&lt;/li&gt;

&lt;li&gt;In 2007, Google released the Android OS for Mobile devices.&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Today:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Linux has grown from a hobbyist’s project into a powerful force in computing, powering everything from mobile devices, personal computers, and servers to mainframes and supercomputers.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;So simply put, the story of Linux isn’t about a computer system. It’s about great people from all over the world working together and making this reliable, secure, and open-source operating system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Important things to remember in Linux:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Linux has a super-user account called root

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;root&lt;/strong&gt; is the most powerful account that can create, modify, delete accounts, and make changes to system configuration files. It even can delete the entire operating system.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Linux is a case-sensitive system

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ABC&lt;/strong&gt; is NOT the same as &lt;strong&gt;abc&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Avoid using spaces when creating files and directories&lt;/li&gt;

&lt;li&gt;Linux kernel is not an OS. It is a small software within Linux OS that takes commands from users and passes them to system hardware or peripherals.&lt;/li&gt;

&lt;li&gt;Linux is mostly CLI, not GUI&lt;/li&gt;

&lt;li&gt;Linux is very flexible as compared to other operating systems.&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Linux Filesystem:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It is a system used by an operating system to manage files. The system controls how data is saved or retrieved.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;These are the Linux file system:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ext4&lt;/strong&gt;: This is the most widely used file system in Linux and it is known for its high performance, reliability, and scalability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;XFS&lt;/strong&gt;: This is a high-performance file system that is optimized for large-scale data storage and is commonly used in enterprise and high-performance computing environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Btrfs&lt;/strong&gt;: This is a newer file system that is designed to be flexible, scalable, and easy to manage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;These are the Windows files system:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;NTFS&lt;/strong&gt;: This is a file system commonly used in Microsoft Windows and it is supported by most modern Linux distributions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FAT32&lt;/strong&gt;: This is an older file system that is commonly used in older Microsoft Windows systems and is also widely used for removable storage devices such as USB drives and has limitations such as a maximum file size of 4GB.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  File System Structure and its Description:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;/&lt;/strong&gt; (Root Directory): The top-level directory that contains the entire file system hierarchy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/boot:&lt;/strong&gt; Holds files essential for the system's boot process, including the kernel and bootloader configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/bin:&lt;/strong&gt; Contains fundamental binary executables (commands) accessible to all users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/etc:&lt;/strong&gt; Stores system-wide configuration files and directories, including application-specific configurations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/home:&lt;/strong&gt; Home directories for individual users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/lib and /lib64:&lt;/strong&gt; Libraries required for the functioning of executables in &lt;code&gt;/bin&lt;/code&gt; and &lt;code&gt;/sbin&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/sbin:&lt;/strong&gt; Contains system binaries used for system administration tasks, requiring superuser privileges.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/usr:&lt;/strong&gt; Holds user-related programs, libraries, and documentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/var:&lt;/strong&gt; Contains variable data such as log files, mail, and temporary files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/tmp:&lt;/strong&gt; A directory for temporary files accessible to all users; contents are typically cleared on system reboot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/dev:&lt;/strong&gt; Contains device files representing physical and virtual devices attached to the system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/proc:&lt;/strong&gt; A virtual file system providing information about processes and system resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/sys:&lt;/strong&gt; A virtual file system exposing kernel parameters and settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/mnt:&lt;/strong&gt; Traditionally used as a mount point for temporary filesystems or external devices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/opt:&lt;/strong&gt; Used for the installation of additional software packages not part of the default system installation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/srv:&lt;/strong&gt; Intended for data served by the system, such as website content or file-sharing services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/root:&lt;/strong&gt; Home directory for the root user (superuser).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/run:&lt;/strong&gt; A temporary filesystem holding runtime information about the system since the last boot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;/lost+found:&lt;/strong&gt; Used by the &lt;code&gt;fsck&lt;/code&gt; utility to store recovered files and fragments during filesystem repair.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;fsck&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fsck&lt;/code&gt; is a command-line utility used for checking and repairing file system inconsistencies, and the &lt;code&gt;/lost+found&lt;/code&gt; directory is used by &lt;code&gt;fsck&lt;/code&gt; to store recovered files and fragments during the repair process.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What is Root?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There are 3 types of root in the Linux system:

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Root account:&lt;/strong&gt; root is an account or a username on a Linux machine and it is the most powerful account that has access to all commands and files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Root as /:&lt;/strong&gt; the very first directory in Linux is also referred to as a root directory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Root home directory:&lt;/strong&gt; the root user account also has a directory located in /root which is called root home directory and accessed by /home command.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Linux file types:
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1rqyou9qqg64exo0v6x2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1rqyou9qqg64exo0v6x2.png" alt="image" width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above you can see the file type starts with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;d - is a directory&lt;/li&gt;
&lt;li&gt;' - ' is a file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below you can see more:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvf3h4yqxy2xl5y7y0z5h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvf3h4yqxy2xl5y7y0z5h.png" alt="image" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  File System Paths:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;There are two paths to navigate to a filesystem:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Absolute Path:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;An absolute path always begins with a '/'. This indicates that the path starts at the root directory. An example of an absolute path is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cd /var/log/suraj&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ol&gt;

&lt;/li&gt;

&lt;/ul&gt;
&lt;br&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2. &lt;strong&gt;Relative Path:&lt;/strong&gt;&lt;br&gt;
    - A relative path does not begin with a “/”. It identifies a location relative to your current position. An example of a relative path is:
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    `cd /var`

    `cd log`

    `cd suraj`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Find Files and Directories:&lt;br&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Two main commands are used to find files/directories

&lt;ul&gt;
&lt;li&gt;find&lt;/li&gt;
&lt;li&gt;locate&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  These are the key differences between find and locate
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;locate&lt;/strong&gt;, uses a prebuilt database, which should be regularly updated, while &lt;strong&gt;find&lt;/strong&gt; iterates over a filesystem to locate files. Thus, locate is much faster than find, but can be inaccurate if the database (can be seen as a &lt;strong&gt;cache&lt;/strong&gt;) is not updated.&lt;/li&gt;
&lt;li&gt;to update &lt;strong&gt;locate&lt;/strong&gt; database run &lt;strong&gt;updatedb&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is how we can do it hands-on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fujzuxv0ckk1z6pd0ug43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fujzuxv0ckk1z6pd0ug43.png" alt="image" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  WildCards:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A wildcard is a character that can be used as a substitute for any of class of characters in a search

&lt;ul&gt;
&lt;li&gt;represents zero or more characters&lt;/li&gt;
&lt;li&gt;? - represents a single character&lt;/li&gt;
&lt;li&gt;[ ]  represents a range of character&lt;/li&gt;
&lt;li&gt;do explore other wildcards&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Here is how we can do it hands-on:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9dgp5y6ub3sky50bkwt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9dgp5y6ub3sky50bkwt.png" alt="image" width="800" height="812"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The end: I'm pretty sure with you'll fall in love with LInux. So do explore linux at your own and see you in the next part.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>linux</category>
      <category>cli</category>
      <category>terminal</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
