<?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: Nirmal Mahale</title>
    <description>The latest articles on Forem by Nirmal Mahale (@nirmal7030).</description>
    <link>https://forem.com/nirmal7030</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%2F3672728%2F3b22fca0-2c04-4fe2-b293-d783123f4549.jpeg</url>
      <title>Forem: Nirmal Mahale</title>
      <link>https://forem.com/nirmal7030</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nirmal7030"/>
    <language>en</language>
    <item>
      <title>Public vs Private Subnets in AWS - What Finally Made It Click for Me</title>
      <dc:creator>Nirmal Mahale</dc:creator>
      <pubDate>Tue, 06 Jan 2026 17:08:21 +0000</pubDate>
      <link>https://forem.com/nirmal7030/public-vs-private-subnets-in-aws-what-finally-made-it-click-for-me-f29</link>
      <guid>https://forem.com/nirmal7030/public-vs-private-subnets-in-aws-what-finally-made-it-click-for-me-f29</guid>
      <description>&lt;p&gt;When I first started learning AWS networking, the idea of public and private subnets sounded simple.&lt;/p&gt;

&lt;p&gt;Public means “internet-facing.”&lt;br&gt;
Private means “not internet-facing.”&lt;/p&gt;

&lt;p&gt;Yet, when I actually started building VPCs, everything felt confusing.&lt;br&gt;
Instances behaved in ways I didn’t expect, and I couldn’t clearly explain why something was public or private.&lt;/p&gt;

&lt;p&gt;It wasn’t until I understood what really defines a subnet that the concept finally clicked.&lt;/p&gt;

&lt;p&gt;This article explains that moment of clarity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Public vs Private Subnets Confused Me Initially
&lt;/h2&gt;

&lt;p&gt;In the beginning, I associated subnets with visibility:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public subnet → visible to the internet&lt;/li&gt;
&lt;li&gt;Private subnet → hidden from the internet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But AWS doesn’t label subnets this way.&lt;/p&gt;

&lt;p&gt;There is no checkbox called “public” or “private” when you create a subnet.&lt;br&gt;
That alone should have been a hint that something deeper was happening.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Everything Felt “Public” at First
&lt;/h2&gt;

&lt;p&gt;Early on, my EC2 instances were reachable from the internet, even when I thought they shouldn’t be.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;An Internet Gateway attached to the VPC&lt;/li&gt;
&lt;li&gt;EC2 instances with public IPs&lt;/li&gt;
&lt;li&gt;Security groups allowing access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because things worked, I assumed the subnet was public by default.&lt;/p&gt;

&lt;p&gt;What I didn’t realise was that internet access is not about the subnet name — it’s about routing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Moment the Concept Finally Clicked
&lt;/h2&gt;

&lt;p&gt;The realisation came when I looked closely at route tables.&lt;/p&gt;

&lt;p&gt;A subnet is considered public if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Its route table has a route to an Internet Gateway&lt;br&gt;
A subnet is considered private if:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Its route table does not have a route to an Internet Gateway&lt;br&gt;
That’s it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing else decides it.&lt;/p&gt;

&lt;p&gt;Once I understood that, everything else made sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Routing Tables Actually Define a Subnet
&lt;/h2&gt;

&lt;p&gt;Each subnet in a VPC is associated with a route table.&lt;/p&gt;

&lt;p&gt;That route table determines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Where traffic can go&lt;/li&gt;
&lt;li&gt;Whether it can reach the internet&lt;/li&gt;
&lt;li&gt;How external traffic returns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If traffic can go directly to the Internet Gateway, the subnet is public.&lt;br&gt;
If it can’t, the subnet is private — even if instances inside it can still access the internet indirectly.&lt;/p&gt;

&lt;p&gt;This changed how I thought about subnet design entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Internet Gateways and NAT Gateways Belong
&lt;/h2&gt;

&lt;p&gt;Understanding routing also clarified the role of gateways.&lt;/p&gt;

&lt;h2&gt;
  
  
  Internet Gateway
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Attached at the VPC level&lt;/li&gt;
&lt;li&gt;Used by public subnets&lt;/li&gt;
&lt;li&gt;Allows inbound and outbound internet traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  NAT Gateway
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Placed in a public subnet&lt;/li&gt;
&lt;li&gt;Used by private subnets for outbound access only&lt;/li&gt;
&lt;li&gt;Prevents inbound internet traffic to private instances&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This design allows private resources to reach the internet without being exposed to it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How This Changed My Architecture Decisions
&lt;/h2&gt;

&lt;p&gt;Once the concept clicked, I stopped placing resources randomly.&lt;/p&gt;

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

&lt;p&gt;Load balancers and bastion hosts go into public subnets&lt;/p&gt;

&lt;p&gt;Application servers and databases go into private subnets&lt;/p&gt;

&lt;p&gt;Routing is designed before launching instances&lt;/p&gt;

&lt;p&gt;Instead of reacting to connectivity issues, I started designing intentionally.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudsecurity</category>
      <category>networking</category>
      <category>learning</category>
    </item>
    <item>
      <title>Security Groups vs NACLs — What I Got Wrong at First</title>
      <dc:creator>Nirmal Mahale</dc:creator>
      <pubDate>Thu, 25 Dec 2025 18:34:58 +0000</pubDate>
      <link>https://forem.com/nirmal7030/security-groups-vs-nacls-what-i-got-wrong-at-first-21o</link>
      <guid>https://forem.com/nirmal7030/security-groups-vs-nacls-what-i-got-wrong-at-first-21o</guid>
      <description>&lt;p&gt;When I started working with AWS, I believed that security groups were enough.&lt;/p&gt;

&lt;p&gt;My EC2 instances were running, ports were controlled, and nothing seemed exposed.&lt;br&gt;
So naturally, when I came across &lt;strong&gt;Network ACLs (NACLs),&lt;/strong&gt; I assumed they were optional or redundant.&lt;/p&gt;

&lt;p&gt;That assumption turned out to be incomplete.&lt;/p&gt;

&lt;p&gt;This article explains what I misunderstood initially, how security groups and NACLs actually differ, and how my approach to AWS network security changed once things clicked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Thought Security Groups Were Sufficient
&lt;/h2&gt;

&lt;p&gt;Security groups are introduced early when launching EC2 instances.&lt;br&gt;
They are simple to configure and immediately useful.&lt;/p&gt;

&lt;p&gt;At the time, my thinking was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security groups control traffic&lt;/li&gt;
&lt;li&gt;I can restrict ports and IPs&lt;/li&gt;
&lt;li&gt;That should be enough&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because everything worked as expected, I didn’t question this setup further.&lt;br&gt;
NACLs felt like something “advanced” that I could ignore for now.&lt;/p&gt;

&lt;h2&gt;
  
  
  What NACLs Actually Do
&lt;/h2&gt;

&lt;p&gt;A Network ACL works at the subnet level, not the instance level.&lt;/p&gt;

&lt;p&gt;Instead of protecting a single EC2 instance, a NACL controls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What traffic is allowed into a subnet&lt;/li&gt;
&lt;li&gt;What traffic is allowed out of a subnet&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One key difference I didn’t understand early on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;NACLs are stateless&lt;/li&gt;
&lt;li&gt;You must explicitly allow both inbound and outbound traffic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was very different from security groups.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Confusion I Had Initially
&lt;/h2&gt;

&lt;p&gt;The main confusion came from overlap.&lt;/p&gt;

&lt;p&gt;Both security groups and NACLs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Control traffic&lt;/li&gt;
&lt;li&gt;Use rules&lt;/li&gt;
&lt;li&gt;Sit inside a VPC&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So my question was:&lt;/p&gt;

&lt;p&gt;“Why would I need both?”&lt;/p&gt;

&lt;p&gt;The answer is layered security — but that only makes sense once you understand where each one operates.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Key Differences That Finally Made It Clear
&lt;/h2&gt;

&lt;p&gt;Here’s what helped everything click for me:&lt;/p&gt;

&lt;h2&gt;
  
  
  Security Groups
&lt;/h2&gt;

&lt;p&gt;Applied at &lt;strong&gt;EC2 instance level&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stateful&lt;/strong&gt; (responses are automatically allowed)&lt;/p&gt;

&lt;p&gt;Easier to manage&lt;/p&gt;

&lt;p&gt;Ideal for application-level control&lt;/p&gt;

&lt;h2&gt;
  
  
  Network ACLs
&lt;/h2&gt;

&lt;p&gt;Applied at &lt;strong&gt;subnet level&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stateless&lt;/strong&gt; (inbound and outbound rules required)&lt;/p&gt;

&lt;p&gt;Act as a first line of defence&lt;/p&gt;

&lt;p&gt;Useful for broad network restrictions&lt;/p&gt;

&lt;p&gt;Once I saw this as &lt;strong&gt;layers&lt;/strong&gt;, not duplicates, it made sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Security Groups Are Usually Enough
&lt;/h2&gt;

&lt;p&gt;For small projects or learning environments:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single EC2 instance&lt;/li&gt;
&lt;li&gt;Limited exposure&lt;/li&gt;
&lt;li&gt;Controlled IP access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security groups alone can be sufficient if configured properly.&lt;/p&gt;

&lt;p&gt;This is why many beginners never touch NACLs — and that’s okay initially.&lt;/p&gt;

&lt;h2&gt;
  
  
  When NACLs Start to Matter
&lt;/h2&gt;

&lt;p&gt;NACLs become important when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You have multiple instances in a subnet&lt;/li&gt;
&lt;li&gt;You want a baseline security rule for the network&lt;/li&gt;
&lt;li&gt;You need to block or allow traffic at a broader level&lt;/li&gt;
&lt;li&gt;You want defence in depth&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of trusting every instance configuration, the subnet itself enforces rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Approach Network Security Now
&lt;/h2&gt;

&lt;p&gt;After understanding both, my approach changed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use NACLs for high-level subnet controls&lt;/li&gt;
&lt;li&gt;Use security groups for fine-grained instance access&lt;/li&gt;
&lt;li&gt;Avoid relying on only one layer&lt;/li&gt;
&lt;li&gt;Review rules periodically, not just at setup&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security stopped being something I “set once” and started being something I designed intentionally.&lt;/p&gt;

&lt;p&gt;Who This Is Useful For&lt;/p&gt;

&lt;p&gt;This lesson is especially relevant if you are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learning AWS networking&lt;/li&gt;
&lt;li&gt;Confused by overlapping security concepts&lt;/li&gt;
&lt;li&gt;Preparing for real-world cloud roles&lt;/li&gt;
&lt;li&gt;Moving from tutorials to actual architectures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding this early prevents fragile designs later.&lt;/p&gt;

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

&lt;p&gt;Security groups and NACLs are not competitors.&lt;br&gt;
They solve different problems at different layers.&lt;/p&gt;

&lt;p&gt;What I got wrong at first wasn’t a configuration mistake —&lt;br&gt;
it was how I thought about security boundaries.&lt;/p&gt;

&lt;p&gt;Once that changed, my AWS architectures became clearer, safer, and easier to reason about.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudnative</category>
      <category>networking</category>
      <category>learning</category>
    </item>
    <item>
      <title>I Thought My AWS EC2 Was Secure — Until I Checked My Security Groups</title>
      <dc:creator>Nirmal Mahale</dc:creator>
      <pubDate>Sun, 21 Dec 2025 13:52:03 +0000</pubDate>
      <link>https://forem.com/nirmal7030/i-thought-my-aws-ec2-was-secure-until-i-checked-my-security-groups-3183</link>
      <guid>https://forem.com/nirmal7030/i-thought-my-aws-ec2-was-secure-until-i-checked-my-security-groups-3183</guid>
      <description>&lt;p&gt;When I launched my first EC2 instance on AWS, I felt confident.&lt;br&gt;
The instance was running, I could connect to it, and nothing seemed wrong.&lt;/p&gt;

&lt;p&gt;In my mind, that meant one thing: it must be secure.&lt;/p&gt;

&lt;p&gt;I was wrong.&lt;/p&gt;

&lt;p&gt;It was only when I actually reviewed my security group rules that I realised how exposed my instance really was — and how easily this mistake could be repeated by beginners.&lt;/p&gt;

&lt;p&gt;This article documents what I assumed, what I discovered, and what I fixed — so others don’t make the same mistake.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Thought My EC2 Instance Was Secure
&lt;/h2&gt;

&lt;p&gt;Like many beginners, I focused on getting things to work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The EC2 instance launched successfully&lt;/li&gt;
&lt;li&gt;SSH access worked&lt;/li&gt;
&lt;li&gt;The application was reachable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At that point, I moved on — assuming security was “handled”.&lt;/p&gt;

&lt;p&gt;What I didn’t do initially was question the default and convenience-driven choices I had made while configuring the instance.&lt;/p&gt;

&lt;p&gt;That’s where the problem started.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Security Group Configuration I Initially Used
&lt;/h2&gt;

&lt;p&gt;When creating the EC2 instance, I allowed inbound traffic with rules similar to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SSH (port 22) → Source: 0.0.0.0/0&lt;/li&gt;
&lt;li&gt;HTTP (port 80) → Source: 0.0.0.0/0&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the time, this felt reasonable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I needed to access the instance&lt;/li&gt;
&lt;li&gt;I wanted to test connectivity&lt;/li&gt;
&lt;li&gt;AWS allowed it without warnings&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But what this actually meant was something much more serious.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Realised After Reviewing Security Groups
&lt;/h2&gt;

&lt;p&gt;Security groups are stateful virtual firewalls that control inbound and outbound traffic to EC2 instances.&lt;/p&gt;

&lt;p&gt;By allowing traffic from 0.0.0.0/0, I had effectively said:&lt;/p&gt;

&lt;p&gt;“Anyone on the internet can try to connect to my instance.”&lt;/p&gt;

&lt;p&gt;This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automated scanners&lt;/li&gt;
&lt;li&gt;Bots probing open ports&lt;/li&gt;
&lt;li&gt;Malicious actors looking for misconfigured systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The EC2 instance itself hadn’t changed — but my understanding had.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Key Mistakes I Made
&lt;/h2&gt;

&lt;p&gt;Looking back, there were three main issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Overly permissive inbound rules
&lt;/h2&gt;

&lt;p&gt;Allowing SSH from anywhere is one of the most common beginner mistakes.&lt;br&gt;
Even if no one attacks you immediately, the risk is always present.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Treating security groups as a setup form
&lt;/h2&gt;

&lt;p&gt;I treated the security group configuration as a checkbox exercise instead of a security boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. No principle of least privilege
&lt;/h2&gt;

&lt;p&gt;I allowed more access than was actually needed — simply for convenience.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Changed to Secure My EC2 Instance
&lt;/h2&gt;

&lt;p&gt;Once I understood the implications, I reworked the configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Restricted SSH access
&lt;/h2&gt;

&lt;p&gt;SSH allowed only from my specific IP address&lt;/p&gt;

&lt;p&gt;No global access&lt;/p&gt;

&lt;h2&gt;
  
  
  Reviewed inbound rules carefully
&lt;/h2&gt;

&lt;p&gt;Only necessary ports were open&lt;/p&gt;

&lt;p&gt;Removed unused or temporary rules&lt;/p&gt;

&lt;h2&gt;
  
  
  Treated security groups as living controls
&lt;/h2&gt;

&lt;p&gt;Regularly reviewed instead of “set and forget”&lt;/p&gt;

&lt;p&gt;Adjusted rules based on actual usage&lt;/p&gt;

&lt;p&gt;These changes immediately reduced the exposure of the instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bigger Lesson: AWS Doesn’t Secure Things For You
&lt;/h2&gt;

&lt;p&gt;One important realisation I had is this:&lt;/p&gt;

&lt;p&gt;AWS provides the tools — you are responsible for how securely you use them.&lt;/p&gt;

&lt;p&gt;EC2 is powerful, but it assumes the user understands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Networking basics&lt;/li&gt;
&lt;li&gt;Access control&lt;/li&gt;
&lt;li&gt;Exposure risks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security groups are not advanced features — they are foundational.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who This Matters For
&lt;/h2&gt;

&lt;p&gt;This lesson is especially important if you are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;New to AWS&lt;/li&gt;
&lt;li&gt;Learning cloud through hands-on projects&lt;/li&gt;
&lt;li&gt;Deploying EC2 for the first time&lt;/li&gt;
&lt;li&gt;Preparing for real-world cloud roles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding security groups early will save you from bigger problems later.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I’ll Improve Next
&lt;/h2&gt;

&lt;p&gt;This experience pushed me to think beyond basic setup:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using bastion hosts instead of direct SSH&lt;/li&gt;
&lt;li&gt;Automating security checks&lt;/li&gt;
&lt;li&gt;Adding monitoring and logging&lt;/li&gt;
&lt;li&gt;Designing architectures that reduce public exposure entirely&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security is not a one-time task — it’s an ongoing practice.&lt;/p&gt;

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

&lt;p&gt;My EC2 instance wasn’t insecure because AWS failed.&lt;br&gt;
It was insecure because I hadn’t fully understood what I was allowing.&lt;/p&gt;

&lt;p&gt;Checking your security groups takes minutes — but it can prevent serious issues.&lt;/p&gt;

&lt;p&gt;If you’re learning AWS, start there.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>devops</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
