Skip to content

emka.web.id

writing knowledge, recording civilization

Menu
  • Home
  • Tutorial
  • Search
Menu

Why Your Private Subnet is Offline: The DevOps Interview Breakdown

Posted on December 4, 2026

You are sitting in a DevOps interview, and the interviewer throws a classic curveball: “I have a server in a private subnet, but it can’t reach the internet to download a security patch. What’s wrong, and how do you fix it?”

Most junior candidates will immediately blurt out, “Just add an Internet Gateway!” But that is a rookie mistake that reveals a fundamental misunderstanding of VPC architecture. If you add an Internet Gateway (IGW) directly to a private subnet, you have just turned it into a public subnet, effectively stripping away the security layers that justified its existence in the first place.

This scenario, highlighted in a recent DevOps Shack technical session, is a litmus test for understanding the “plumbing” of AWS networking. Here is how you actually solve it like a Senior Engineer.

The Anatomy of Isolation

To understand why the private subnet is “blind” to the outside world, you have to look at the Route Table. In the AWS ecosystem, a subnet is defined as “private” not by a checkbox in the UI, but by the absence of a route to an Internet Gateway.

A standard private subnet typically contains resources like databases (RDS) or backend application servers (EC2) that should never be reachable from the public internet. However, these resources still need to “call home” for updates, OS patches, or to hit external APIs. Since they lack a Public IP and a direct path to the IGW, their packets have nowhere to go when they try to leave the VPC.

The Standard Fix: The NAT Gateway

The industry-standard solution is the NAT Gateway (Network Address Translation). The mechanism is simple but the implementation details are where people stumble.

First, you cannot put a NAT Gateway inside the private subnet itself. It would be just as isolated as the server you are trying to fix. You must place the NAT Gateway in a Public Subnet. This public subnet already has a Route Table entry pointing to the Internet Gateway (0.0.0.0/0 -> igw-xxxxxx).

Once the NAT Gateway is deployed, you perform a two-step configuration:

  1. Allocate an Elastic IP: The NAT Gateway requires a static, public IP address to communicate with the internet.
  2. Update the Private Route Table: You must go to the route table associated with your private subnet and add a route for 0.0.0.0/0 (all outbound traffic) with the target set to the NAT Gateway ID (nat-xxxxxx).

Now, when your private EC2 instance sends a request, the VPC router sees the 0.0.0.0/0 rule, sends the packet to the NAT Gateway in the public subnet, which then “translates” the private IP to its own public Elastic IP and forwards it to the internet via the IGW.

The “Managed Tax” and Technical Trade-offs

While the NAT Gateway is the “correct” answer for 90% of interview questions, a seasoned practitioner knows it comes with a “managed tax.” AWS charges roughly $0.045 per hour just for the privilege of having the gateway exist, plus another $0.045 per GB of data processed. For high-throughput environments, this can quietly become the most expensive line item on your bill.

NAT Gateway vs. NAT Instance
Before 2015, we used NAT Instances regular EC2 instances running Linux and configured with IP masquerading. They are significantly cheaper because you only pay for the EC2 runtime. However, they are a massive operational burden. If that one EC2 instance crashes, your entire private network loses internet access. NAT Gateways, by contrast, are managed by AWS, scale automatically up to 100 Gbps, and offer built-in redundancy within an Availability Zone.

The Multi-AZ Trap
A common architectural flaw is deploying one NAT Gateway for a multi-AZ VPC. If that one Availability Zone goes down, your private subnets in other zones also lose internet connectivity. In production, you should ideally have one NAT Gateway per Availability Zone to ensure zone-independent architecture.

The Smarter Alternative: VPC Endpoints

If your private server only needs to reach other AWS services like S3 for storage or DynamoDB for data using a NAT Gateway is actually poor design. It forces your data to travel over the public internet only to come back into the AWS network.

Instead, use VPC Endpoints.

  • Gateway Endpoints: These are free and work for S3 and DynamoDB. They update your route table to keep traffic entirely on the AWS private backbone.
  • Interface Endpoints (PrivateLink): These cost a small hourly fee but provide a private IP inside your subnet for services like Secrets Manager, Kinesis, or even third-party SaaS apps.

Final Troubleshooting Checklist

If you have added the NAT Gateway and updated the route table, but it still isn’t working, check these three “silent killers”:

  • Security Group Egress: Does the instance’s Security Group allow outbound traffic on port 80/443?
  • NACLs (Network Access Control Lists): Since NACLs are stateless, did you remember to allow the “return” traffic on ephemeral ports?
  • Source/Destination Check: If you are using an old-school NAT Instance instead of a NAT Gateway, you must disable the “Source/Destination Check” attribute on the EC2 instance, or it will drop any packet that doesn’t originate from its own IP.

In an interview, the “NAT Gateway in a public subnet” answer gets you the job. But mentioning cost optimization via VPC Endpoints and HA strategies via Multi-AZ NAT deployment is what gets you the “Senior” title.

Terbaru

  • Why Your Private Subnet is Offline: The DevOps Interview Breakdown
  • The Laravel-ification of Everything: Why Go and Rust are Racing to Steal PHP’s Crown
  • Why Redis is actually fast
  • The Fake 2FA Scandals and Fake AI Apps on Microsoft Store
  • Stop Overengineering Your Infrastructure: Docker Compose vs Kubernetes Resources
  • Traefik 3.8 New Feature: Yaegi v2 and the Gateway API Finally Make Custom Plugins Worth the Effort
  • Raspberry Pi OS: Why the November Update is a Win for Minimalism
  • React Can useState Hook Explained in 60 Seconds
  • How Do You Build an MMO Solo?
  • NixOS 26.11 “Zokor” Might Be the Most Practical Release for Desktop Power Users Yet
  • Why Your AWS Bill Can Just Tripled Overnight?
  • Why Indonesia’s Battle with Google is a Dangerous Game of Chicken
  • SYS010 Malware Explained: How Malvertising on Meta Bypasses MFA and Hijacks Your Digital Identity
  • Linux Mint 27 Adrien: Why This Version Jump is Make Sense?
  • NFS2ROOT: A 12-Year Reminder That Your Linux Kernel Is Never Truly Safe
  • The Death of Browsing and the Rise of the “Answer Engine Economy”
  • What’s new in Proxmox VE 9.3?
  • Why Your Morning Routine Needs an API: The Art of iOS Automation
  • Proof of Work is the New Certification: 5 AWS Projects to Build Before 2027
  • Omarchy is Our first agentic operating system
  • The Death of Popper.js: Why CSS Anchor Positioning is the New Standard for Connected UI
  • Why Your 2027 Cloud Career Depends on Moving Beyond Basic AWS Services
  • Why Discord is Ditching Electron for Rust: Is GPUi Actually the Future?
  • The End of the KDE Era: Why KaOS 2026.11 Is a Bold, Dangerous Gamble
  • The $2 Billion Code: Why GTA 6 is a Technical Miracle and a Hardware Nightmare
  • LibreDB Studio Explained
  • PHP 8.6 Is Officially Out: What’s New, What Breaks, and How We’re Upgrading
  • Rewriting Legacy Apps: 4 Data Migration Strategies That Actually Work
  • How to Install Clean Windows 11 Without Any Bloatware (Step-by-Step Guide)
  • IP Address Rate Limiting is Flawed—Here is the Right Way to Do It
  • Canonical: Ubuntu coming soon to Snapdragon X2 Series platforms
  • Finally, wolfSSL adds post-quantum algorithms!
  • How to Run Gemma Embedding Models Using Docker
  • Deploy Nginx Rootful Container with Podman
  • How to Sandboxing Browser on Linux Desktop with Flatpak
  • Digital Ghetto: People are hacking their own houses with Claude
  • How to Let ChatGPT Control Your Computer From Your Phone (Step-by-Step)
  • Ternary Bonsai 2.5 at 215 TPS! Splash + DFlash2 on Apple M5 Max
  • When to use an MCP server vs CLI with DevTools for agents
  • Your MCP Server Is a Search Result Now

©2026 emka.web.id | Design: Newspaperly WordPress Theme