<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prajwal P</title>
    <description>The latest articles on DEV Community by Prajwal P (@prajwal_devops).</description>
    <link>https://dev.to/prajwal_devops</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%2F3679210%2Fa77a1571-e5d6-42d0-a9fb-0cd6564955d0.jpg</url>
      <title>DEV Community: Prajwal P</title>
      <link>https://dev.to/prajwal_devops</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prajwal_devops"/>
    <language>en</language>
    <item>
      <title>How I Debugged an "Undeletable" AWS Elastic IP and Traced It Back to Redshift Serverless</title>
      <dc:creator>Prajwal P</dc:creator>
      <pubDate>Mon, 11 May 2026 12:01:27 +0000</pubDate>
      <link>https://dev.to/prajwal_devops/how-i-debugged-an-undeletable-aws-elastic-ip-and-traced-it-back-to-redshift-serverless-429d</link>
      <guid>https://dev.to/prajwal_devops/how-i-debugged-an-undeletable-aws-elastic-ip-and-traced-it-back-to-redshift-serverless-429d</guid>
      <description>&lt;p&gt;Here's your clean blog ready to paste on Dev.to and Medium:&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;TITLE:&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;How I Debugged an "Undeletable" AWS Elastic IP and Traced It Back to Redshift Serverless
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;COVER IMAGE:&lt;/strong&gt; Use a screenshot of your AWS console or the diagram we created earlier.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;CONTENT — paste exactly as below:&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;If you work with AWS long enough, you'll eventually hit a resource that looks simple but turns into a deep troubleshooting rabbit hole.&lt;/p&gt;

&lt;p&gt;Recently, while cleaning up unused AWS resources to reduce costs, I discovered an idle Elastic IP in my account.&lt;/p&gt;

&lt;p&gt;At first glance, everything looked normal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No EC2 instance attached&lt;/li&gt;
&lt;li&gt;No NAT Gateway&lt;/li&gt;
&lt;li&gt;No Load Balancer&lt;/li&gt;
&lt;li&gt;No obvious parent resource&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So naturally, I thought: "This should be easy. I'll just release the Elastic IP."&lt;/p&gt;

&lt;p&gt;AWS had other plans.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;When I tried deleting the related VPC endpoint, AWS returned this error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Operation is not allowed for requester-managed VPC endpoints
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That error started one of the most interesting AWS troubleshooting sessions I've worked on — involving ENIs, VPC Endpoints, Security Groups, VPC Flow Logs, CloudWatch Logs Insights, AWS CLI, and Redshift Serverless hidden networking dependencies.&lt;/p&gt;




&lt;h2&gt;
  
  
  First Clue — ENI With No EC2 Instance
&lt;/h2&gt;

&lt;p&gt;Inside EC2 → Network Interfaces, I found an ENI with these details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Interface Type: &lt;code&gt;vpc_endpoint&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Status: &lt;code&gt;in-use&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Requester-managed: &lt;code&gt;true&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Immediately, several questions came up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why does a VPC endpoint have an Elastic IP?&lt;/li&gt;
&lt;li&gt;Which AWS service owns this?&lt;/li&gt;
&lt;li&gt;Why can't I delete it?&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Understanding "Requester-Managed"
&lt;/h2&gt;

&lt;p&gt;This was the major breakthrough.&lt;/p&gt;

&lt;p&gt;When AWS marks a resource as &lt;code&gt;RequesterManaged = true&lt;/code&gt; it means the resource exists inside your AWS account, but another AWS-managed service owns and controls it.&lt;/p&gt;

&lt;p&gt;That is why I could see the ENI, the VPC endpoint, and the Elastic IP — but could not directly delete them.&lt;/p&gt;

&lt;p&gt;This behavior commonly happens with managed AWS services such as Redshift Serverless, EKS, Lambda VPC networking, OpenSearch, SageMaker, ECS/Fargate, and PrivateLink integrations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Investigating the VPC Endpoint
&lt;/h2&gt;

&lt;p&gt;I inspected the endpoint using AWS CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ec2 describe-vpc-endpoints &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--vpc-endpoint-ids&lt;/span&gt; vpce-009f75251024f3fb2 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; ap-south-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The service name returned was a generated ID — AWS hides backend managed services behind these. Not useful on its own.&lt;/p&gt;




&lt;h2&gt;
  
  
  Security Group Investigation — The Turning Point
&lt;/h2&gt;

&lt;p&gt;The endpoint was attached to a security group called &lt;code&gt;data-engineering-SG&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;So I listed all ENIs using that security group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws ec2 describe-network-interfaces &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--filters&lt;/span&gt; &lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;group-id,Values&lt;span class="o"&gt;=&lt;/span&gt;sg-013897824370ebff3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One ENI description contained this string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;711651397674-REDSHIFT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That single word changed the entire investigation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Confirming Redshift Serverless
&lt;/h2&gt;

&lt;p&gt;I ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws redshift-serverless list-workgroups
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output showed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"vpcEndpointId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"vpce-009f75251024f3fb2"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Root cause confirmed.&lt;/p&gt;

&lt;p&gt;The actual dependency chain was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Redshift Serverless
        ↓
Requester-managed VPC Endpoint
        ↓
AWS-managed ENIs
        ↓
Elastic IP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Elastic IP itself was never the real issue. It was simply a networking dependency created by Redshift Serverless.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bonus Discovery — Internet Bots Were Hitting the Endpoint
&lt;/h2&gt;

&lt;p&gt;Before confirming Redshift, I enabled VPC Flow Logs to verify whether anything inside my VPC was actively using the endpoint.&lt;/p&gt;

&lt;p&gt;The logs showed traffic from public internet scanners continuously probing the endpoint because the attached security group allowed all traffic from &lt;code&gt;0.0.0.0/0&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That traffic made the endpoint appear active even though no legitimate workloads were using it.&lt;/p&gt;

&lt;p&gt;First immediate fix: removed all &lt;code&gt;0.0.0.0/0&lt;/code&gt; inbound rules.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Fix
&lt;/h2&gt;

&lt;p&gt;Once the root cause was confirmed, I deleted the Redshift Serverless resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1 — Delete the Workgroup:&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;aws redshift-serverless delete-workgroup &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--workgroup-name&lt;/span&gt; demos-workgroup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 — Delete the Namespace:&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;aws redshift-serverless delete-namespace &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--namespace-name&lt;/span&gt; demos-namespace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, AWS automatically cleaned up the VPC endpoint, the ENIs, and the Elastic IP association.&lt;/p&gt;

&lt;p&gt;The "undeletable" Elastic IP disappeared automatically.&lt;/p&gt;




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

&lt;p&gt;&lt;strong&gt;1. RequesterManaged = true is always a clue&lt;/strong&gt;&lt;br&gt;
Stop trying to delete the networking resource directly. Find the managed AWS service that owns it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Networking resources are usually symptoms, not root causes&lt;/strong&gt;&lt;br&gt;
The Elastic IP was not the actual issue. Redshift Serverless was.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Security groups can mislead investigations&lt;/strong&gt;&lt;br&gt;
Internet scanners made the endpoint appear active even though no internal workloads were using it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Follow the dependency chain&lt;/strong&gt;&lt;br&gt;
Elastic IP → ENI → VPC Endpoint → Security Group → ENI Metadata → Parent Service → Delete&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. VPC Flow Logs are underrated&lt;/strong&gt;&lt;br&gt;
They helped eliminate false assumptions and saved hours of troubleshooting.&lt;/p&gt;


&lt;h2&gt;
  
  
  AWS Services That Commonly Create Hidden Networking Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Redshift Serverless&lt;/li&gt;
&lt;li&gt;EKS&lt;/li&gt;
&lt;li&gt;Lambda VPC networking&lt;/li&gt;
&lt;li&gt;ECS/Fargate&lt;/li&gt;
&lt;li&gt;OpenSearch&lt;/li&gt;
&lt;li&gt;SageMaker&lt;/li&gt;
&lt;li&gt;RDS Proxy&lt;/li&gt;
&lt;li&gt;AWS Glue&lt;/li&gt;
&lt;li&gt;PrivateLink / VPC Lattice&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;What started as "Why can't I delete this Elastic IP?" turned into a VPC networking investigation, a security audit, and a managed-service dependency trace.&lt;/p&gt;

&lt;p&gt;The biggest lesson:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In AWS, always delete the parent resource — not the symptom.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The next time you see &lt;code&gt;RequesterManaged = true&lt;/code&gt;, your first troubleshooting step should be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws redshift-serverless list-workgroups
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Have you ever debugged a mysterious AWS dependency caused by a managed service? Drop your experience in the comments.&lt;/p&gt;




</description>
      <category>aws</category>
      <category>cloud</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title># 🚀 From “Why is nothing working?” to “Now I Understand Everything” — My Docker Compose + MongoDB + Volume Learning Journey</title>
      <dc:creator>Prajwal P</dc:creator>
      <pubDate>Tue, 14 Apr 2026 12:53:58 +0000</pubDate>
      <link>https://dev.to/prajwal_devops/-from-why-is-nothing-working-to-now-i-understand-everything-my-docker-compose-mongodb--3hkf</link>
      <guid>https://dev.to/prajwal_devops/-from-why-is-nothing-working-to-now-i-understand-everything-my-docker-compose-mongodb--3hkf</guid>
      <description>&lt;p&gt;``## 📌 Introduction&lt;/p&gt;

&lt;p&gt;This is not just a blog.&lt;/p&gt;

&lt;p&gt;This is a &lt;strong&gt;complete journey&lt;/strong&gt; of how I:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deployed a multi-container application on EC2&lt;/li&gt;
&lt;li&gt;Debugged Docker networking issues&lt;/li&gt;
&lt;li&gt;Fixed backend and frontend problems&lt;/li&gt;
&lt;li&gt;Understood MongoDB behavior&lt;/li&gt;
&lt;li&gt;And finally learned &lt;strong&gt;Docker volumes deeply&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn’t learn this from theory.&lt;/p&gt;

&lt;p&gt;I learned it by:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`text id="k5l1tt"&lt;br&gt;
breaking things → debugging → understanding → fixing&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🏗️ Project Architecture
&lt;/h2&gt;

&lt;p&gt;My setup had 3 containers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Node.js App (Frontend + Backend)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;MongoDB Database&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mongo Express (DB UI)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All managed using Docker Compose.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ Step 1: Initial Setup
&lt;/h2&gt;

&lt;p&gt;I ran:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="g3f8t0"&lt;br&gt;
docker compose up -d&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Everything started successfully.&lt;/p&gt;

&lt;p&gt;When I opened:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="v34txs"&lt;br&gt;
http://&amp;lt;EC2-IP&amp;gt;:3000&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 UI loaded&lt;br&gt;
👉 But no data was showing from MongoDB ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 1: No Data in UI
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`text id="x0k3qv"&lt;br&gt;
Data from MongoDB:&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 Empty&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Debugging Step 1: Browser Network Tab
&lt;/h2&gt;

&lt;p&gt;I checked DevTools → Network&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="zk6v0l"&lt;br&gt;
/fetch-data → FAILED ❌&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 2: Wrong API URL
&lt;/h2&gt;

&lt;p&gt;Frontend code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="s2o64r"&lt;br&gt;
fetch("http://localhost:3000/fetch-data")&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 Wrong ❌&lt;/p&gt;

&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Browser → localhost = my laptop&lt;/li&gt;
&lt;li&gt;App → running on EC2&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ Fix 1: Use Relative Path
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="kz8yqf"&lt;br&gt;
fetch("/fetch-data")&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Debugging Step 2: API Response
&lt;/h2&gt;

&lt;p&gt;Now API returned:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="r1w9cz"&lt;br&gt;
200 OK&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But response:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="2l6c9c"&lt;br&gt;
{}&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 3: MongoDB Empty
&lt;/h2&gt;

&lt;p&gt;I checked MongoDB:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="s1vxz1"&lt;br&gt;
show dbs&lt;br&gt;
use my-db&lt;br&gt;
show collections&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 No collections ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Fix 2: Insert Data
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="7x6pkn"&lt;br&gt;
db.my-collection.insertOne({&lt;br&gt;
  data: "some dynamic data loaded from DB"&lt;br&gt;
})&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Debugging Step 3: Still Not Working
&lt;/h2&gt;

&lt;p&gt;Even after inserting data:&lt;br&gt;
👉 UI still empty ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 4: Backend Not Fetching Data
&lt;/h2&gt;

&lt;p&gt;Backend was not:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Selecting DB properly&lt;/li&gt;
&lt;li&gt;Querying collection&lt;/li&gt;
&lt;li&gt;Returning response&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ Fix 3: Backend Logic
&lt;/h2&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;js id="v9u5ah"&lt;br&gt;
const db = client.db("my-db");&lt;/p&gt;

&lt;p&gt;db.collection("my-collection").findOne({}, function (err, result) {&lt;br&gt;
  res.json({&lt;br&gt;
    data: result.data&lt;br&gt;
  });&lt;br&gt;
});&lt;br&gt;
&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 Debugging Step 4: Still Empty UI
&lt;/h2&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API working ✅&lt;/li&gt;
&lt;li&gt;DB has data ✅&lt;/li&gt;
&lt;li&gt;Backend correct ✅&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 UI still empty ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 5: Frontend Bug
&lt;/h2&gt;

&lt;p&gt;Mistake:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="n3x7ml"&lt;br&gt;
fetch('/fetch-data');&lt;br&gt;
const jsonResponse = await response.json();&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 response undefined ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Fix 4: Correct Fetch
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`js id="9z1qj8"&lt;br&gt;
const response = await fetch('/fetch-data');&lt;br&gt;
const jsonResponse = await response.json();&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 6: DOM Not Loaded
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="3u7q3x"&lt;br&gt;
document.getElementById('dynamic')&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 ran too early ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Fix 5: window.onload
&lt;/h2&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;js id="y5u2p0"&lt;br&gt;
window.onload = async function () {&lt;br&gt;
  const response = await fetch('/fetch-data');&lt;br&gt;
  const jsonResponse = await response.json();&lt;/p&gt;

&lt;p&gt;document.getElementById('dynamic').textContent = jsonResponse.data;&lt;br&gt;
};&lt;br&gt;
&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Problem 7: Container Not Updating
&lt;/h2&gt;

&lt;p&gt;Changes not reflecting ❌&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Fix 6: Rebuild + Recreate
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="0j6yxn"&lt;br&gt;
docker compose down&lt;br&gt;
docker compose up --build --force-recreate -d&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




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

&lt;p&gt;&lt;code&gt;`id="l8m1n7"&lt;br&gt;
Data from MongoDB: some dynamic data loaded from DB&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  💾 The Biggest Learning — Docker Volumes
&lt;/h1&gt;

&lt;p&gt;After everything worked, I discovered a critical issue.&lt;/p&gt;

&lt;p&gt;When I ran:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`id="w5n6t2"&lt;br&gt;
docker compose down -v&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 My database data was gone 💥&lt;/p&gt;




&lt;h2&gt;
  
  
  ❗ Why Data Was Lost
&lt;/h2&gt;

&lt;p&gt;Because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Containers are temporary&lt;/li&gt;
&lt;li&gt;Data inside container is NOT persistent&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🔥 What Is a Docker Volume?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A Docker volume is persistent storage mounted directly into a container.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🧠 My Initial Wrong Thinking
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;“Volume is just a link”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;❌ WRONG&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Correct Understanding
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Volume is directly mounted into container&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  📦 MongoDB Data Path
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="d7n9rs"&lt;br&gt;
/data/db&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔗 What Docker Does
&lt;/h2&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;yaml id="3c5y7a"&lt;br&gt;
volumes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;mongo-data:/data/db
&lt;code&gt;&lt;/code&gt;`&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;👉 Docker:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`text id="9n4qkz"&lt;br&gt;
mounts volume → /data/db&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  📊 Visual Flow
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="y0h4b8"&lt;br&gt;
[ Container ]&lt;br&gt;
     │&lt;br&gt;
     ▼&lt;br&gt;
 /data/db&lt;br&gt;
     │&lt;br&gt;
     ▼&lt;br&gt;
[ Docker Volume ]&lt;br&gt;
     │&lt;br&gt;
     ▼&lt;br&gt;
[ Host Storage ]&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔁 What Happens on Recreate
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="5v1q6k"&lt;br&gt;
docker compose down&lt;br&gt;
docker compose up&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;Container deleted ❌&lt;/li&gt;
&lt;li&gt;Volume remains ✅&lt;/li&gt;
&lt;li&gt;New container created ✅&lt;/li&gt;
&lt;li&gt;Volume mounted again ✅&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;👉 MongoDB reads existing data ✅&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 Real-world Analogy
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Container = Laptop 💻&lt;/li&gt;
&lt;li&gt;Volume = External Hard Disk 💾&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚠️ Critical Command
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="3m9q8x"&lt;br&gt;
docker compose down -v&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 Deletes volume ❌&lt;br&gt;
👉 Deletes data 💥&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Safe Command
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;`id="n8k2z7"&lt;br&gt;
docker compose down&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;👉 Keeps data ✅&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 Final Understanding
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Container = temporary&lt;/li&gt;
&lt;li&gt;Volume = persistent&lt;/li&gt;
&lt;li&gt;Data lives in volume&lt;/li&gt;
&lt;li&gt;Container just uses it&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 Final DevOps Insight
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;“Containers are ephemeral, but data must be persistent. Docker volumes ensure data survives container lifecycle.”&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🚀 What I Learned
&lt;/h2&gt;

&lt;p&gt;This project taught me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker Compose networking&lt;/li&gt;
&lt;li&gt;Service name vs localhost&lt;/li&gt;
&lt;li&gt;EC2 deployment&lt;/li&gt;
&lt;li&gt;MongoDB authentication&lt;/li&gt;
&lt;li&gt;Backend API debugging&lt;/li&gt;
&lt;li&gt;Frontend async handling&lt;/li&gt;
&lt;li&gt;Docker rebuild vs recreate&lt;/li&gt;
&lt;li&gt;Docker volumes (most important 🔥)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 Interview Answer
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;“I deployed a multi-container app using Docker Compose on EC2, debugged networking and application issues, and implemented Docker volumes to ensure persistent database storage across container restarts.”&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  📢 Connect with me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/prajwalputtaraju/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/prajwalputtaraju/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/Prajwal8651" rel="noopener noreferrer"&gt;https://github.com/Prajwal8651&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Docker #DockerCompose #DockerVolumes #DevOps #MongoDB #AWS #NodeJS #Debugging #LearningByDoing #30DaysofAWSTerraform
&lt;/h1&gt;

</description>
      <category>docker</category>
      <category>mongodb</category>
      <category>node</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
