<?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: KALPESH</title>
    <description>The latest articles on Forem by KALPESH (@kalpesh47).</description>
    <link>https://forem.com/kalpesh47</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%2F3808502%2F8fb391da-71fa-4e30-8610-55972618d98c.jpg</url>
      <title>Forem: KALPESH</title>
      <link>https://forem.com/kalpesh47</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kalpesh47"/>
    <language>en</language>
    <item>
      <title>Running Local GGUF Models with Ollama (GPU Enabled)</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Sat, 16 May 2026 11:21:48 +0000</pubDate>
      <link>https://forem.com/kalpesh47/running-local-gguf-models-with-ollama-gpu-enabled-c6</link>
      <guid>https://forem.com/kalpesh47/running-local-gguf-models-with-ollama-gpu-enabled-c6</guid>
      <description>&lt;h2&gt;
  
  
  1. Install &amp;amp; Start Ollama
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-fsSL&lt;/span&gt; https://ollama.com/install.sh | sh
systemctl start ollama
ollama &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. Verify GPU Detection
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;NVIDIA&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;nvidia-smi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;AMD&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;rocm-smi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Set Up Model Directory
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; ~/Documents/LLM
&lt;span class="nb"&gt;cd&lt;/span&gt; ~/Documents/LLM
&lt;span class="c"&gt;# Copy your .gguf file here&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Create a Modelfile
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim Modelfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vim quick reference:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;i&lt;/code&gt; — enter insert mode (start typing)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Esc&lt;/code&gt; — exit insert mode&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:wq&lt;/code&gt; — save and quit&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;:q!&lt;/code&gt; — quit without saving
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; ./Phi-4-mini-instruct-Q4_K_M.gguf&lt;/span&gt;

SYSTEM """
You are a helpful AI assistant.
"""

TEMPLATE """&amp;lt;|user|&amp;gt;
{{ .Prompt }}&amp;lt;|end|&amp;gt;
&amp;lt;|assistant|&amp;gt;
"""

PARAMETER stop "&amp;lt;|user|&amp;gt;"
PARAMETER stop "&amp;lt;|assistant|&amp;gt;"
PARAMETER stop "&amp;lt;|end|&amp;gt;"
PARAMETER temperature 0.7
PARAMETER num_ctx 8192
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Always include &lt;code&gt;TEMPLATE&lt;/code&gt; for custom GGUFs. Use instruct/chat variants, not base models.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  5. Create &amp;amp; Run the Model
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ollama create mymodel &lt;span class="nt"&gt;-f&lt;/span&gt; Modelfile
ollama run mymodel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  6. Verify GPU Usage
&lt;/h2&gt;

&lt;p&gt;Open a second terminal and monitor VRAM — an increase confirms GPU acceleration.&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;# NVIDIA&lt;/span&gt;
watch &lt;span class="nt"&gt;-n&lt;/span&gt; 1 nvidia-smi

&lt;span class="c"&gt;# AMD&lt;/span&gt;
watch &lt;span class="nt"&gt;-n&lt;/span&gt; 1 rocm-smi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To confirm via logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; ollama &lt;span class="nt"&gt;-f&lt;/span&gt;
&lt;span class="c"&gt;# Look for: "using CUDA" or "offloading layers to GPU"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  7. Ollama Command Reference
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Model Management
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pull a model&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama pull &amp;lt;model&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Create from Modelfile&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama create &amp;lt;name&amp;gt; -f Modelfile&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;List installed models&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama list&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Show model details&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama show &amp;lt;model&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Copy a model&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama cp &amp;lt;source&amp;gt; &amp;lt;dest&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remove a model&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama rm &amp;lt;model&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Push model to registry&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama push &amp;lt;model&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Running Models
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Run model (interactive)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama run &amp;lt;model&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run with single prompt&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama run &amp;lt;model&amp;gt; "your prompt"&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Run with stdin input&lt;/td&gt;
&lt;td&gt;`echo "prompt" \&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Show running models&lt;/td&gt;
&lt;td&gt;{% raw %}&lt;code&gt;ollama ps&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stop a running model&lt;/td&gt;
&lt;td&gt;&lt;code&gt;ollama stop &amp;lt;model&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  In-Chat Commands
&lt;/h3&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;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/clear&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clear chat history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/bye&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Exit chat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/set parameter &amp;lt;key&amp;gt; &amp;lt;val&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Change param on the fly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/show info&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show model info&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/show modelfile&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show current Modelfile&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/show parameters&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show active parameters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/help&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List all in-chat commands&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  API (REST)
&lt;/h3&gt;

&lt;p&gt;Ollama runs a local server at &lt;code&gt;http://localhost:11434&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;&lt;span class="c"&gt;# Generate (single turn)&lt;/span&gt;
curl http://localhost:11434/api/generate &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
  "model": "mymodel",
  "prompt": "Explain Docker in simple terms",
  "stream": false
}'&lt;/span&gt;

&lt;span class="c"&gt;# Chat (multi-turn)&lt;/span&gt;
curl http://localhost:11434/api/chat &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
  "model": "mymodel",
  "messages": [
    { "role": "user", "content": "Hello!" }
  ]
}'&lt;/span&gt;

&lt;span class="c"&gt;# List models via API&lt;/span&gt;
curl http://localhost:11434/api/tags

&lt;span class="c"&gt;# Check running models&lt;/span&gt;
curl http://localhost:11434/api/ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  8. Manage Ollama Service (systemctl)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Start / Stop / Restart
&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 Ollama service&lt;/span&gt;
systemctl start ollama

&lt;span class="c"&gt;# Stop Ollama service&lt;/span&gt;
systemctl stop ollama

&lt;span class="c"&gt;# Restart Ollama service&lt;/span&gt;
systemctl restart ollama
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Status &amp;amp; Logs
&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;# Check service status&lt;/span&gt;
systemctl status ollama

&lt;span class="c"&gt;# View live logs&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; ollama &lt;span class="nt"&gt;-f&lt;/span&gt;

&lt;span class="c"&gt;# View last 50 log lines&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; ollama &lt;span class="nt"&gt;-n&lt;/span&gt; 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Enable / Disable on Boot
&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;# Enable Ollama to start on boot&lt;/span&gt;
systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;ollama

&lt;span class="c"&gt;# Disable autostart&lt;/span&gt;
systemctl disable ollama

&lt;span class="c"&gt;# Check if enabled&lt;/span&gt;
systemctl is-enabled ollama
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  9. Gollama — Chat TUI for Ollama
&lt;/h2&gt;

&lt;p&gt;Gollama is a terminal chat interface for Ollama with conversation history saved via SQLite.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Go (Fedora)
&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;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;golang &lt;span class="nt"&gt;-y&lt;/span&gt;
go version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Gollama
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;go &lt;span class="nb"&gt;install &lt;/span&gt;github.com/gaurav-gosain/gollama@latest

&lt;span class="c"&gt;# Add Go binaries to PATH&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export PATH=$PATH:~/go/bin'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.bashrc
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Launch
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Keyboard Shortcuts
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;th&gt;Action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;↑&lt;/code&gt; / &lt;code&gt;k&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Navigate up&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;↓&lt;/code&gt; / &lt;code&gt;j&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Navigate down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+N&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;New chat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fuzzy search chats&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Delete chat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctrl+C&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Quit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>ai</category>
      <category>linux</category>
      <category>llm</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Running Production-Grade Databases on K8s</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Sun, 03 May 2026 19:23:22 +0000</pubDate>
      <link>https://forem.com/kalpesh47/running-production-grade-databases-on-kubernetes-a-complete-guide-1f53</link>
      <guid>https://forem.com/kalpesh47/running-production-grade-databases-on-kubernetes-a-complete-guide-1f53</guid>
      <description>&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%2Fq55kbstb6mso0a0mo4fc.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%2Fq55kbstb6mso0a0mo4fc.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Who this is for:&lt;/strong&gt; Developers and DevOps engineers who want to understand how to run databases reliably on Kubernetes — from the basics of StatefulSets, to replication consistency, to choosing between self-managed and Operator-based approaches.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Why Databases on Kubernetes Are Tricky&lt;/li&gt;
&lt;li&gt;Your Three Options&lt;/li&gt;
&lt;li&gt;Understanding StatefulSets&lt;/li&gt;
&lt;li&gt;How Replication Works&lt;/li&gt;
&lt;li&gt;Avoiding Data Inconsistency&lt;/li&gt;
&lt;li&gt;Self-Managed vs Kubernetes Operator&lt;/li&gt;
&lt;li&gt;Detailed Task Comparison&lt;/li&gt;
&lt;li&gt;When to Choose What&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. Why Databases on Kubernetes Are Tricky
&lt;/h2&gt;

&lt;p&gt;Kubernetes was originally designed for &lt;strong&gt;stateless&lt;/strong&gt; workloads — apps where any pod can be replaced at any time without data loss. A web server is stateless. A database is not.&lt;/p&gt;

&lt;p&gt;Databases are &lt;strong&gt;stateful&lt;/strong&gt; — they hold your data on disk, they have a concept of a primary (the one that accepts writes) and replicas (copies), and if you restart them carelessly, you risk data corruption or split-brain scenarios.&lt;/p&gt;

&lt;p&gt;Over time, the Kubernetes community built proper support for stateful workloads in the form of &lt;strong&gt;StatefulSets&lt;/strong&gt; (stable since Kubernetes v1.9). But even with StatefulSets, running a database in production requires deep knowledge and careful planning.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Your Three Options
&lt;/h2&gt;

&lt;p&gt;When you need a database for your app running in Kubernetes, you have three broad options:&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1 — Cloud Provider Managed Database (AWS RDS, GCP Cloud SQL, Azure Database)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pros&lt;/th&gt;
&lt;th&gt;Cons&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Easy to get started&lt;/td&gt;
&lt;td&gt;Not your DBA — slow queries are your problem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Managed backups&lt;/td&gt;
&lt;td&gt;Vendor lock-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;High availability built-in&lt;/td&gt;
&lt;td&gt;Limited customization (can't add extensions freely)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Expensive at scale (usage-based pricing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;No support for air-gapped / data-sovereignty requirements&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Option 2 — Database Vendor Hosted Service (MongoDB Atlas, Elastic Cloud, PlanetScale)
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pros&lt;/th&gt;
&lt;th&gt;Cons&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Optimized for that specific database&lt;/td&gt;
&lt;td&gt;Same vendor lock-in issues as cloud providers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deep expertise from the vendor&lt;/td&gt;
&lt;td&gt;Only offers their one database engine&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;Can get expensive at scale&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Option 3 — Self-hosted Inside Kubernetes
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pros&lt;/th&gt;
&lt;th&gt;Cons&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Full control&lt;/td&gt;
&lt;td&gt;Requires deep Kubernetes + DB knowledge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No vendor lock-in&lt;/td&gt;
&lt;td&gt;All operational tasks fall on you&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Works on-premises or any cloud&lt;/td&gt;
&lt;td&gt;High risk if done carelessly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Most flexible&lt;/td&gt;
&lt;td&gt;Time-consuming to maintain&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The good news:&lt;/strong&gt; Option 3 can be made dramatically safer and simpler by using a &lt;strong&gt;Kubernetes Operator&lt;/strong&gt; — covered in depth later in this guide.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. Understanding StatefulSets
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What Makes StatefulSets Different from Deployments
&lt;/h3&gt;

&lt;p&gt;A regular Kubernetes &lt;code&gt;Deployment&lt;/code&gt; treats all pods as interchangeable. Pod names are random (&lt;code&gt;app-7d9f4b-xkqjp&lt;/code&gt;), and they can be created or destroyed in any order.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;StatefulSet&lt;/code&gt; gives each pod a &lt;strong&gt;stable, predictable identity&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myapp-0   ← always the first pod (usually the primary)
myapp-1   ← always the second pod (replica)
myapp-2   ← always the third pod (replica)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These names are permanent. If &lt;code&gt;myapp-1&lt;/code&gt; crashes and restarts, it comes back as &lt;code&gt;myapp-1&lt;/code&gt; — not a new random name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Three Guarantees StatefulSets Provide
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Ordered startup&lt;/strong&gt; — Pods start one at a time, in order. &lt;code&gt;myapp-1&lt;/code&gt; will not start until &lt;code&gt;myapp-0&lt;/code&gt; is &lt;code&gt;Running&lt;/code&gt; and &lt;code&gt;Ready&lt;/code&gt;. This is critical because replicas need the primary to exist before they can sync from it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Stable network identity&lt;/strong&gt; — Each pod gets a predictable DNS name via a headless service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myapp-0.myapp-svc.default.svc.cluster.local
myapp-1.myapp-svc.default.svc.cluster.local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This lets replicas always know exactly where to find the primary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Stable storage (PersistentVolumeClaim per pod)&lt;/strong&gt; — Each pod gets its own dedicated disk. If &lt;code&gt;myapp-1&lt;/code&gt; dies and is rescheduled on a different node, it reattaches to the same PVC and picks up exactly where it left off — no data loss.&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="c1"&gt;# Simplified StatefulSet example&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;StatefulSet&lt;/span&gt;
&lt;span class="na"&gt;metadata&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;myapp&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;serviceName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;myapp-svc"&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myapp&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myapp&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;containers&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;mysql&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mysql:8.0&lt;/span&gt;
        &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3306&lt;/span&gt;
  &lt;span class="na"&gt;volumeClaimTemplates&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;           &lt;span class="c1"&gt;# ← Each pod gets its own PVC&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;metadata&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;data&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;accessModes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ReadWriteOnce"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10Gi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. How Replication Works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Primary-Replica Model
&lt;/h3&gt;

&lt;p&gt;In a typical database StatefulSet with 3 replicas:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client App
   │
   ├──── WRITE ──► myapp-0 (Primary)   ← Only pod that accepts writes
   │                    │
   │              replication
   │                    │
   └──── READ  ──► myapp-1 (Replica)   ← Read-only, synced from primary
                   myapp-2 (Replica)   ← Read-only, synced from primary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Rule #1: All writes go to the primary only.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The primary pod (&lt;code&gt;myapp-0&lt;/code&gt;) is the single source of truth. You connect to it using its stable DNS name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myapp-0.myapp-svc.default.svc.cluster.local:3306
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replicas will reject write operations at the database level (MySQL, PostgreSQL, and MongoDB all enforce this automatically).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule #2: Reads can be distributed across replicas.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This improves read throughput and reduces load on the primary. You connect to replicas using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;myapp-1.myapp-svc.default.svc.cluster.local:3306
myapp-2.myapp-svc.default.svc.cluster.local:3306
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use the headless service DNS to load-balance across all replicas.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ordered Startup in Detail
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Time 0: myapp-0 starts → initializes as primary
Time 1: myapp-0 is Running + Ready
Time 2: myapp-1 starts → connects to myapp-0, begins sync
Time 3: myapp-1 is Running + Ready
Time 4: myapp-2 starts → connects to myapp-0, begins sync
Time 5: myapp-2 is Running + Ready
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;myapp-0&lt;/code&gt; takes too long to start, Kubernetes waits. It will never start &lt;code&gt;myapp-1&lt;/code&gt; until &lt;code&gt;myapp-0&lt;/code&gt; passes its readiness probe.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Avoiding Data Inconsistency
&lt;/h2&gt;

&lt;p&gt;This is the most important section. Replication introduces a window where replicas may not have the latest data from the primary. Here's how to handle it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Problem: Replication Lag
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Asynchronous replication&lt;/strong&gt; (the default in most databases) means:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client writes to primary → primary commits → returns success to client&lt;/li&gt;
&lt;li&gt;Primary sends the change to replicas in the background&lt;/li&gt;
&lt;li&gt;Replicas apply the change a few milliseconds (or more) later&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a client writes data and then immediately reads from a replica, they might get &lt;strong&gt;stale data&lt;/strong&gt; — the replica hasn't caught up yet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client:  writes  "balance = 1000"  to primary
Client:  reads   "balance"         from replica  →  gets "500"  ← STALE!
         (replica hasn't received the update yet)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Synchronous replication&lt;/strong&gt; solves this but at a cost — the primary waits for the replica to confirm before returning success to the client. Writes are slower, but every replica is always up to date.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution 1 — Route critical reads to the primary
&lt;/h3&gt;

&lt;p&gt;For operations where you cannot tolerate stale data (payment confirmations, inventory checks), always read from the primary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="o"&gt;#&lt;/span&gt; &lt;span class="n"&gt;Critical&lt;/span&gt; &lt;span class="k"&gt;read&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="k"&gt;primary&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;balance&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="k"&gt;connect&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;svc&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;#&lt;/span&gt; &lt;span class="n"&gt;Non&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;critical&lt;/span&gt; &lt;span class="k"&gt;read&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="n"&gt;replica&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dashboards&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reports&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'2024-01-01'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="k"&gt;connect&lt;/span&gt; &lt;span class="k"&gt;to&lt;/span&gt; &lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;myapp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;svc&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;replica&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Solution 2 — Use readiness probes to block traffic until synced
&lt;/h3&gt;

&lt;p&gt;A pod's readiness probe tells Kubernetes whether the pod is ready to receive traffic. Add a custom check that verifies the replica's replication lag before marking it ready:&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;readinessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;exec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/bin/sh&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;-c&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
      &lt;span class="s"&gt;# Only mark ready if replication lag &amp;lt; 5 seconds&lt;/span&gt;
      &lt;span class="s"&gt;mysql -e "SHOW SLAVE STATUS\G" | grep "Seconds_Behind_Master: 0"&lt;/span&gt;
  &lt;span class="na"&gt;initialDelaySeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30&lt;/span&gt;
  &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Until this probe passes, Kubernetes routes &lt;strong&gt;zero traffic&lt;/strong&gt; to the pod. This prevents dirty reads from a partially synced replica.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution 3 — Use PodDisruptionBudgets to prevent unsafe scaling
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;PodDisruptionBudget&lt;/code&gt; ensures that at least N pods remain available during voluntary disruptions (node upgrades, pod evictions):&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;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;policy/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PodDisruptionBudget&lt;/span&gt;
&lt;span class="na"&gt;metadata&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;myapp-pdb&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;minAvailable&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;        &lt;span class="c1"&gt;# Always keep at least 2 pods running&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;myapp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This prevents a scenario where all replicas go down at the same time, leaving only the primary — which then has no failover if it crashes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solution 4 — Never write to replicas
&lt;/h3&gt;

&lt;p&gt;Enforce this at the application level. Use two separate connection pools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Python example (pseudocode)
&lt;/span&gt;&lt;span class="n"&gt;write_db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;myapp-0.myapp-svc:3306&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# Primary only
&lt;/span&gt;&lt;span class="n"&gt;read_db&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;myapp-svc:3306&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;            &lt;span class="c1"&gt;# Headless service → replicas
&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;transfer_funds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;write_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UPDATE accounts SET balance=... WHERE id=?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;from_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;write_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;UPDATE accounts SET balance=... WHERE id=?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# Read-back the new balance from the PRIMARY, not a replica
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;write_db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetchone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT balance FROM accounts WHERE id=?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;from_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Summary: Consistency Rules
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Read from&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Payment confirmed, show balance&lt;/td&gt;
&lt;td&gt;Primary&lt;/td&gt;
&lt;td&gt;Cannot tolerate stale data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dashboard: orders last 30 days&lt;/td&gt;
&lt;td&gt;Replica&lt;/td&gt;
&lt;td&gt;Small lag is acceptable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After a write, confirm the value&lt;/td&gt;
&lt;td&gt;Primary&lt;/td&gt;
&lt;td&gt;Replica might not have it yet&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Search / reporting queries&lt;/td&gt;
&lt;td&gt;Replica&lt;/td&gt;
&lt;td&gt;Heavy query, offload from primary&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  6. Self-Managed vs Kubernetes Operator
&lt;/h2&gt;

&lt;p&gt;Once you decide to run your database inside Kubernetes, you have two approaches:&lt;/p&gt;

&lt;h3&gt;
  
  
  Self-Managed
&lt;/h3&gt;

&lt;p&gt;You write and maintain all the Kubernetes resources yourself: StatefulSets, Services, ConfigMaps, init containers for replication setup, CronJobs for backups, shell scripts for failover, certificate management for TLS, and custom monitoring configuration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You are the DBA.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Kubernetes Operator
&lt;/h3&gt;

&lt;p&gt;A Kubernetes Operator is an application that runs inside your cluster and extends Kubernetes for a specific workload. It encodes the operational knowledge of a human DBA into automation.&lt;/p&gt;

&lt;p&gt;You declare what you want using a &lt;strong&gt;Custom Resource Definition (CRD)&lt;/strong&gt;:&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="c1"&gt;# With a MySQL Operator (e.g. KubeDB)&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kubedb.com/v1alpha2&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;MySQL&lt;/span&gt;
&lt;span class="na"&gt;metadata&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;myapp&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;default&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8.0.27"&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
  &lt;span class="na"&gt;topology&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;GroupReplication&lt;/span&gt;
  &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;storageClassName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;standard&lt;/span&gt;
    &lt;span class="na"&gt;accessModes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ReadWriteOnce&lt;/span&gt;
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;10Gi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Operator reads this and automatically creates the StatefulSet, Services, ConfigMaps, sets up replication, configures TLS, and wires up monitoring. You never write any of that YAML yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Operator is your automated DBA.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  7. Detailed Task Comparison
&lt;/h2&gt;

&lt;p&gt;Here is a task-by-task breakdown of what you do yourself vs what the Operator handles:&lt;/p&gt;

&lt;h3&gt;
  
  
  Provisioning
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
You write the full StatefulSet YAML, a headless Service, a regular Service for reads, ConfigMaps for database config, and init containers for first-time setup scripts. This is typically 200–400 lines of YAML for a production-grade setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
You apply a single CRD (10–30 lines). The Operator generates all the underlying resources automatically and keeps them reconciled — if you accidentally delete a Service, the Operator recreates it.&lt;/p&gt;


&lt;h3&gt;
  
  
  Replication Setup
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
You write init container scripts that detect whether the pod is &lt;code&gt;myapp-0&lt;/code&gt; (primary) or a replica, configure the database accordingly, and run the &lt;code&gt;CHANGE MASTER TO ...&lt;/code&gt; (MySQL) or &lt;code&gt;pg_basebackup&lt;/code&gt; (PostgreSQL) equivalent. This is fragile and database-version-specific.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
The Operator knows the internals of the specific database it manages. It configures primary-replica topology automatically, using the correct commands for that database version.&lt;/p&gt;


&lt;h3&gt;
  
  
  Failover
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
When &lt;code&gt;myapp-0&lt;/code&gt; crashes, nothing happens automatically. You must:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Detect the failure (monitoring alert, manual check)&lt;/li&gt;
&lt;li&gt;Identify which replica is most up-to-date (check replication lag)&lt;/li&gt;
&lt;li&gt;Run the promotion command on that replica&lt;/li&gt;
&lt;li&gt;Update all connection strings pointing to the old primary&lt;/li&gt;
&lt;li&gt;Reconfigure remaining replicas to sync from the new primary&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This can take 5–30 minutes manually and causes downtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
The Operator continuously monitors pod health using Kubernetes watches. When it detects the primary is down, it automatically elects the most up-to-date replica as the new primary, reconfigures all other replicas to sync from it, and updates the Service endpoint — typically within 30–60 seconds, with minimal or no downtime.&lt;/p&gt;


&lt;h3&gt;
  
  
  Backups
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
You write a Kubernetes &lt;code&gt;CronJob&lt;/code&gt; that runs a backup container on a schedule, runs &lt;code&gt;mysqldump&lt;/code&gt; or &lt;code&gt;pg_dump&lt;/code&gt; or a snapshot tool, uploads the result to S3, and handles retention (deleting old backups). You also need to periodically test restores manually.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
Operators like KubeDB provide a &lt;code&gt;BackupConfiguration&lt;/code&gt; CRD:&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;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;stash.appscode.com/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;BackupConfiguration&lt;/span&gt;
&lt;span class="na"&gt;metadata&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;myapp-backup&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;        &lt;span class="c1"&gt;# 2 AM daily&lt;/span&gt;
  &lt;span class="na"&gt;repository&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;s3-repo&lt;/span&gt;
  &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;appcatalog.appscode.com/v1alpha1&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;AppBinding&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;myapp&lt;/span&gt;
  &lt;span class="na"&gt;retentionPolicy&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;keep-last-7&lt;/span&gt;
    &lt;span class="na"&gt;keepLast&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;7&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Operator handles scheduling, execution, upload, and retention automatically.&lt;/p&gt;




&lt;h3&gt;
  
  
  Scaling
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
Running &lt;code&gt;kubectl scale statefulset myapp --replicas=4&lt;/code&gt; adds a new pod, but you still need to verify it has fully synced before it receives read traffic. If you forget to check and route reads to an unsynced replica, users see stale data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
Updating the &lt;code&gt;replicas&lt;/code&gt; field in your CRD triggers the Operator to spin up the new pod, wait for it to fully sync (by polling replication lag), and only then mark it ready for traffic. The entire process is automated and safe.&lt;/p&gt;




&lt;h3&gt;
  
  
  Version Upgrades
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
Changing the image tag in a StatefulSet (e.g., &lt;code&gt;mysql:5.7&lt;/code&gt; → &lt;code&gt;mysql:8.0&lt;/code&gt;) applies a rolling update that is not database-aware. Pods may restart in the wrong order, causing replication breaks or data format incompatibility. This is one of the most common causes of production database incidents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
The Operator performs an ordered, validated upgrade:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Upgrades replicas first, one by one, verifying each before proceeding&lt;/li&gt;
&lt;li&gt;Once all replicas are upgraded, performs a controlled failover&lt;/li&gt;
&lt;li&gt;Upgrades the old primary last&lt;/li&gt;
&lt;li&gt;Validates the entire cluster health before declaring success&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  TLS / Security
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
You set up &lt;code&gt;cert-manager&lt;/code&gt;, create &lt;code&gt;Issuer&lt;/code&gt; and &lt;code&gt;Certificate&lt;/code&gt; resources, mount the resulting secret into the StatefulSet as a volume, configure the database to use those certs, and write a renewal process before the certs expire (typically 90 days for Let's Encrypt).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
The Operator integrates with &lt;code&gt;cert-manager&lt;/code&gt; automatically, issues TLS certs for all pods, mounts them correctly, and rotates them before expiry — all without manual intervention.&lt;/p&gt;




&lt;h3&gt;
  
  
  Monitoring
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Self-managed:&lt;/strong&gt;&lt;br&gt;
You add a Prometheus exporter sidecar container to your StatefulSet (e.g., &lt;code&gt;prom/mysqld-exporter&lt;/code&gt;), create a &lt;code&gt;ServiceMonitor&lt;/code&gt; resource so Prometheus discovers it, and configure alerting rules for replication lag, disk usage, connection count, and query performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operator:&lt;/strong&gt;&lt;br&gt;
Operators expose Prometheus metrics from day one. The exporter is baked in, the &lt;code&gt;ServiceMonitor&lt;/code&gt; is created automatically, and many Operators ship default Grafana dashboards for their managed database.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. When to Choose What
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Choose Self-Managed When:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You are learning Kubernetes and want to understand how everything works under the hood&lt;/li&gt;
&lt;li&gt;You are running a niche or custom database that has no Operator available&lt;/li&gt;
&lt;li&gt;You have a very specific operational requirement that no Operator supports&lt;/li&gt;
&lt;li&gt;You have a dedicated DBA or SRE team with deep Kubernetes expertise&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Choose a Kubernetes Operator When:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You are running in production with real users and data&lt;/li&gt;
&lt;li&gt;You want automated failover, backups, and upgrades&lt;/li&gt;
&lt;li&gt;Your team is primarily developers, not infrastructure specialists&lt;/li&gt;
&lt;li&gt;You need to run the same database setup across multiple clusters or environments&lt;/li&gt;
&lt;li&gt;You want GitOps-friendly database management (declare state in Git, Operator reconciles)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Recommended Operators by Database
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Database&lt;/th&gt;
&lt;th&gt;Operator Options&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;MySQL / MariaDB&lt;/td&gt;
&lt;td&gt;KubeDB, MySQL Operator (Oracle), Percona Operator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PostgreSQL&lt;/td&gt;
&lt;td&gt;KubeDB, CloudNativePG, Crunchy Postgres Operator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MongoDB&lt;/td&gt;
&lt;td&gt;KubeDB, MongoDB Community Operator, Percona Operator&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Elasticsearch&lt;/td&gt;
&lt;td&gt;KubeDB, Elastic Cloud on Kubernetes (ECK)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Redis&lt;/td&gt;
&lt;td&gt;KubeDB, Redis Operator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  9. Summary
&lt;/h2&gt;

&lt;p&gt;Here is everything in one place:&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Concepts
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;What it means&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;StatefulSet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Kubernetes object that gives pods stable names, stable DNS, and stable storage — essential for databases&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;PVC per pod&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Each pod gets its own dedicated disk that survives pod restarts and rescheduling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ordered startup&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pods start one at a time; next pod only starts when previous is Running + Ready&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary pod&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The only pod that accepts writes (&lt;code&gt;myapp-0&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Replica pod&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Read-only copy, synced from primary (&lt;code&gt;myapp-1&lt;/code&gt;, &lt;code&gt;myapp-2&lt;/code&gt;, ...)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Replication lag&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The delay between a write on the primary and it appearing on a replica&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Readiness probe&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Kubernetes check that prevents traffic to a pod until it is ready (used to block reads until replica is synced)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kubernetes Operator&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;An application that automates all operational database tasks, acting as your automated DBA&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CRD&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Custom Resource Definition — the YAML spec you write when using an Operator&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Golden Rules
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Always write to the primary only&lt;/strong&gt; — never send writes to a replica&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For critical reads, read from the primary&lt;/strong&gt; — replicas may lag&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use readiness probes&lt;/strong&gt; — don't send traffic to a replica until it is fully synced&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a PodDisruptionBudget&lt;/strong&gt; — always keep at least 2 pods available&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For production, use an Operator&lt;/strong&gt; — manual database management does not scale&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Architecture at a Glance
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    ┌─────────────┐
                    │  App / Client│
                    └──────┬──────┘
                           │
              ┌────────────┴────────────┐
              │ WRITE                   │ READ
              ▼                         ▼
   ┌─────────────────┐      ┌──────────────────┐
   │  myapp-0        │      │  myapp-1         │
   │  (Primary)      │──────│  (Replica)       │
   │  Accepts writes │ repl │  Read only       │
   └────────┬────────┘      └──────────────────┘
            │                ┌──────────────────┐
            │                │  myapp-2         │
            └────────────────│  (Replica)       │
                       repl  │  Read only       │
                             └──────────────────┘

   PVC-myapp-0          PVC-myapp-1          PVC-myapp-2
   (dedicated disk)     (dedicated disk)     (dedicated disk)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kubedb.com/" rel="noopener noreferrer"&gt;KubeDB — Production-grade database management for Kubernetes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloudnative-pg.io/" rel="noopener noreferrer"&gt;CloudNativePG — PostgreSQL Operator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/" rel="noopener noreferrer"&gt;Kubernetes StatefulSets documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/" rel="noopener noreferrer"&gt;Kubernetes Operator pattern&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cert-manager.io/" rel="noopener noreferrer"&gt;cert-manager — TLS automation for Kubernetes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;This guide covers the concepts discussed in the KCD Chennai 2022 talk by Tamal Saha, Founder &amp;amp; CEO of AppsCode Inc., expanded with practical implementation details for StatefulSet replication, consistency strategies, and the self-managed vs Operator decision.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🤖 AI Dev Tools</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Fri, 24 Apr 2026 18:49:12 +0000</pubDate>
      <link>https://forem.com/kalpesh47/ai-dev-tools-bmh</link>
      <guid>https://forem.com/kalpesh47/ai-dev-tools-bmh</guid>
      <description>&lt;h1&gt;
  
  
  AI Dev Tools — Comparison
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;graphify&lt;/strong&gt; vs &lt;strong&gt;claude-context&lt;/strong&gt; vs &lt;strong&gt;axon&lt;/strong&gt; vs &lt;strong&gt;Lynkr&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧠 The Simple 1-Line Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Repo&lt;/th&gt;
&lt;th&gt;What it is in plain English&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;graphify&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Researchers, architects, anyone onboarding to a new codebase, mixed content (not just code)&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;claude-context&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Large codebases (millions of lines), teams that want fast semantic search without loading entire repos into context&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;axon&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Engineers doing refactors, audits, or impact analysis; teams who want full structural understanding of their codebase locally&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Lynkr&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"Developers who want provider flexibility, want to use local/private models, or want to slash their AI API bills&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  📊 Side-by-Side Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;graphify&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;claude-context&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;axon&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Lynkr&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🎯 &lt;strong&gt;Core job&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Build knowledge graph from anything&lt;/td&gt;
&lt;td&gt;Semantic search over codebase&lt;/td&gt;
&lt;td&gt;Deep structural code analysis&lt;/td&gt;
&lt;td&gt;Universal AI proxy + cost optimizer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🛠️ &lt;strong&gt;Type&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;AI skill (slash command)&lt;/td&gt;
&lt;td&gt;MCP server&lt;/td&gt;
&lt;td&gt;MCP server + CLI&lt;/td&gt;
&lt;td&gt;HTTP proxy server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📦 &lt;strong&gt;Input&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Code + docs + images + video&lt;/td&gt;
&lt;td&gt;Code only&lt;/td&gt;
&lt;td&gt;Code only&lt;/td&gt;
&lt;td&gt;All AI tool requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔍 &lt;strong&gt;Search type&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Graph topology (no embeddings)&lt;/td&gt;
&lt;td&gt;Hybrid BM25 + dense vectors&lt;/td&gt;
&lt;td&gt;BM25 + semantic + fuzzy (RRF)&lt;/td&gt;
&lt;td&gt;N/A (it's a proxy)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🌐 &lt;strong&gt;External infra?&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;❌ None needed&lt;/td&gt;
&lt;td&gt;✅ Zilliz Cloud / Milvus&lt;/td&gt;
&lt;td&gt;❌ Fully local&lt;/td&gt;
&lt;td&gt;❌ Self-hosted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;💸 &lt;strong&gt;Saves money?&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Indirectly (71x token reduction)&lt;/td&gt;
&lt;td&gt;Yes (smart retrieval)&lt;/td&gt;
&lt;td&gt;Yes (local, no API keys)&lt;/td&gt;
&lt;td&gt;✅ 60–80% cost reduction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔒 &lt;strong&gt;Privacy&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;✅ Local extraction&lt;/td&gt;
&lt;td&gt;⚠️ Cloud DB by default&lt;/td&gt;
&lt;td&gt;✅ 100% local&lt;/td&gt;
&lt;td&gt;✅ Self-hosted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;💥 &lt;strong&gt;Impact analysis&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🧟 &lt;strong&gt;Dead code detection&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🎥 &lt;strong&gt;Video/audio input&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🗺️ &lt;strong&gt;Visual graph UI&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;✅ Interactive HTML&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ WebGL dashboard&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔀 &lt;strong&gt;Provider switching&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ 12+ providers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;⭐ &lt;strong&gt;GitHub stars&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;~28.6k 🔥&lt;/td&gt;
&lt;td&gt;~8.7k&lt;/td&gt;
&lt;td&gt;Smaller/newer&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📝 &lt;strong&gt;Language&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;td&gt;TypeScript / Node.js&lt;/td&gt;
&lt;td&gt;Python 3.11+&lt;/td&gt;
&lt;td&gt;Node.js&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;📜 &lt;strong&gt;License&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;MIT&lt;/td&gt;
&lt;td&gt;MIT&lt;/td&gt;
&lt;td&gt;MIT&lt;/td&gt;
&lt;td&gt;Apache 2.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🏆 &lt;strong&gt;Best for&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Researchers, architects, onboarding to new codebases, mixed content (code + docs + images + video)&lt;/td&gt;
&lt;td&gt;Large codebases (millions of lines), teams wanting fast semantic search without loading full repos&lt;/td&gt;
&lt;td&gt;Engineers doing refactors, audits, or impact analysis; teams needing full structural understanding locally&lt;/td&gt;
&lt;td&gt;Devs wanting provider flexibility, local/private models (Ollama, Bedrock, Azure), or slashing API bills&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🏁 Which One Should YOU Use?
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;If you want to…&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;🗺️ Understand a new codebase fast, or map code + docs + images + videos&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;graphify&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔍 Search millions of lines of code instantly without loading everything&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;claude-context&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;🔬 Know exactly what breaks when you change something, find dead code, trace flows&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;axon&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;💰 Use Ollama / Bedrock / Azure instead of Anthropic, or cut API costs by 60–80%&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Lynkr&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  ⚡ Quick Install
&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;# graphify&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;graphifyy
&lt;span class="c"&gt;# then type /graphify inside Claude Code, Cursor, Aider, Gemini CLI, etc.&lt;/span&gt;

&lt;span class="c"&gt;# claude-context&lt;/span&gt;
&lt;span class="c"&gt;# Follow setup at https://github.com/zilliztech/claude-context&lt;/span&gt;
&lt;span class="c"&gt;# Requires Zilliz Cloud API key + Node.js &amp;lt; 24&lt;/span&gt;

&lt;span class="c"&gt;# axon&lt;/span&gt;
pip &lt;span class="nb"&gt;install &lt;/span&gt;axoniq

&lt;span class="c"&gt;# Lynkr&lt;/span&gt;
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; lynkr &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; lynkr start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🔗 Links
&lt;/h2&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;GitHub&lt;/th&gt;
&lt;th&gt;Install&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;graphify&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/safishamsi/graphify" rel="noopener noreferrer"&gt;safishamsi/graphify&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pip install graphifyy&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;claude-context&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/zilliztech/claude-context" rel="noopener noreferrer"&gt;zilliztech/claude-context&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;See repo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;axon&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/harshkedia177/axon" rel="noopener noreferrer"&gt;harshkedia177/axon&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pip install axoniq&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Lynkr&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://github.com/Fast-Editor/Lynkr" rel="noopener noreferrer"&gt;Fast-Editor/Lynkr&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;npm install -g lynkr&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  💡 Pro Tip
&lt;/h2&gt;

&lt;p&gt;These tools are &lt;strong&gt;not mutually exclusive!&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Run &lt;strong&gt;Lynkr&lt;/strong&gt; as your proxy → use &lt;strong&gt;graphify&lt;/strong&gt; to map your codebase → plug in &lt;strong&gt;axon&lt;/strong&gt; for impact analysis → use &lt;strong&gt;claude-context&lt;/strong&gt; for fast retrieval.&lt;/p&gt;

&lt;p&gt;All four together = the ultimate AI dev stack. 🚀&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>programming</category>
      <category>tooling</category>
    </item>
    <item>
      <title>End-To-End DevOps + AIOps Project- 2</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Mon, 20 Apr 2026 19:03:55 +0000</pubDate>
      <link>https://forem.com/kalpesh47/end-to-end-devops-aiops-project-2-4ipj</link>
      <guid>https://forem.com/kalpesh47/end-to-end-devops-aiops-project-2-4ipj</guid>
      <description>&lt;h1&gt;
  
  
  The Application: A Microservices E-Commerce App
&lt;/h1&gt;

&lt;p&gt;The project is built around a real-world &lt;strong&gt;microservices-based e-commerce application&lt;/strong&gt; — seven independent services, each containerized and independently deployable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  E-Commerce Microservices
  ┌────────────────────────────────────────┐
  │   - Frontend (UI)                      │
  │   - Cart Service                       │
  │   - Orders Service                     │
  │   - Checkout Service                   │
  │   - Payments Service                   │
  │   - Product Catalog Service            │
  │   - Recommendation Service             │
  └────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each service is isolated, owns its own responsibility, and communicates over well-defined APIs — mirroring how teams actually build and ship software at scale.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Full Architecture: End-to-End Flow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Developer pushes code
          ↓
  GitHub (GitOps — Source of Truth)
          ↓
  CI/CD Pipeline (GitHub Actions)
  ┌──────────────────────────────────────┐
  │  - Run tests                         │
  │  - Build Docker images               │
  │  - Push to container registry        │
  │  - Update Kubernetes manifests       │
  └──────────────────────────────────────┘
          ↓
  Argo CD (GitOps Continuous Delivery)
  Watches Git repo → syncs cluster state
          ↓
  AWS EKS Cluster (Terraform-provisioned)
  ┌──────────────────────────────────────┐
  │  Microservices on Kubernetes         │
  │  - Cart      - Orders                │
  │  - Checkout  - Payments              │
  │  - Catalog   - Frontend              │
  │  - Recommendations                   │
  └──────────────────────────────────────┘
          ↓
  Observability Stack
  ┌──────────────────────────────────────┐
  │  Prometheus  → Metrics collection    │
  │  Grafana     → Dashboards &amp;amp; alerts   │
  │  Loki        → Log aggregation       │
  └──────────────────────────────────────┘
          ↓
  AIOps Layer
  ┌──────────────────────────────────────┐
  │  - Anomaly Detection                 │
  │  - Intelligent Log Analysis          │
  │  - Auto-remediation                  │
  │  - Incident Response Automation      │
  └──────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Layer 1: Local Development with Docker Compose
&lt;/h2&gt;

&lt;p&gt;All seven microservices run locally using &lt;strong&gt;Docker Compose&lt;/strong&gt; — spin up the full app on any laptop with a single command, no cloud credentials required. This validates the application before any infrastructure costs are incurred.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 2: Infrastructure as Code with Terraform
&lt;/h2&gt;

&lt;p&gt;AWS infrastructure is never clicked together manually. &lt;strong&gt;Terraform&lt;/strong&gt; declares it as code — repeatable, version-controlled, and auditable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Terraform provisions on AWS
  ┌──────────────────────────────────────┐
  │  EKS Cluster                         │
  │  VPC + Subnets + Security Groups     │
  │  IAM Roles &amp;amp; Policies                │
  │  Node Groups (EC2 worker nodes)      │
  │  Load Balancers                      │
  └──────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Layer 3: CI/CD Pipeline with GitHub Actions
&lt;/h2&gt;

&lt;p&gt;Every code push triggers an automated pipeline:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Code pushed to GitHub
          ↓
  ┌──────────────────────────────────────┐
  │  1. Run unit &amp;amp; integration tests     │
  │  2. Build Docker image               │
  │  3. Push image to container registry │
  │  4. Update image tag in K8s manifests│
  │  5. Commit updated manifests to Git  │
  └──────────────────────────────────────┘
          ↓
  Argo CD detects the change
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Layer 4: GitOps with Argo CD
&lt;/h2&gt;

&lt;p&gt;Git is the single source of truth. &lt;strong&gt;Argo CD&lt;/strong&gt; continuously watches the repo and auto-syncs the live cluster to match the declared state — self-healing, auditable, and rollbacks are just a &lt;code&gt;git revert&lt;/code&gt; away.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Git Repository (Desired State)
          ↓  Argo CD watches for drift
  AWS EKS Cluster (Actual State)
          ↓
  Drift detected → Auto-sync to reconcile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Layer 5: Kubernetes on AWS EKS
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Amazon EKS&lt;/strong&gt; manages the Kubernetes control plane so the team focuses on workloads, not cluster maintenance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  AWS EKS Cluster
  ┌──────────────────────────────────────────────┐
  │  Deployments   → Run &amp;amp; manage pods           │
  │  Services      → Internal/external routing   │
  │  Ingress       → External traffic entry      │
  │  ConfigMaps    → App configuration           │
  │  Secrets       → Sensitive credentials       │
  │  HPA           → Horizontal Pod Autoscaling  │
  └──────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Layer 6: Observability — Prometheus, Grafana &amp;amp; Loki
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Prometheus   → Scrapes &amp;amp; stores metrics (CPU, memory, req/s, errors)
       ↓
  Grafana      → Visualizes metrics (dashboards + alerting)
       ↓
  Loki         → Aggregates logs from all microservices
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Together they provide full visibility into application health, resource usage, error rates, and logs — all in one place.&lt;/p&gt;




&lt;h2&gt;
  
  
  Layer 7: AIOps — Intelligent Operations
&lt;/h2&gt;

&lt;p&gt;AIOps moves beyond passive monitoring toward &lt;strong&gt;autonomous operations&lt;/strong&gt; using ML and LLMs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Raw Telemetry (Metrics + Logs + Traces)
          ↓
  AIOps Layer
  ┌──────────────────────────────────────────────┐
  │  Anomaly Detection                           │
  │  → Flags issues before users are impacted    │
  │                                              │
  │  Intelligent Log Analysis                    │
  │  → LLMs parse &amp;amp; summarize logs               │
  │  → Pinpoints root cause faster               │
  │                                              │
  │  Auto-Remediation                            │
  │  → Auto-scales pods, restarts containers     │
  │  → Triggers rollbacks on degraded deploys    │
  │                                              │
  │  Incident Response Automation                │
  │  → Notifies on-call with context, not noise  │
  └──────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Tools &amp;amp; Technologies
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Containerization&lt;/td&gt;
&lt;td&gt;Docker, Docker Compose&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orchestration&lt;/td&gt;
&lt;td&gt;Kubernetes (AWS EKS)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Infrastructure as Code&lt;/td&gt;
&lt;td&gt;Terraform&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CI/CD&lt;/td&gt;
&lt;td&gt;GitHub Actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitOps&lt;/td&gt;
&lt;td&gt;Argo CD&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Metrics&lt;/td&gt;
&lt;td&gt;Prometheus&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dashboards &amp;amp; Alerts&lt;/td&gt;
&lt;td&gt;Grafana&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Log Aggregation&lt;/td&gt;
&lt;td&gt;Loki&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloud Provider&lt;/td&gt;
&lt;td&gt;AWS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AIOps&lt;/td&gt;
&lt;td&gt;ML anomaly detection + LLM log analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>devops</category>
      <category>microservices</category>
    </item>
    <item>
      <title>End-To-End DevOps + AIOps Project- 1</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Mon, 20 Apr 2026 18:27:33 +0000</pubDate>
      <link>https://forem.com/kalpesh47/system-design-concepts-39jm</link>
      <guid>https://forem.com/kalpesh47/system-design-concepts-39jm</guid>
      <description>&lt;h1&gt;
  
  
  Why System Design Matters for DevOps
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Distributed Systems
&lt;/h2&gt;

&lt;p&gt;A distributed system splits workloads across multiple machines. Instead of one powerful server doing everything, many smaller services collaborate — each handling a piece of the work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt; No single point of failure. If one node goes down, others keep running. This is the foundation of all modern cloud architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Monolith vs Microservices
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         MONOLITH                        MICROSERVICES
  ┌──────────────────────┐        ┌────────┐  ┌────────┐
  │                      │        │  Cart  │  │ Orders │
  │  UI + Auth + Cart +  │        └────┬───┘  └────┬───┘
  │  Orders + Payments   │             │            │
  │  + Notifications...  │        ┌────┴───┐  ┌────┴──────┐
  │                      │        │Payments│  │  Notifs   │
  └──────────────────────┘        └────────┘  └───────────┘
    One giant deployable             Each service deploys
    unit — scale all or nothing      &amp;amp; scales independently
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Monolith&lt;/th&gt;
&lt;th&gt;Microservices&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deploy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One unit&lt;/td&gt;
&lt;td&gt;Independent services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Scale&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Whole app&lt;/td&gt;
&lt;td&gt;Per service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Failure&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One bug = full outage&lt;/td&gt;
&lt;td&gt;Isolated failures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best for&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Small teams, MVPs&lt;/td&gt;
&lt;td&gt;Large, evolving systems&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  3. API Communication
&lt;/h2&gt;

&lt;p&gt;Services talk to each other via APIs. Three key patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;REST&lt;/strong&gt; — Stateless HTTP calls, great for client-server communication&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;gRPC&lt;/strong&gt; — High-performance, binary protocol ideal for internal service-to-service calls&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event-driven (Kafka/SQS)&lt;/strong&gt; — Async messaging that decouples services and absorbs traffic spikes
&amp;gt; &lt;strong&gt;Rule of thumb:&lt;/strong&gt; Use REST for external APIs, gRPC for internal performance-critical calls, and events for async workflows.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Service Discovery
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ┌─────────────┐     "Where is cart-service?"     ┌──────────────────┐
  │  Checkout   │ ────────────────────────────────► │  Service Registry│
  │  Service    │ ◄────────────────────────────────  │  (CoreDNS)       │
  └─────────────┘     "cart-service:3000"           └──────────────────┘
         │                                                    ▲
         │  connects to                              registers │
         ▼                                                    │
  ┌─────────────┐                                   ┌──────────────────┐
  │    Cart     │ ─────────────────────────────────► │  cart-service    │
  │   Service   │                                   │  pod (dynamic IP)│
  └─────────────┘                                   └──────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When services scale dynamically, hardcoded IPs break. Service discovery lets services find each other automatically.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Kubernetes&lt;/strong&gt;, this happens natively via &lt;strong&gt;CoreDNS&lt;/strong&gt; — every service gets a stable DNS name regardless of how many pods are running or where they live.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Load Balancing
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          Incoming Traffic
               │
               ▼
   ┌───────────────────────┐
   │      Load Balancer    │
   │  (AWS ALB / Ingress)  │
   └───────┬───────┬───────┘
           │       │       │
           ▼       ▼       ▼
      ┌────────┐ ┌────────┐ ┌────────┐
      │  Pod 1 │ │  Pod 2 │ │  Pod 3 │
      └────────┘ └────────┘ └────────┘
       Layer 4: routes by IP/port
       Layer 7: routes by path/headers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Load balancers distribute traffic across instances so no single server gets overwhelmed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Layer 4&lt;/strong&gt; — Routes by IP/port (fast, lower overhead)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer 7&lt;/strong&gt; — Routes by HTTP path, headers, or cookies (smart, flexible)
On &lt;strong&gt;AWS EKS&lt;/strong&gt;, the AWS Load Balancer Controller + Kubernetes Ingress handles this automatically.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. High Availability
&lt;/h2&gt;

&lt;p&gt;HA means the system stays up even when parts of it fail. Key techniques:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-AZ deployments&lt;/strong&gt; — Spread workloads across Availability Zones&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replication&lt;/strong&gt; — Keep multiple copies of data and services&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Circuit breakers&lt;/strong&gt; — Stop cascading failures between services&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;strong&gt;Kubernetes self-healing&lt;/strong&gt; — Failed pods restart automatically
&lt;/h2&gt;

&lt;h2&gt;
  
  
  7. Autoscaling
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  CPU: 80% 🔺 (threshold: 70%)
         │
         ▼
  ┌─────────────┐     scale out      ┌──────────────────────────┐
  │     HPA     │ ─────────────────► │  Pod 1 │ Pod 2 │ Pod 3   │
  │ (autoscaler)│                    │        + Pod 4 + Pod 5   │
  └─────────────┘                    └──────────────────────────┘

  CPU: 20% 🔻 (below threshold)
         │
         ▼
  ┌─────────────┐     scale in       ┌────────────────┐
  │     HPA     │ ─────────────────► │ Pod 1 │ Pod 2  │
  └─────────────┘                    └────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Manual scaling doesn't work in production. Kubernetes offers multiple autoscaling tools:&lt;/p&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;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;HPA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Scales pod count based on CPU/memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;VPA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Adjusts resource requests per pod&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;KEDA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Event-driven scaling (e.g., queue depth)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cluster Autoscaler&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Adds/removes nodes from the cluster&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  8. Reliability with Kubernetes
&lt;/h2&gt;

&lt;p&gt;Kubernetes has built-in reliability primitives every DevOps engineer should know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Liveness probes&lt;/strong&gt; — Restart containers that hang or crash&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Readiness probes&lt;/strong&gt; — Remove unhealthy pods from the load balancer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pod Disruption Budgets&lt;/strong&gt; — Guarantee minimum replicas during rolling updates&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;strong&gt;Resource quotas&lt;/strong&gt; — Prevent one service from starving others
&lt;/h2&gt;

&lt;h2&gt;
  
  
  9. Security by Design
&lt;/h2&gt;

&lt;p&gt;Security isn't an afterthought — it's architecture. Core principles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Least privilege&lt;/strong&gt; — IAM roles + Kubernetes RBAC limit what each service can do&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network policies&lt;/strong&gt; — Restrict pod-to-pod traffic&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secrets management&lt;/strong&gt; — AWS Secrets Manager or Vault (never hardcode credentials)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image scanning&lt;/strong&gt; — Tools like Trivy scan containers before they deploy&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;strong&gt;mTLS&lt;/strong&gt; — Encrypt all service-to-service traffic (via Istio or a service mesh)
&lt;/h2&gt;

&lt;h2&gt;
  
  
  10. Observability
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Your System
  ┌──────────────────────────────────────────────────┐
  │  Microservice A  ──►  Microservice B  ──►  DB    │
  └──────────┬──────────────────┬────────────────────┘
             │                  │
      ┌──────▼──────┐   ┌───────▼────────┐   ┌──────────────┐
      │    LOGS     │   │    METRICS     │   │   TRACES     │
      │  (what      │   │  (how much /   │   │  (where did  │
      │  happened)  │   │   how fast)    │   │  it go?)     │
      │  Loki /     │   │  Prometheus /  │   │  Jaeger /    │
      │  CloudWatch │   │  Grafana       │   │  X-Ray       │
      └─────────────┘   └────────────────┘   └──────────────┘
                  └──────────────┬──────────────┘
                                 ▼
                         AIOps Dashboard
                    (Anomaly Detection + Alerts)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can't fix what you can't see. Observability is built on three pillars:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pillar&lt;/th&gt;
&lt;th&gt;Tools&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Logs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fluentd, CloudWatch, Loki&lt;/td&gt;
&lt;td&gt;Detailed event records&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Metrics&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Prometheus, Grafana&lt;/td&gt;
&lt;td&gt;Time-series measurements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Traces&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Jaeger, AWS X-Ray&lt;/td&gt;
&lt;td&gt;Request flow across services&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  11. Deployment Strategies
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ROLLING UPDATE          BLUE / GREEN              CANARY
  ┌───┬───┬───┐          ┌───────────┐           ┌────────────┐
  │v1 │v1 │v1 │  step 1  │  BLUE(v1) │◄─ 100%    │   v1       │◄─ 90%
  └───┴───┴───┘   ──►    └───────────┘            └────────────┘
  ┌───┬───┬───┐          ┌───────────┐           ┌────────────┐
  │v2 │v1 │v1 │  step 2  │ GREEN(v2) │◄─  0%     │   v2       │◄─ 10%
  └───┴───┴───┘          └───────────┘  switch!   └────────────┘
  ┌───┬───┬───┐               ↕                    gradually shift
  │v2 │v2 │v2 │  done    flip traffic              to 100% if ok
  └───┴───┴───┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deploying safely means choosing the right strategy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rolling update&lt;/strong&gt; — Gradually replace old pods with new ones (Kubernetes default)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blue/Green&lt;/strong&gt; — Two identical environments; switch traffic instantly with zero downtime&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Canary&lt;/strong&gt; — Route a small % of traffic to the new version first, then roll out fully&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  - &lt;strong&gt;Feature flags&lt;/strong&gt; — Toggle features without redeploying
&lt;/h2&gt;

&lt;h2&gt;
  
  
  12. GitOps
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Developer
      │
      │  git push / pull request
      ▼
  ┌──────────────┐
  │   Git Repo   │  ◄── single source of truth
  │  (GitHub)    │
  └──────┬───────┘
         │  watches for changes
         ▼
  ┌──────────────┐
  │   ArgoCD /   │  detects drift between
  │    Flux      │  Git state ↔ cluster state
  └──────┬───────┘
         │  syncs automatically
         ▼
  ┌──────────────────────┐
  │   Kubernetes Cluster │
  │   (AWS EKS)          │
  └──────────────────────┘
  Rollback = revert a commit ↩
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitOps makes &lt;strong&gt;Git the single source of truth&lt;/strong&gt; for infrastructure and application state.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All changes go through &lt;strong&gt;pull requests&lt;/strong&gt; — reviewed, audited, version-controlled&lt;/li&gt;
&lt;li&gt;An operator like &lt;strong&gt;ArgoCD&lt;/strong&gt; or &lt;strong&gt;Flux&lt;/strong&gt; continuously syncs the cluster to match what's in Git&lt;/li&gt;
&lt;li&gt;Rollback = revert a commit
&lt;strong&gt;Benefits:&lt;/strong&gt; Full audit trail, consistent environments, and deployments that are always reproducible.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Big Picture: How It All Connects
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Developer pushes code
        ↓
  GitHub (GitOps)
        ↓
  CI/CD Pipeline
        ↓
  AWS EKS Cluster
  ┌─────────────────────────────┐
  │  Microservices (Kubernetes) │
  │  - Cart  - Orders           │
  │  - Checkout  - Payments     │
  └─────────────────────────────┘
        ↓
  Observability Stack
  (Prometheus + Grafana + Loki)
        ↓
  AIOps Layer
  (Anomaly Detection + Auto-remediation)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Distributed systems and microservices enable independent scaling and fault isolation&lt;/li&gt;
&lt;li&gt;Kubernetes provides built-in resilience, self-healing, and safe deployments&lt;/li&gt;
&lt;li&gt;Security and observability must be designed in — not added later&lt;/li&gt;
&lt;li&gt;GitOps brings auditability and consistency to infrastructure changes&lt;/li&gt;
&lt;li&gt;AIOps closes the loop: observability data drives intelligent automation&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devops</category>
      <category>distributedsystems</category>
      <category>microservices</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Networking</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 20:08:09 +0000</pubDate>
      <link>https://forem.com/kalpesh47/networking-4f39</link>
      <guid>https://forem.com/kalpesh47/networking-4f39</guid>
      <description>&lt;h2&gt;
  
  
  🖧 Subnet
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Subnet&lt;/strong&gt; is a smaller chunk of a bigger network, created using a &lt;strong&gt;subnet mask&lt;/strong&gt; or &lt;strong&gt;CIDR&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%2Fyauzv736ws8y0ervhyui.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%2Fyauzv736ws8y0ervhyui.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;(e.g., &lt;code&gt;/27&lt;/code&gt;) to split IPs into &lt;strong&gt;network&lt;/strong&gt; and &lt;strong&gt;host&lt;/strong&gt; parts.&lt;br&gt;&lt;br&gt;
It improves &lt;strong&gt;efficiency&lt;/strong&gt;, &lt;strong&gt;security&lt;/strong&gt;, and &lt;strong&gt;traffic control&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CIDR &lt;code&gt;/27&lt;/code&gt; means you're borrowing &lt;strong&gt;5 bits&lt;/strong&gt; from the host portion (since 32 - 27 = 5).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That gives you &lt;strong&gt;2⁵ = 32 IP addresses&lt;/strong&gt; in total.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Out of those, &lt;strong&gt;30 are usable IPs&lt;/strong&gt; (excluding 1 for network address and 1 for broadcast).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  DNS resolver
&lt;/h2&gt;

&lt;p&gt;It stores information about domain names and their corresponding IP addresses in structured records&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%2F70rk41hbx7dj0j2dbug6.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%2F70rk41hbx7dj0j2dbug6.png" alt=" " width="600" height="330"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Handshaking
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;TCP make 3 ways handshake in order to establish connection.&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%2Ftrv50zr1q3tbxrgev5x3.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%2Ftrv50zr1q3tbxrgev5x3.png" alt=" " width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  OSI Layer
&lt;/h2&gt;

&lt;p&gt;Layer 7, 6 &amp;amp; 5 happens in local level. e.g.- Browser&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%2Fcg88g53jhe1cl4v6z0sr.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%2Fcg88g53jhe1cl4v6z0sr.png" alt=" " width="800" height="1107"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  AWS VPC
&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%2Fr4q03w032q79hqwolio7.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%2Fr4q03w032q79hqwolio7.png" alt=" " width="611" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>networking</category>
    </item>
    <item>
      <title>Essential Linux Commands- 2</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 20:05:02 +0000</pubDate>
      <link>https://forem.com/kalpesh47/essential-linux-commands-2-2lkd</link>
      <guid>https://forem.com/kalpesh47/essential-linux-commands-2-2lkd</guid>
      <description>&lt;h2&gt;
  
  
  Shortcuts:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Reverse Search
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;Ctrl + R&lt;/code&gt; then type the command you want to search then &lt;code&gt;Tab&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Commands:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Info of Command
&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;# brief description of command&lt;/span&gt;
whatis &lt;span class="nb"&gt;cat&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Real time process info
&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;# Real time process&lt;/span&gt;
top

&lt;span class="c"&gt;# Wrapper: Graphical Process&lt;/span&gt;
htop

&lt;span class="c"&gt;# System stat for performance check&lt;/span&gt;
vmstat

&lt;span class="c"&gt;# Amount of CPU available&lt;/span&gt;
&lt;span class="nb"&gt;nproc&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  List Process &amp;amp; Hierarchy
&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;# List Process not a Real time&lt;/span&gt;
ps

&lt;span class="c"&gt;# Detail all process list&lt;/span&gt;
ps aux

&lt;span class="c"&gt;# No of process(Line No)&lt;/span&gt;
ps aux | &lt;span class="nb"&gt;ln&lt;/span&gt;

&lt;span class="c"&gt;# Only shows no lines&lt;/span&gt;
ps aux | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;

&lt;span class="c"&gt;# kill process&lt;/span&gt;
&lt;span class="nb"&gt;kill&lt;/span&gt; &amp;lt;PID&amp;gt;

&lt;span class="c"&gt;# Force process delete&lt;/span&gt;
&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-9&lt;/span&gt; &amp;lt;PID&amp;gt;

&lt;span class="c"&gt;# Thread dumnp&lt;/span&gt;
&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-3&lt;/span&gt; &amp;lt;PID&amp;gt;

&lt;span class="c"&gt;# Stop process&lt;/span&gt;
&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-STOP&lt;/span&gt; &amp;lt;PID&amp;gt;

&lt;span class="c"&gt;# Resume Stop process&lt;/span&gt;
&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-CONT&lt;/span&gt; &amp;lt;PID&amp;gt;

&lt;span class="c"&gt;# Prioritize Process (-n [1-20], lower no means high prioritize)&lt;/span&gt;
renice &lt;span class="nt"&gt;-n&lt;/span&gt; 10 &lt;span class="nt"&gt;-p&lt;/span&gt; &amp;lt;PID&amp;gt;

&lt;span class="c"&gt;# Process Hierarchy&lt;/span&gt;
pstree &lt;span class="nt"&gt;-p&lt;/span&gt;

&lt;span class="c"&gt;# Port used by Process&lt;/span&gt;
lsof &lt;span class="nt"&gt;-i&lt;/span&gt; :8085
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Inspect Network Connection
&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;# Get active ports in Use&lt;/span&gt;
netstat &lt;span class="nt"&gt;-tuln&lt;/span&gt;

&lt;span class="c"&gt;# Network Interface Info&lt;/span&gt;
ifconfig

&lt;span class="c"&gt;# Network Troubleshoot (Can WireShark tool)&lt;/span&gt;
&lt;span class="c"&gt;# enX0: Network Interface&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; enX0 port 80

&lt;span class="c"&gt;# Test Connectivity&lt;/span&gt;
ping google.com

&lt;span class="c"&gt;# Tarce the path packet to reach destination&lt;/span&gt;
traceroute google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Disk Space, Size &amp;amp; Memory
&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;# Check Disk Space&lt;/span&gt;
&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;

&lt;span class="c"&gt;# Size of dir or file&lt;/span&gt;
&lt;span class="c"&gt;# opt: directory&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-sh&lt;/span&gt; opt

&lt;span class="c"&gt;# Memory (RAM)&lt;/span&gt;
free &lt;span class="nt"&gt;-h&lt;/span&gt;

&lt;span class="c"&gt;# List Blob(All type of formats- Raw state) attach to Instance&lt;/span&gt;
lsblk

&lt;span class="c"&gt;# Format the Blob Storage to linux supperted file system (ext4)&lt;/span&gt;
mkfs &lt;span class="nt"&gt;-t&lt;/span&gt; ext4 /dev/xvdf

&lt;span class="c"&gt;# Mount it in order to use&lt;/span&gt;
mount /dev/xvdf mnt/demo-volume/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Services
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Systemd&lt;/code&gt; manages services
&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;# Logs of Services&lt;/span&gt;
journalctl

&lt;span class="c"&gt;# Particular Service&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; nginx

&lt;span class="c"&gt;# Logs of services from Last Boot&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Logs Filter
&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;# Last 10 line of logs&lt;/span&gt;
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 10 /var/log/auth.log

&lt;span class="c"&gt;# First 10 line of logs&lt;/span&gt;
&lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 10 /var/log/auth.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Alias
&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;alias &lt;/span&gt;&lt;span class="nv"&gt;detail_list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ls -la'&lt;/span&gt;

&lt;span class="c"&gt;# Want to persist the Alias, add in '~/.bashrc'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Symbolic Link&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Soft Link&lt;/strong&gt; (Like Windows Shortcuts)- It can be broken&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ln: link&lt;/span&gt;
&lt;span class="c"&gt;# -s: flag for soft link &lt;/span&gt;
&lt;span class="c"&gt;# myfile: file you want to crate soft link&lt;/span&gt;
&lt;span class="c"&gt;# slink: name of soft link file created&lt;/span&gt;
&lt;span class="nb"&gt;ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; myfile slink
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Hard Link&lt;/strong&gt; (Actual Copy)- Doesn’t break the other one&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ln: link&lt;/span&gt;
&lt;span class="c"&gt;# myfile: file you want to crate soft link&lt;/span&gt;
&lt;span class="c"&gt;# hlink: name of hard link file created&lt;/span&gt;
&lt;span class="nb"&gt;ln &lt;/span&gt;myfile hlink
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Users
&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;# Full setup of User&lt;/span&gt;
adduser tim

&lt;span class="c"&gt;# Just Add user&lt;/span&gt;
useradd tim

&lt;span class="c"&gt;# Delete user&lt;/span&gt;
userdel tim

&lt;span class="c"&gt;# Login into User with sudo privilege&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;su - tim

&lt;span class="c"&gt;# Root user indication&lt;/span&gt;
&lt;span class="s2"&gt;"#"&lt;/span&gt;

&lt;span class="c"&gt;# Standard user indication&lt;/span&gt;
&lt;span class="s2"&gt;"$"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Groups &amp;amp; Ownership
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;==================================&lt;/span&gt;
&lt;span class="c"&gt;# Before you shoud be in root user&lt;/span&gt;
&lt;span class="o"&gt;==================================&lt;/span&gt;
&lt;span class="c"&gt;# Create Group&lt;/span&gt;
groupadd devops

&lt;span class="c"&gt;# Add User into Group- (Adding user:tim into group:devops)&lt;/span&gt;
usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; devops tim

&lt;span class="c"&gt;# Remove user tim from group devops&lt;/span&gt;
deluser tim devops 

&lt;span class="c"&gt;# To see how manu group user belong to&lt;/span&gt;
&lt;span class="nb"&gt;id &lt;/span&gt;tim

&lt;span class="c"&gt;# Change ownership of dir&lt;/span&gt;
&lt;span class="c"&gt;# change owenership of dir to nexus:nexus(user:group) -R recursive&lt;/span&gt;
&lt;span class="nb"&gt;chown&lt;/span&gt; &lt;span class="nt"&gt;-R&lt;/span&gt; nexus:nexus &amp;lt;dir-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  SSH Server
&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;# ssh server config- sshd&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; /etc/ssh/sshd_config.d/&amp;lt;50-cloud-init.conf&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  File Management
&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;# Overwriting the existing content&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file.txt

&lt;span class="c"&gt;# Appending the content&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Services
&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;# Re-read all service configuration files from /etc/systemd/system/&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reload

&lt;span class="c"&gt;# Registers your service to start automatically at boot time&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;myservice

&lt;span class="c"&gt;# Starts your service right now&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start myservice

&lt;span class="c"&gt;# Check status of your service&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status myservice
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Refer Linux Journey
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://linuxjourney.com/" rel="noopener noreferrer"&gt;Linux Journey&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Python Overview</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 20:03:09 +0000</pubDate>
      <link>https://forem.com/kalpesh47/python-overview-4nde</link>
      <guid>https://forem.com/kalpesh47/python-overview-4nde</guid>
      <description>&lt;h2&gt;
  
  
  Python Modules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A file with reusable Python code &lt;code&gt;(functions, classes, variables).&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Example: custom &lt;code&gt;.py&lt;/code&gt; files or &lt;code&gt;sys, math&lt;/code&gt; module&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Python Package
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A &lt;code&gt;folder with related modules&lt;/code&gt;, including an &lt;code&gt;__init__.py&lt;/code&gt; file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Example: &lt;code&gt;numpy&lt;/code&gt; or custom module directories.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;pip&lt;/code&gt; is a tool in Python to &lt;code&gt;install &amp;amp; manage Python packages&lt;/code&gt; or libraries from the Python Package Index &lt;code&gt;(PyPI)&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Python Virtual Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Isolated environment&lt;/code&gt; for project-specific dependencies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create:&lt;/strong&gt; &lt;code&gt;python -m venv &amp;lt;env_name&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Activate:&lt;/strong&gt; &lt;code&gt;source &amp;lt;env_name&amp;gt;/bin/activate&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Command Line Args
&lt;/h2&gt;

&lt;p&gt;Python in build sys module&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt; &lt;span class="c1"&gt;# python inbuild sys module, which is used for command line args
&lt;/span&gt;
&lt;span class="n"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Environment Variables
&lt;/h2&gt;

&lt;p&gt;Env vars used for sensitive data, which we can’t hardcoded:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;API keys&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;passwords&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;tokens&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;certificates&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Declare Env vars in terminal:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;export password=”pass@123”&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Code:&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;

&lt;span class="k"&gt;pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;password&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  File Operation of Windows
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Open&lt;/strong&gt;: &lt;code&gt;open()&lt;/code&gt; with modes (&lt;code&gt;r&lt;/code&gt;, &lt;code&gt;w&lt;/code&gt;, etc.), e.g., &lt;code&gt;open("file.txt", "r")&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Read&lt;/strong&gt;: Use &lt;code&gt;read()&lt;/code&gt;, &lt;code&gt;readline()&lt;/code&gt;, or &lt;code&gt;readlines()&lt;/code&gt; to fetch content.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Write&lt;/strong&gt;: Use &lt;code&gt;write()&lt;/code&gt; or &lt;code&gt;writelines()&lt;/code&gt; in modes like &lt;code&gt;w&lt;/code&gt; or &lt;code&gt;a&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Close&lt;/strong&gt;: Use &lt;code&gt;close()&lt;/code&gt; or &lt;code&gt;with&lt;/code&gt; for auto-closing.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Module
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Requests
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;requests&lt;/code&gt; module in Python simplifies HTTP requests to interact with web servers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Purpose&lt;/strong&gt;: Send HTTP methods (GET, POST, etc.) and handle responses via &lt;code&gt;API&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;: Manage headers, cookies, auth, and work with &lt;code&gt;JSON or text&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Install&lt;/strong&gt;: &lt;code&gt;pip install requests&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;  
&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://example.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Status code  
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;# Response body
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Boto3
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;AWS SDK for Python&lt;/code&gt; to interact programmatically with AWS services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ideal for &lt;code&gt;automating AWS workflows&lt;/code&gt; and managing resources efficiently&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Building serverless applications&lt;/code&gt; with services like Lambda and DynamoDB.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize S3 client
&lt;/span&gt;&lt;span class="n"&gt;s3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;s3&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Upload a file to S3
&lt;/span&gt;&lt;span class="n"&gt;s3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upload_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;local_file.txt&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;my-bucket&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;remote_file.txt&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Flask
&lt;/h3&gt;

&lt;p&gt;It’s a lightweight &lt;code&gt;web framework&lt;/code&gt; in Python used to build &lt;code&gt;web applications&lt;/code&gt; with added functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decorators:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It’s a &lt;code&gt;special function&lt;/code&gt; in Python used to modify the behaviour of another function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It written &lt;code&gt;above function&lt;/code&gt; with &lt;code&gt;@&lt;/code&gt; symbol.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/greet&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# Flask decorator that connects a URL('/greet') route to a function
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Greetings from Flask!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Constructor
&lt;/h2&gt;

&lt;p&gt;It’s special method in a class that runs automatically when you create an object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;__init__&lt;span class="o"&gt;()&lt;/span&gt;

&lt;span class="c"&gt;# __name__ special build-in variable&lt;/span&gt;
__name__ &lt;span class="o"&gt;=&lt;/span&gt; __main__ &lt;span class="c"&gt;# Runs code only when file is executed directly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Pytest
&lt;/h2&gt;

&lt;p&gt;Tool/framework for testing&lt;br&gt;
Basic Structure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;my_project/
│
├── app.py              &lt;span class="c"&gt;# Your actual code&lt;/span&gt;
├── test_app.py         &lt;span class="c"&gt;# Your test file (MUST start with "test_")&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;pytest -v — Verbose output&lt;/li&gt;
&lt;li&gt;pytest -s — Show print statements&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Assert Statements
&lt;/h3&gt;

&lt;p&gt;They check if a condition is True. If True, test passes ✅&lt;/p&gt;

&lt;h3&gt;
  
  
  Fixtures
&lt;/h3&gt;

&lt;p&gt;A fixture in pytest is a reusable piece of setup code that prepares data or resources for your tests.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conftest
&lt;/h3&gt;

&lt;p&gt;Special file where you define fixtures that are automatically available to ALL test files in that directory and sub directories. No imports needed!&lt;/p&gt;

&lt;h3&gt;
  
  
  Mocking
&lt;/h3&gt;

&lt;p&gt;Create fake versions of external dependencies (APIs, databases, files) so tests run fast, reliably.&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Terraform Scenario Qus</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 19:58:48 +0000</pubDate>
      <link>https://forem.com/kalpesh47/terraform-scenario-qus-462b</link>
      <guid>https://forem.com/kalpesh47/terraform-scenario-qus-462b</guid>
      <description>&lt;h2&gt;
  
  
  Scenario 1 : Terraform Migration of AWS Resource
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Import Resource Configuration&lt;/strong&gt;
&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%2Fspbjvkoocaigqragv5b3.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%2Fspbjvkoocaigqragv5b3.png" alt=" " width="508" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Import Block:&lt;/strong&gt; Add the &lt;code&gt;import&lt;/code&gt; block in &lt;a href="http://main.tf" rel="noopener noreferrer"&gt;&lt;code&gt;main.tf&lt;/code&gt;&lt;/a&gt; to specify the EC2 resource ID and target resource name:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;import&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="err"&gt;id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"instance ID"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;aws_instance.example&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;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Generate Resource Configuration:&lt;/strong&gt; Run the command to fetch the resource configuration:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;terraform&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;plan&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-generate-config-out=generated_resources.tf&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Copy Code:&lt;/strong&gt; Copy the generated resource block from &lt;code&gt;generated_&lt;/code&gt;&lt;a href="http://resources.tf" rel="noopener noreferrer"&gt;&lt;code&gt;resources.tf&lt;/code&gt;&lt;/a&gt; to &lt;a href="http://main.tf" rel="noopener noreferrer"&gt;&lt;code&gt;main.tf&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cleanup:&lt;/strong&gt; Delete &lt;code&gt;generated_&lt;/code&gt;&lt;a href="http://resources.tf" rel="noopener noreferrer"&gt;&lt;code&gt;resources.tf&lt;/code&gt;&lt;/a&gt; as it is no longer needed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Import Resource into Statefile&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Run the import command to bring the resource into Terraform state:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;terraform&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;import&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;aws_instance.example&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;&amp;lt;instance&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;ID&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt; The resource data is imported into the Terraform state file, ensuring the state matches the actual resource.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scenario 2 : Terraform Drift Detection
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Terraform doesn't automatically detect manual changes made directly in the AWS cloud.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution 1: Use a Cron Job to Refresh Terraform State&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up a cron job to periodically run &lt;code&gt;terraform refresh&lt;/code&gt;, which updates the Terraform state with the latest changes in the cloud.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solution 2: Use Audit Logs or Event Notifications&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Audit Logs:&lt;/strong&gt; Enable AWS CloudTrail to log and monitor all changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Lambda/Notification:&lt;/strong&gt; Use AWS Lambda functions or event notifications to alert or trigger Terraform updates when manual changes happen by IAM users.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>terraform</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>AWS Strategies</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 19:54:23 +0000</pubDate>
      <link>https://forem.com/kalpesh47/aws-strategies-c6i</link>
      <guid>https://forem.com/kalpesh47/aws-strategies-c6i</guid>
      <description>&lt;h1&gt;
  
  
  AWS Cloud Migration
&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%2Fbnc6jrfjcir1z5i07wdw.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%2Fbnc6jrfjcir1z5i07wdw.png" alt=" " width="613" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1- Preparation stage
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Verify if the application follows a &lt;code&gt;microservices architecture.&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If not, refactor the monolithic application into a microservices architecture.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2- Planning Stage
&lt;/h3&gt;

&lt;p&gt;Break down the microservices migration into phases based on their criticality for cloud migration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Most used Migration Strategies:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rehost (Lift and Shift):&lt;/strong&gt; Move applications to the cloud with minimal changes, focusing on quick deployment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Replatform:&lt;/strong&gt; Optimize specific components for cloud use without significant code changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Refactor/Rearchitect:&lt;/strong&gt; Redesign the application, e.g., transforming a monolithic architecture into microservices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Relocate:&lt;/strong&gt; Shift services, e.g., from Kubernetes to OpenShift or EKS.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Least Used Migration Strategies:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retain:&lt;/strong&gt; Keep certain applications on-premise.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retire:&lt;/strong&gt; Shutdown unused applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repurchase:&lt;/strong&gt; Replace with a cloud-based solution.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  3- Migrate Stage
&lt;/h3&gt;

&lt;p&gt;Conducted in phases, working concurrently with the monitor stage.&lt;/p&gt;

&lt;h3&gt;
  
  
  4- Monitor Stage
&lt;/h3&gt;

&lt;p&gt;Runs alongside the migrate stage to ensure smooth transitions.&lt;/p&gt;

&lt;h3&gt;
  
  
  5- Optimize Stage
&lt;/h3&gt;

&lt;p&gt;Enhance efficiency, refine processes, and implement improvements for better performance.&lt;/p&gt;

&lt;h1&gt;
  
  
  AWS Cost Optimization
&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%2F9pux7zgmq3a2osje1i1c.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%2F9pux7zgmq3a2osje1i1c.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;AWS Resource Groups &amp;amp; Tag Editor&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;Tag Editor&lt;/strong&gt; to track resources and identify those incurring charges.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Set Budgets in AWS Billing&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create &lt;strong&gt;Budgets&lt;/strong&gt; to get alerts when spending hits thresholds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Schedule &lt;strong&gt;budget reports&lt;/strong&gt; for proactive cost management.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Reduce Console Access/UI, Use IaC&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;strong&gt;Terraform&lt;/strong&gt; or similar tools for automated resource management.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Apply Least Privilege Access&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Limit permissions to essential roles to prevent unnecessary resource usage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Automate with AWS Lambda&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use a &lt;strong&gt;Lambda function&lt;/strong&gt; triggered by &lt;strong&gt;cron jobs&lt;/strong&gt;, &lt;strong&gt;AWS CLI&lt;/strong&gt;, or &lt;strong&gt;CloudWatch&lt;/strong&gt; events.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Write Python scripts to identify stale or unused resources based on specific conditions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define actions for stale resources:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. &lt;strong&gt;Notify:&lt;/strong&gt; Use &lt;strong&gt;SNS (Simple Notification Service)&lt;/strong&gt; to send an email alert about stale resources.

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cleanup:&lt;/strong&gt; Automatically delete stale resources using APIs.
&lt;/li&gt;
&lt;/ol&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Request AWS Support for Unexpected Charges&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/h3&gt;



&lt;ul&gt;
&lt;li&gt;Contact &lt;strong&gt;AWS Support&lt;/strong&gt; for waivers on unexpected charges.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
    </item>
    <item>
      <title>AWS ELB (Elastic Load Balancer)</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 19:51:17 +0000</pubDate>
      <link>https://forem.com/kalpesh47/aws-elb-elastic-load-balancer-5go3</link>
      <guid>https://forem.com/kalpesh47/aws-elb-elastic-load-balancer-5go3</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;ELB distributes incoming network traffic across multiple servers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Primary purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Optimize resource use&lt;/li&gt;
&lt;li&gt;Enhance application performance&lt;/li&gt;
&lt;li&gt;Ensure high availability by preventing any single server from becoming overwhelmed with too many requests.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  OSI Model
&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%2Fw8ajmdtu3dii1zqyardn.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%2Fw8ajmdtu3dii1zqyardn.png" alt=" " width="800" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3 Types of ELB
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;ELB Type&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Protocols&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Cost Aspect&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Application Load Balancer (ALB&lt;/strong&gt;) - Layer 7&lt;/td&gt;
&lt;td&gt;HTTP/HTTPS&lt;/td&gt;
&lt;td&gt;Web apps, microservices, content &amp;amp; path-based routing&lt;/td&gt;
&lt;td&gt;Costlier&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Network Load Balancer (NLB)&lt;/strong&gt; - Layer 4&lt;/td&gt;
&lt;td&gt;TCP/UDP/TLS&lt;/td&gt;
&lt;td&gt;Low-latency apps, millions of requests/sec, static IP&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Gateway Load Balancer (GWLB)&lt;/strong&gt; - Layer 3&lt;/td&gt;
&lt;td&gt;IP Protocol&lt;/td&gt;
&lt;td&gt;Network appliances, firewalls, security monitoring&lt;/td&gt;
&lt;td&gt;Less costlier than ALB and NLB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Load Balancer vs API Gateway vs Kubernetes Ingress (Reverse Proxy)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Feature&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Load Balancer&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;API Gateway&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Kubernetes Ingress (Reverse Proxy)&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary Purpose&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Distributes traffic for high availability&lt;/td&gt;
&lt;td&gt;Manages, secures, and scales APIs&lt;/td&gt;
&lt;td&gt;Routes external traffic to internal services in Kubernetes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Layer of Operation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Layer 4 or Layer 7&lt;/td&gt;
&lt;td&gt;Layer 7&lt;/td&gt;
&lt;td&gt;Layer 7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Key Features&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Traffic distribution, fault tolerance&lt;/td&gt;
&lt;td&gt;Authentication, rate limiting, monitoring&lt;/td&gt;
&lt;td&gt;URL rewriting, SSL termination, routing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use Case&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High-traffic web applications (e.g., Amazon)&lt;/td&gt;
&lt;td&gt;Microservices architectures (e.g., Netflix)&lt;/td&gt;
&lt;td&gt;Containerized apps in Kubernetes (e.g., GitHub)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  API Gateway
&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%2Fbfuhx7nj41auvu1p2rn0.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%2Fbfuhx7nj41auvu1p2rn0.png" alt=" " width="720" height="656"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  API Gateway vs Load Balancer
&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%2Fr9w0h7dncck1puwfyui7.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%2Fr9w0h7dncck1puwfyui7.png" alt=" " width="720" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Example: E-commerce Platform&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Load Balancer&lt;/strong&gt;: Distributes traffic across multiple API Gateway instances.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Gateway&lt;/strong&gt;: Manages and secures APIs for product catalog, user authentication, and payment processing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kubernetes Ingress&lt;/strong&gt;: Routes traffic to backend services like inventory management, order processing, and recommendation engines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backend Services&lt;/strong&gt;: Reside in a private subnet and handle the core business logic.&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%2Fjrjghufbzmhwaim7ye2j.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%2Fjrjghufbzmhwaim7ye2j.png" alt=" " width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to share and spread the knowledge! 🌟😊 Enjoy Learning! 😊&lt;/p&gt;

</description>
      <category>aws</category>
      <category>loadbalancer</category>
    </item>
    <item>
      <title>AWS Services- 2</title>
      <dc:creator>KALPESH</dc:creator>
      <pubDate>Thu, 05 Mar 2026 19:49:21 +0000</pubDate>
      <link>https://forem.com/kalpesh47/aws-services-2-372b</link>
      <guid>https://forem.com/kalpesh47/aws-services-2-372b</guid>
      <description>&lt;h1&gt;
  
  
  S3 Buckets
&lt;/h1&gt;

&lt;p&gt;S3 buckets are containers for storing &lt;code&gt;objects (files)&lt;/code&gt; in Amazon S3.&lt;br&gt;
Amazon S3 (Simple Storage Service) is a &lt;code&gt;scalable, secure&lt;/code&gt; cloud storage solution from AWS&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of S3 Buckets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Durability and Availability:&lt;/strong&gt; High durability and availability for data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scalability:&lt;/strong&gt; Store and retrieve unlimited data without capacity concerns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security:&lt;/strong&gt; Features like encryption, access control, and audit logging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance:&lt;/strong&gt; Optimized for high performance in data operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cost-Effective:&lt;/strong&gt; Flexible pricing models based on usage.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Uploading and Managing Objects in S3 Buckets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Methods of Uploading:&lt;/strong&gt; Objects can be uploaded via the AWS Management Console, AWS CLI, SDKs, or direct HTTP uploads, each with a unique key for retrieval.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Object Metadata:&lt;/strong&gt; Includes content type, cache control, encryption settings, and custom attributes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Versioning&lt;/strong&gt;: Retain multiple versions of an object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;File Formats and Encryption:&lt;/strong&gt; Supports various file formats and server-side encryption options (SSE-S3, SSE-KMS, SSE-C).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lifecycle Management:&lt;/strong&gt; Define rules for transitioning storage classes or automatic deletions to optimize costs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multipart Uploads:&lt;/strong&gt; Enhances performance for large objects by allowing parallel uploads and resumable transfers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;S3 Batch Operations:&lt;/strong&gt; Facilitates bulk actions on datasets, such as copying, tagging, or restoring archived data.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Advanced S3 Bucket Features
&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%2F6ozdsb37bhdojf4jy8h0.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%2F6ozdsb37bhdojf4jy8h0.png" alt=" " width="800" height="154"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Storage Classes:&lt;/strong&gt; Offers various storage classes for different use cases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Replication:&lt;/strong&gt; Enables automatic replication across buckets for disaster recovery or low-latency access.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Event Notifications:&lt;/strong&gt; Configure triggers for actions like AWS Lambda functions or messaging with Amazon SQS/SNS on object events.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Security and Compliance in S3 Buckets
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Security Considerations:&lt;/strong&gt; Ensure proper configuration of bucket policies, access controls.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Encryption:&lt;/strong&gt; Utilize server-side encryption for data at rest and SSL/TLS for data in transit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Access Logging:&lt;/strong&gt; Activate logging to record request histories and monitor for unauthorized activities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  S3 Bucket Management and Administration
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bucket Policies:&lt;/strong&gt; Manage access permissions with JSON-format policies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;IAM Roles:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use IAM roles for temporary credentials and fine-grained control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM user policies&lt;/strong&gt; can &lt;code&gt;override&lt;/code&gt; settings in &lt;strong&gt;S3 bucket policies&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;APIs and SDKs:&lt;/strong&gt; Programmatically interact with S3 using AWS SDKs or APIs.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Monitoring with CloudWatch:&lt;/strong&gt; Monitor S3 metrics and set alarms for specific events.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Troubleshooting and Error Handling
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Common Errors:&lt;/strong&gt; Address access denied, bucket not found, and quota exceeded issues by checking permissions and configurations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Debugging Access Issues:&lt;/strong&gt; Utilize &lt;code&gt;AWS CloudTrail&lt;/code&gt; and access logs to resolve permission-related problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Consistency:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use versioning&lt;/li&gt;
&lt;li&gt;Use S3 notifications for recovery&lt;/li&gt;
&lt;li&gt;Use Cross-Region Replication for disaster recovery.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h1&gt;
  
  
  Secret Management on AWS
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS KMS (Key Management Service):&lt;/strong&gt; Encryption and management of cryptographic keys Securely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS System Manager:&lt;/strong&gt; Storing &lt;code&gt;non-sensitive&lt;/code&gt; configuration data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AWS Secrets Manager:&lt;/strong&gt; Storing &lt;code&gt;sensitive data&lt;/code&gt; securely &amp;amp; automatically &lt;code&gt;rotate secrets&lt;/code&gt; and manage access through IAM.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HashiCorp Vault:&lt;/strong&gt; It’s a open source platform, designed for &lt;code&gt;hybrid&lt;/code&gt; environments with &lt;code&gt;robust features&lt;/code&gt;, unlike aws focus.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feel free to share and spread the knowledge! 🌟😊 Enjoy Learning! 😊&lt;/p&gt;

</description>
      <category>aws</category>
      <category>s3</category>
    </item>
  </channel>
</rss>
