<?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: Sri Balaji</title>
    <description>The latest articles on DEV Community by Sri Balaji (@sri2614).</description>
    <link>https://dev.to/sri2614</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F467906%2Fee67cb27-7e15-4293-b895-091047dc03fc.jpeg</url>
      <title>DEV Community: Sri Balaji</title>
      <link>https://dev.to/sri2614</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sri2614"/>
    <language>en</language>
    <item>
      <title>Policy as Code (OPA, Gatekeeper &amp; Kyverno)</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Mon, 09 Nov 2026 21:13:24 +0000</pubDate>
      <link>https://dev.to/sri2614/policy-as-code-opa-gatekeeper-kyverno-26i5</link>
      <guid>https://dev.to/sri2614/policy-as-code-opa-gatekeeper-kyverno-26i5</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Stop trusting code review to catch unsafe manifests. Encode guardrails as &lt;strong&gt;policy&lt;/strong&gt; with OPA, Gatekeeper, or Kyverno, then enforce them automatically both in CI and at cluster admission, preventive and detective.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Someone shipped a privileged container&lt;/li&gt;
&lt;li&gt;What policy as code actually means&lt;/li&gt;
&lt;li&gt;Where the engine sits&lt;/li&gt;
&lt;li&gt;OPA / Gatekeeper vs Kyverno&lt;/li&gt;
&lt;li&gt;A real policy: deny privileged pods&lt;/li&gt;
&lt;li&gt;Catch it in CI, not just at the cluster&lt;/li&gt;
&lt;li&gt;Preventive vs detective enforcement&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Someone shipped a privileged container
&lt;/h2&gt;

&lt;p&gt;On a Tuesday afternoon a developer needed their pod to mount a host path for a quick debug session. They added &lt;code&gt;securityContext: { privileged: true }&lt;/code&gt;, opened a PR, got a thumbs-up from a busy reviewer who skimmed the diff, and merged. The manifest sailed through CI. It deployed to production. Nobody caught it.&lt;/p&gt;

&lt;p&gt;A privileged container can escape to the host node. From there it can read other tenants' secrets, tamper with the kubelet, or pivot across the cluster. The control that was supposed to stop this, a human reading a YAML diff at 4pm, is the least reliable control you own. Reviewers get tired, files get long, and &lt;code&gt;privileged: true&lt;/code&gt; is one word buried in a 300-line manifest.&lt;/p&gt;

&lt;p&gt;The fix is not more discipline. It is &lt;strong&gt;policy as code&lt;/strong&gt;: write the rule once, and let a machine enforce it on every change, forever, without getting tired.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Platform, DevOps, and security engineers who own a shared Kubernetes cluster or an IaC pipeline and are tired of guardrails that live in a wiki page nobody reads. You should be comfortable with Kubernetes manifests and YAML; Rego is explained from scratch.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What policy as code actually means
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Policy as code is your security and compliance guardrails written as machine-readable rules, version-controlled, tested, and enforced automatically, so the rule is the gate, not a human's memory of the rule.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every team already has policies: "no privileged containers," "every workload must set resource limits," "images must come from our registry," "every resource needs a &lt;code&gt;cost-center&lt;/code&gt; label." The question is only &lt;em&gt;where those policies live&lt;/em&gt;. In most orgs they live in a Confluence page and in the heads of two senior engineers. Policy as code moves them into a Git repo and into an engine that checks them on every change.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A written building code (no exposed wiring, fire exits required)&lt;/td&gt;
&lt;td&gt;Your policy rules, version-controlled in Git&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An inspector who physically blocks unsafe work from continuing&lt;/td&gt;
&lt;td&gt;The policy engine that denies a non-compliant resource&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inspection at the permit desk, before a wall is ever built&lt;/td&gt;
&lt;td&gt;Preventive enforcement, admission control and CI gates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A walkthrough of finished buildings to flag violations after the fact&lt;/td&gt;
&lt;td&gt;Detective enforcement, audit scans of running resources&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Policy as code is an automated building inspector wired into the construction site itself.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The inspector never has a bad day, never skims, and applies the same code to the billionaire's tower and the corner shop. That consistency, not raw intelligence, is what makes the control trustworthy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the engine sits
&lt;/h2&gt;

&lt;p&gt;A policy engine intercepts a change &lt;em&gt;before&lt;/em&gt; it takes effect, evaluates it against your rules, and returns a single verdict: allow or deny. There are two natural places to put that gate, in your CI pipeline (before a manifest ever reaches the cluster) and at the Kubernetes admission stage (the last line of defense, catching anything that bypasses CI).&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0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I6I2JlZjI2NDsKICBjbGFzc0RlZiBleHRlcm5hbCBmaWxsOiMxYzE5MTcsc3Ryb2tlOiNhOGEyOWUsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojZTdlNWU0OwogIG5fYXV0aG9yKCJNYW5pZmVzdCAvIElhQzxici8-RGV2ZWxvcGVyIGNvbW1pdCIpCiAgY2xhc3Mgbl9hdXRob3IgY2xpZW50OwogIG5fY2koIkNJIEdhdGU8YnIvPmNvbmZ0ZXN0IC8ga3l2ZXJubyBDTEkiKQogIGNsYXNzIG5fY2kgY29tcHV0ZTsKICBuX2FwaSgiS3ViZSBBUEkgU2VydmVyPGJyLz5BZG1pc3Npb24gd2ViaG9vayIpCiAgY2xhc3Mgbl9hcGkgZWRnZTsKICBuX2VuZ2luZSgiUG9saWN5IEVuZ2luZTxici8-R2F0ZWtlZXBlciAvIEt5dmVybm8iKQogIGNsYXNzIG5fZW5naW5lIGNvbXB1dGU7CiAgbl9jbHVzdGVyKCJDbHVzdGVyPGJyLz5SZXNvdXJjZSBjcmVhdGVkIikKICBjbGFzcyBuX2NsdXN0ZXIgZGF0YTsKICBuX2RlbnkoIkRlbmllZDxici8-QnVpbGQgLyByZXF1ZXN0IGZhaWxzIikKICBjbGFzcyBuX2RlbnkgZXh0ZXJuYWw7CiAgbl9hdXRob3IgLS0-fCJwdXNoInwgbl9jaQogIG5fY2kgLS0-fCJhbGxvdyJ8IG5fYXBpCiAgbl9hcGkgLS4tPnwicmV2aWV3Inwgbl9lbmdpbmUKICBuX2VuZ2luZSAtLi0-fCJ2ZXJkaWN0Inwgbl9hcGkKICBuX2FwaSAtLT58ImFsbG93Inwgbl9jbHVzdGVyCiAgbl9lbmdpbmUgLS4tPnwidmlvbGF0aW9uInwgbl9kZW55%3FbgColor%3D0d1017%26type%3Dpng" 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%2F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jYzE2LHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2JlZjI2NDsKICBjbGFzc0RlZiBleHRlcm5hbCBmaWxsOiMxYzE5MTcsc3Ryb2tlOiNhOGEyOWUsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojZTdlNWU0OwogIG5fYXV0aG9yKCJNYW5pZmVzdCAvIElhQzxici8-RGV2ZWxvcGVyIGNvbW1pdCIpCiAgY2xhc3Mgbl9hdXRob3IgY2xpZW50OwogIG5fY2koIkNJIEdhdGU8YnIvPmNvbmZ0ZXN0IC8ga3l2ZXJubyBDTEkiKQogIGNsYXNzIG5fY2kgY29tcHV0ZTsKICBuX2FwaSgiS3ViZSBBUEkgU2VydmVyPGJyLz5BZG1pc3Npb24gd2ViaG9vayIpCiAgY2xhc3Mgbl9hcGkgZWRnZTsKICBuX2VuZ2luZSgiUG9saWN5IEVuZ2luZTxici8-R2F0ZWtlZXBlciAvIEt5dmVybm8iKQogIGNsYXNzIG5fZW5naW5lIGNvbXB1dGU7CiAgbl9jbHVzdGVyKCJDbHVzdGVyPGJyLz5SZXNvdXJjZSBjcmVhdGVkIikKICBjbGFzcyBuX2NsdXN0ZXIgZGF0YTsKICBuX2RlbnkoIkRlbmllZDxici8-QnVpbGQgLyByZXF1ZXN0IGZhaWxzIikKICBjbGFzcyBuX2RlbnkgZXh0ZXJuYWw7CiAgbl9hdXRob3IgLS0-fCJwdXNoInwgbl9jaQogIG5fY2kgLS0-fCJhbGxvdyJ8IG5fYXBpCiAgbl9hcGkgLS4tPnwicmV2aWV3Inwgbl9lbmdpbmUKICBuX2VuZ2luZSAtLi0-fCJ2ZXJkaWN0Inwgbl9hcGkKICBuX2FwaSAtLT58ImFsbG93Inwgbl9jbHVzdGVyCiAgbl9lbmdpbmUgLS4tPnwidmlvbGF0aW9uInwgbl9kZW55%3FbgColor%3D0d1017%26type%3Dpng" alt="A change flows through one or more policy gates; each returns allow or deny before the resource is created." width="1253" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A change flows through one or more policy gates; each returns allow or deny before the resource is created.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A change is authored&lt;/strong&gt;: A developer writes or edits a Kubernetes manifest or a Terraform plan and pushes it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI evaluates it first&lt;/strong&gt;: A pipeline step runs the policies against the rendered manifests. A violation fails the build, the change never merges. This is the fast feedback loop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The API server intercepts the apply&lt;/strong&gt;: If something reaches the cluster anyway (a kubectl from a laptop, a Helm install, a compromised pipeline), the admission webhook fires before the object is persisted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The engine returns a verdict&lt;/strong&gt;: The policy engine evaluates the request against every matching policy and answers allow or deny in milliseconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allow creates, deny blocks&lt;/strong&gt;: On allow, the resource is created. On deny, the user gets a clear message, &lt;code&gt;privileged containers are not allowed&lt;/code&gt;, and nothing is created.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  OPA / Gatekeeper vs Kyverno
&lt;/h2&gt;

&lt;p&gt;Two tools dominate Kubernetes policy enforcement, and the choice mostly comes down to one question: are you willing to learn a policy language? &lt;strong&gt;OPA&lt;/strong&gt; (Open Policy Agent) is a general-purpose policy engine that uses a language called &lt;strong&gt;Rego&lt;/strong&gt;; &lt;strong&gt;Gatekeeper&lt;/strong&gt; is the project that wires OPA into Kubernetes admission control. &lt;strong&gt;Kyverno&lt;/strong&gt; is Kubernetes-native and writes policies as plain YAML, no new language to learn.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;OPA / Gatekeeper&lt;/th&gt;
&lt;th&gt;Kyverno&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Policy language&lt;/td&gt;
&lt;td&gt;Rego (purpose-built logic language)&lt;/td&gt;
&lt;td&gt;YAML (Kubernetes-style resources)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kubernetes-native&lt;/td&gt;
&lt;td&gt;Runs in k8s, but OPA itself is platform-agnostic&lt;/td&gt;
&lt;td&gt;Built only for Kubernetes; speaks CRDs natively&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Beyond admission&lt;/td&gt;
&lt;td&gt;Validate, plus mutate &amp;amp; generate&lt;/td&gt;
&lt;td&gt;Validate, mutate, generate &amp;amp; image verification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reuse outside k8s&lt;/td&gt;
&lt;td&gt;Same Rego works for IaC, APIs, microservices&lt;/td&gt;
&lt;td&gt;Kubernetes only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learning curve&lt;/td&gt;
&lt;td&gt;Steeper, Rego takes practice&lt;/td&gt;
&lt;td&gt;Gentle, if you know manifests, you can write policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best when&lt;/td&gt;
&lt;td&gt;You want one engine for k8s + Terraform + app authz&lt;/td&gt;
&lt;td&gt;You want fast, readable, k8s-focused guardrails&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Pick OPA/Gatekeeper for cross-platform reach; pick Kyverno for a YAML-native, lower-friction start.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;A reasonable default:&lt;/strong&gt; If your scope is "guardrails for our Kubernetes clusters," start with Kyverno, the YAML policies are easier for the whole team to read and contribute to. Reach for OPA/Rego when you need the &lt;em&gt;same&lt;/em&gt; policy logic to also gate Terraform plans, CI, and application API authorization.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  A real policy: deny privileged pods
&lt;/h2&gt;

&lt;p&gt;Here is the rule that would have stopped our Tuesday incident, written as a Kyverno policy. It is just a Kubernetes resource, you &lt;code&gt;kubectl apply&lt;/code&gt; it like anything else, and from that moment every pod is checked.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;disallow-privileged.yaml&lt;/code&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="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kyverno.io/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;ClusterPolicy&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;disallow-privileged-containers&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;validationFailureAction&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Enforce&lt;/span&gt;   &lt;span class="c1"&gt;# Audit while testing, Enforce to block&lt;/span&gt;
  &lt;span class="na"&gt;background&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;                    &lt;span class="c1"&gt;# also scan existing resources&lt;/span&gt;
  &lt;span class="na"&gt;rules&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;privileged-containers&lt;/span&gt;
      &lt;span class="na"&gt;match&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;any&lt;/span&gt;&lt;span class="pi"&gt;:&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;kinds&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
      &lt;span class="na"&gt;validate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Privileged&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;containers&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;are&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;not&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;allowed."&lt;/span&gt;
        &lt;span class="na"&gt;pattern&lt;/span&gt;&lt;span class="pi"&gt;:&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;=(securityContext)&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;=(privileged)&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;false"&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;=(securityContext)&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
                  &lt;span class="na"&gt;=(privileged)&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;false"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same intent in &lt;strong&gt;Rego&lt;/strong&gt; (for OPA/Gatekeeper) reads as logic rather than a pattern. A &lt;code&gt;violation&lt;/code&gt; is produced for any container that asks for privilege:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;privileged.rego&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rego"&gt;&lt;code&gt;&lt;span class="ow"&gt;package&lt;/span&gt; &lt;span class="n"&gt;kubernetes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;admission&lt;/span&gt;

&lt;span class="n"&gt;violation&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="s2"&gt;"msg"&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;container&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;containers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="n"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;securityContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;privileged&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"container %v runs privileged; not allowed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;container&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same shape covers the boring-but-critical rules too. Requiring a &lt;code&gt;cost-center&lt;/code&gt; label is a Kyverno &lt;code&gt;validate&lt;/code&gt; that asserts the key exists under &lt;code&gt;metadata.labels&lt;/code&gt;, a two-line change that makes every untagged resource impossible to create.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Test your policies like code:&lt;/strong&gt; Both ecosystems have test runners, &lt;code&gt;kyverno test&lt;/code&gt; and &lt;code&gt;opa test&lt;/code&gt;, that take a policy plus example resources and assert which pass and which fail. A policy with no tests is a guess. Commit the policy and its test fixtures together.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Catch it in CI, not just at the cluster
&lt;/h2&gt;

&lt;p&gt;Admission control is your safety net, but the &lt;em&gt;fastest&lt;/em&gt; feedback is in CI, before a change is ever merged. Running the same policies against rendered manifests in the pipeline means a developer sees &lt;code&gt;privileged containers are not allowed&lt;/code&gt; in their PR check, not after a failed deploy. Same rule, earlier gate.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.github/workflows/policy.yml&lt;/code&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="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;policy-check&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;validate&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&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;Render manifests&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;helm template ./chart &amp;gt; /tmp/rendered.yaml&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;Run Kyverno policies&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;kyverno apply ./policies/ \&lt;/span&gt;
            &lt;span class="s"&gt;--resource /tmp/rendered.yaml \&lt;/span&gt;
            &lt;span class="s"&gt;--audit-warn=false   # nonzero exit on any failure&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same idea applies to infrastructure. With &lt;strong&gt;OPA/conftest&lt;/strong&gt; you can gate a Terraform plan: render &lt;code&gt;terraform show -json plan.out&lt;/code&gt; and let Rego deny, say, an S3 bucket without encryption or a security group open to &lt;code&gt;0.0.0.0/0&lt;/code&gt;. Bad infrastructure-as-code never reaches &lt;code&gt;apply&lt;/code&gt;. This is exactly the kind of drift that a &lt;a href="https://thesimplifiedtech.com/blog/cloud-security-posture-management-cspm" rel="noopener noreferrer"&gt;Cloud Security Posture Management (CSPM)&lt;/a&gt; tool would otherwise find &lt;em&gt;after&lt;/em&gt; it is already running and exposed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preventive vs detective enforcement
&lt;/h2&gt;

&lt;p&gt;Every control is one of two kinds, and you need both. &lt;strong&gt;Preventive&lt;/strong&gt; controls stop the bad thing from ever happening, a CI gate that fails the build, an admission webhook that denies the request. &lt;strong&gt;Detective&lt;/strong&gt; controls find the bad thing that already happened, a background scan that flags running pods which violate a policy you added later.&lt;/p&gt;

&lt;p&gt;Preventive is stronger but stricter: if your policy is wrong, you block legitimate work and people route around you. Detective is safer to roll out but reactive: by the time it alerts, the privileged container has been running for an hour. The mature pattern is to &lt;strong&gt;start detective, then graduate to preventive&lt;/strong&gt;. Deploy a policy in audit mode, watch what it &lt;em&gt;would&lt;/em&gt; have blocked for a week, fix the false positives, then flip it to enforce. In Kyverno that is one field: &lt;code&gt;validationFailureAction: Audit&lt;/code&gt; becomes &lt;code&gt;Enforce&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Audit is a phase, not a destination:&lt;/strong&gt; A policy stuck in audit mode forever is theater, it generates reports nobody reads while violations keep shipping. Audit exists to build confidence so you can safely turn enforcement on. If a policy has been in audit for months, either enforce it or delete it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Audit-only forever.&lt;/strong&gt; Teams deploy in audit mode "to be safe" and never flip to enforce. The guardrail looks present but blocks nothing, the privileged container still ships. Set a date to enforce when you deploy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No policy tests.&lt;/strong&gt; A policy is code; untested code lies. Without &lt;code&gt;kyverno test&lt;/code&gt; / &lt;code&gt;opa test&lt;/code&gt; fixtures you ship a regex that matches nothing, or a Rego rule that blocks every pod. Commit tests with the policy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Over-strict blocking on day one.&lt;/strong&gt; Turning on twenty enforce-mode policies at once breaks deploys org-wide and burns your credibility in an afternoon. Roll out one policy at a time, audit first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No exception path.&lt;/strong&gt; Real systems have legitimate edge cases. If the only way past a policy is to disable it, people disable it. Build a scoped, reviewed exception mechanism (a namespace label, an annotation) so the policy survives contact with reality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vague denial messages.&lt;/strong&gt; &lt;code&gt;validation error: pattern mismatch&lt;/code&gt; tells a developer nothing. A good &lt;code&gt;message&lt;/code&gt; names the rule and the fix: &lt;code&gt;privileged containers are not allowed; remove securityContext.privileged&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI-only or admission-only.&lt;/strong&gt; CI alone misses anything applied outside the pipeline; admission alone gives slow feedback. Run the same policies in both places.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Policy as code turns guardrails into version-controlled, tested rules an engine enforces automatically.&lt;/li&gt;
&lt;li&gt;A policy engine intercepts a change and returns one verdict: allow or deny.&lt;/li&gt;
&lt;li&gt;Gate in two places: CI for fast feedback, admission control as the last line of defense.&lt;/li&gt;
&lt;li&gt;OPA/Gatekeeper uses Rego and reaches beyond Kubernetes; Kyverno uses YAML and is Kubernetes-native.&lt;/li&gt;
&lt;li&gt;Preventive controls block before; detective controls find after, start detective, graduate to preventive.&lt;/li&gt;
&lt;li&gt;Test every policy with example resources, and ship clear denial messages.&lt;/li&gt;
&lt;li&gt;Avoid audit-only-forever, untested policies, and over-strict day-one blocking.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Policy as code is most powerful once you understand the cluster it is guarding and the broader security posture it fits into. Build the foundation, then add the guardrails.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get hands-on with the API server and admission flow in the &lt;a href="https://thesimplifiedtech.com/labs/kubectl" rel="noopener noreferrer"&gt;kubectl lab&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;See how these guardrails fit a real cluster in &lt;a href="https://thesimplifiedtech.com/blog/kubernetes-in-production" rel="noopener noreferrer"&gt;Kubernetes in Production: Beyond the Tutorial&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Pair preventive policy with detective scanning in &lt;a href="https://thesimplifiedtech.com/blog/cloud-security-posture-management-cspm" rel="noopener noreferrer"&gt;Cloud Security Posture Management (CSPM)&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Put it all together on the &lt;a href="https://thesimplifiedtech.com/career-paths/devops-engineer" rel="noopener noreferrer"&gt;DevOps Engineer career path&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/policy-as-code-opa-kyverno" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>docker</category>
      <category>security</category>
    </item>
    <item>
      <title>Helm &amp; Kustomize: Packaging Kubernetes Manifests</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Sun, 08 Nov 2026 16:52:32 +0000</pubDate>
      <link>https://dev.to/sri2614/helm-kustomize-packaging-kubernetes-manifests-1d75</link>
      <guid>https://dev.to/sri2614/helm-kustomize-packaging-kubernetes-manifests-1d75</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Choose between Helm's templated charts and Kustomize's overlays to tame Kubernetes YAML across environments. You will know which fits your case and how both slot cleanly into a GitOps workflow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The copy-paste tax&lt;/li&gt;
&lt;li&gt;Templates vs patches&lt;/li&gt;
&lt;li&gt;The picture&lt;/li&gt;
&lt;li&gt;Helm vs Kustomize: a head-to-head&lt;/li&gt;
&lt;li&gt;The same app, both ways&lt;/li&gt;
&lt;li&gt;How they fit GitOps&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The copy-paste tax
&lt;/h2&gt;

&lt;p&gt;You write a clean Kubernetes Deployment. It works. Then someone says "we need it in staging too," so you copy the YAML into a new folder and change the image tag, the replica count, and the host in the Ingress. Then prod arrives, and you copy it again, three replicas this time, a different resource limit, a real TLS secret. Now you have three near-identical copies of the same manifest, and the only honest description of the difference between them lives in your head.&lt;/p&gt;

&lt;p&gt;Three months later someone adds a new environment variable to the dev copy and forgets the other two. Prod drifts. A debugging session that should take ten minutes takes an afternoon because nobody can tell which version is the source of truth. This is the &lt;strong&gt;copy-paste tax&lt;/strong&gt;, and every team that runs Kubernetes pays it until they pick a packaging tool.&lt;/p&gt;

&lt;p&gt;The two dominant answers are &lt;strong&gt;Helm&lt;/strong&gt; and &lt;strong&gt;Kustomize&lt;/strong&gt;. They solve the same problem, one set of manifests, many environments, in opposite ways. This article shows how each works, gives you a small example of both, and helps you decide which one (or both) belongs in your stack.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Engineers who already write Kubernetes manifests by hand and feel the pain of maintaining one set of YAML across dev, staging, and prod. If &lt;code&gt;kubectl apply -f&lt;/code&gt; and a Deployment are familiar, you're ready. New to running clusters? Start with &lt;a href="https://thesimplifiedtech.com/blog/kubernetes-in-production" rel="noopener noreferrer"&gt;Kubernetes in Production: Beyond the Tutorial&lt;/a&gt; first.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Templates vs patches
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Helm parameterizes your manifests with a templating language; Kustomize layers plain-YAML patches on top of plain-YAML bases. Same destination, two philosophies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The cleanest way to feel the difference is an analogy. Think about how you'd produce three versions of a printed letter.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A mail-merge letter with {{name}} blanks you fill from a spreadsheet&lt;/td&gt;
&lt;td&gt;A Helm chart with {{ .Values.x }} placeholders filled from values.yaml&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A printed master letter with sticky-note corrections clipped on top&lt;/td&gt;
&lt;td&gt;A Kustomize base manifest with overlay patches applied per environment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The spreadsheet of names and addresses&lt;/td&gt;
&lt;td&gt;Each environment's values file (dev / staging / prod)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A bundle of letters mailed under one tracking number&lt;/td&gt;
&lt;td&gt;A Helm release, a named, versioned, rollback-able install&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Helm fills in blanks; Kustomize edits a finished document.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Helm treats your YAML as a &lt;strong&gt;template&lt;/strong&gt;, the chart isn't valid Kubernetes YAML on its own, it's a program that &lt;em&gt;renders into&lt;/em&gt; YAML. Kustomize treats your YAML as &lt;strong&gt;data&lt;/strong&gt;, every file is a real, applyable manifest, and overlays just describe the diffs. That single distinction drives almost every trade-off below.&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture
&lt;/h2&gt;

&lt;p&gt;Both tools sit between your source manifests and the cluster. You author once, then a per-environment input produces per-environment output, which finally lands in a namespace. Here is the shape of it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTc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B1dGU7CiAgbl9rdXN0b21pemUoIkt1c3RvbWl6ZTxici8-b3ZlcmxheXMgLyBwYXRjaGVzIikKICBjbGFzcyBuX2t1c3RvbWl6ZSBjb21wdXRlOwogIG5fcmVuZGVyKCJQZXItZW52IG91dHB1dDxici8-cmVuZGVyZWQgWUFNTCIpCiAgY2xhc3Mgbl9yZW5kZXIgZWRnZTsKICBuX2NsdXN0ZXIoIkNsdXN0ZXI8YnIvPmRldiAvIHN0YWdlIC8gcHJvZCBucyIpCiAgY2xhc3Mgbl9jbHVzdGVyIGNsaWVudDsKICBuX2Jhc2UgLS0-fCJ0ZW1wbGF0ZWQifCBuX2hlbG0KICBuX2Jhc2UgLS4tPnwicGF0Y2hlZCJ8IG5fa3VzdG9taXplCiAgbl9oZWxtIC0tPnwiaGVsbSB0ZW1wbGF0ZSJ8IG5fcmVuZGVyCiAgbl9rdXN0b21pemUgLS4tPnwia3VzdG9taXplIGJ1aWxkInwgbl9yZW5kZXIKICBuX3JlbmRlciAtLT58ImFwcGx5Inwgbl9jbHVzdGVy%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZl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RvbWl6ZTxici8-b3ZlcmxheXMgLyBwYXRjaGVzIikKICBjbGFzcyBuX2t1c3RvbWl6ZSBjb21wdXRlOwogIG5fcmVuZGVyKCJQZXItZW52IG91dHB1dDxici8-cmVuZGVyZWQgWUFNTCIpCiAgY2xhc3Mgbl9yZW5kZXIgZWRnZTsKICBuX2NsdXN0ZXIoIkNsdXN0ZXI8YnIvPmRldiAvIHN0YWdlIC8gcHJvZCBucyIpCiAgY2xhc3Mgbl9jbHVzdGVyIGNsaWVudDsKICBuX2Jhc2UgLS0-fCJ0ZW1wbGF0ZWQifCBuX2hlbG0KICBuX2Jhc2UgLS4tPnwicGF0Y2hlZCJ8IG5fa3VzdG9taXplCiAgbl9oZWxtIC0tPnwiaGVsbSB0ZW1wbGF0ZSJ8IG5fcmVuZGVyCiAgbl9rdXN0b21pemUgLS4tPnwia3VzdG9taXplIGJ1aWxkInwgbl9yZW5kZXIKICBuX3JlbmRlciAtLT58ImFwcGx5Inwgbl9jbHVzdGVy%3FbgColor%3D0d1017%26type%3Dpng" alt="Base manifests flow through Helm values OR Kustomize overlays into per-env output, then to the cluster." width="1053" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Base manifests flow through Helm values OR Kustomize overlays into per-env output, then to the cluster.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Author the base once&lt;/strong&gt;: Write the Deployment, Service, and Ingress with sensible defaults. This is the single source of truth that every environment shares.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Describe what differs per environment&lt;/strong&gt;: With Helm, that's a values file per env. With Kustomize, that's an overlay folder with a kustomization.yaml and small patches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render the final YAML&lt;/strong&gt;: &lt;code&gt;helm template&lt;/code&gt; or &lt;code&gt;kustomize build&lt;/code&gt; turns base + env-input into concrete, fully-resolved manifests. No placeholders left.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apply to the matching namespace&lt;/strong&gt;: The rendered output goes to the cluster, either directly via the CLI, or (better) committed to Git and reconciled by a GitOps controller.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Helm vs Kustomize: a head-to-head
&lt;/h2&gt;

&lt;p&gt;The two tools overlap in purpose but diverge in mechanics. The table is the fast way to internalize the trade-offs before we look at code.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Helm&lt;/th&gt;
&lt;th&gt;Kustomize&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Templating&lt;/td&gt;
&lt;td&gt;Yes, Go templates with {{ }}, conditionals, loops, functions&lt;/td&gt;
&lt;td&gt;No, plain YAML only, diffs via strategic-merge &amp;amp; JSON patches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Releases&lt;/td&gt;
&lt;td&gt;First-class: named, versioned installs you can roll back with one command&lt;/td&gt;
&lt;td&gt;None, it just emits YAML; lifecycle is whatever applies it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Packaging &amp;amp; sharing&lt;/td&gt;
&lt;td&gt;Charts are versioned, published to registries, installed by anyone&lt;/td&gt;
&lt;td&gt;No package format; you copy/fork or reference a remote base by URL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learning curve&lt;/td&gt;
&lt;td&gt;Steeper, a template language, values precedence, chart structure&lt;/td&gt;
&lt;td&gt;Gentle, if you know YAML and diffs, you mostly already know it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tooling&lt;/td&gt;
&lt;td&gt;Standalone binary; rich ecosystem (Artifact Hub, hooks, tests)&lt;/td&gt;
&lt;td&gt;Built into kubectl (&lt;code&gt;kubectl apply -k&lt;/code&gt;) plus the standalone CLI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;When to use&lt;/td&gt;
&lt;td&gt;Distributing reusable apps; lots of env knobs; need rollback&lt;/td&gt;
&lt;td&gt;Your own apps; small, readable per-env diffs; want zero magic&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Same goal, different machinery.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The same app, both ways
&lt;/h2&gt;

&lt;p&gt;Imagine a small web app with a Deployment. Below is the Helm side, a values snippet that prod would supply to override the chart defaults. Notice the values file is &lt;em&gt;not&lt;/em&gt; Kubernetes YAML; it's the data that fills the chart's &lt;code&gt;{{ .Values.* }}&lt;/code&gt; placeholders.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;values-prod.yaml (Helm)&lt;/code&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;# Overrides the chart defaults for production.&lt;/span&gt;
&lt;span class="c1"&gt;# The chart's templates read these via {{ .Values.* }}.&lt;/span&gt;
&lt;span class="na"&gt;replicaCount&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;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;repository&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;registry.example.com/web&lt;/span&gt;
  &lt;span class="na"&gt;tag&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.8.0"&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;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;250m&lt;/span&gt;
    &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;256Mi&lt;/span&gt;
  &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1"&lt;/span&gt;
    &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;512Mi&lt;/span&gt;

&lt;span class="na"&gt;ingress&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;host&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app.example.com&lt;/span&gt;
  &lt;span class="na"&gt;tls&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;span class="c1"&gt;# Install with:&lt;/span&gt;
&lt;span class="c1"&gt;#   helm upgrade --install web ./web-chart -f values-prod.yaml&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the Kustomize side. The base is real, applyable YAML; the prod overlay is a tiny &lt;code&gt;kustomization.yaml&lt;/code&gt; plus a patch that changes only what differs. No placeholders anywhere, every file would &lt;code&gt;kubectl apply&lt;/code&gt; on its own.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;overlays/prod/kustomization.yaml (Kustomize)&lt;/code&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;# overlays/prod/kustomization.yaml&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;kustomize.config.k8s.io/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;Kustomization&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;prod&lt;/span&gt;
&lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;../../base&lt;/span&gt;          &lt;span class="c1"&gt;# the shared, real manifests&lt;/span&gt;

&lt;span class="na"&gt;images&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;registry.example.com/web&lt;/span&gt;
    &lt;span class="na"&gt;newTag&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1.8.0"&lt;/span&gt;     &lt;span class="c1"&gt;# bump the tag without editing the base&lt;/span&gt;

&lt;span class="na"&gt;replicas&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;web&lt;/span&gt;
    &lt;span class="na"&gt;count&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;patches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;patch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|-&lt;/span&gt;
      &lt;span class="s"&gt;- op: replace&lt;/span&gt;
        &lt;span class="s"&gt;path: /spec/template/spec/containers/0/resources/limits/memory&lt;/span&gt;
        &lt;span class="s"&gt;value: 512Mi&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;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&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;web&lt;/span&gt;

&lt;span class="c1"&gt;# Render with:&lt;/span&gt;
&lt;span class="c1"&gt;#   kubectl kustomize overlays/prod   (or: kustomize build overlays/prod)&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Try it in the browser:&lt;/strong&gt; Practice both flows hands-on in the &lt;a href="https://thesimplifiedtech.com/labs/helm" rel="noopener noreferrer"&gt;Helm lab&lt;/a&gt; and the &lt;a href="https://thesimplifiedtech.com/labs/kubectl" rel="noopener noreferrer"&gt;kubectl lab&lt;/a&gt;, render, diff, and apply without touching a real cluster.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How they fit GitOps
&lt;/h2&gt;

&lt;p&gt;Neither tool is a deployment system, they both just &lt;em&gt;produce YAML&lt;/em&gt;. That makes them a perfect fit for &lt;strong&gt;GitOps&lt;/strong&gt;, where Git is the source of truth and a controller continuously reconciles the cluster to match. You commit the chart-plus-values or the base-plus-overlays, and the controller renders and applies them for you.&lt;/p&gt;

&lt;p&gt;Both &lt;a href="https://thesimplifiedtech.com/blog/gitops-argocd-flux" rel="noopener noreferrer"&gt;ArgoCD and Flux&lt;/a&gt; speak Helm and Kustomize natively. Point Argo at a chart and a values file, or at an overlay folder, and it runs &lt;code&gt;helm template&lt;/code&gt; / &lt;code&gt;kustomize build&lt;/code&gt; under the hood, diffs the result against live state, and self-heals drift. The win: humans never run &lt;code&gt;helm install&lt;/code&gt; or &lt;code&gt;kubectl apply&lt;/code&gt; against prod, they open a pull request, and the merge &lt;em&gt;is&lt;/em&gt; the deploy.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Render in the pipeline, not the cluster&lt;/strong&gt;, let the GitOps controller own &lt;code&gt;helm template&lt;/code&gt; / &lt;code&gt;kustomize build&lt;/code&gt; so what's in Git is exactly what runs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One repo, many overlays&lt;/strong&gt;, keep &lt;code&gt;base/&lt;/code&gt; plus &lt;code&gt;overlays/dev|stage|prod&lt;/code&gt; (or one chart with per-env values) so a diff between environments is a real, reviewable diff.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin versions in Git&lt;/strong&gt;, image tags and chart versions live in committed files, so every change has an author, a timestamp, and a one-click revert.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Over-templating Helm charts.&lt;/strong&gt; Exposing forty knobs in &lt;code&gt;values.yaml&lt;/code&gt; for an app three teams use makes the chart unreadable and every upgrade scary. Template only what genuinely varies; hardcode the rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Putting logic in templates.&lt;/strong&gt; Nested &lt;code&gt;{{ if }}&lt;/code&gt;/&lt;code&gt;{{ range }}&lt;/code&gt; blocks turn a manifest into a program nobody can debug. When you find yourself writing conditionals around conditionals, the answer is usually a second values file, or Kustomize.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Letting environments drift.&lt;/strong&gt; Hand-editing live resources with &lt;code&gt;kubectl edit&lt;/code&gt;, or applying an overlay manually "just this once," silently desyncs the cluster from Git. Render from source every time and let GitOps catch drift.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting Kustomize has no rollback.&lt;/strong&gt; It emits YAML and walks away. If you need versioned releases and &lt;code&gt;helm rollback&lt;/code&gt;, that lifecycle is on you (or on your GitOps controller via Git history), don't assume the tool provides it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mixing both without a reason.&lt;/strong&gt; Helm-inside-Kustomize and Kustomize-post-rendering-Helm are valid but advanced. Pick one as your default and only reach for the combo when a concrete need forces it.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in six lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintaining one set of manifests across environments by copy-paste guarantees drift, pick a packaging tool.&lt;/li&gt;
&lt;li&gt;Helm = templates: charts with {{ }} placeholders filled by per-env values, plus versioned, rollback-able releases.&lt;/li&gt;
&lt;li&gt;Kustomize = patches: a real-YAML base with small per-env overlays, no templating, built into kubectl.&lt;/li&gt;
&lt;li&gt;Choose Helm to distribute reusable apps with many knobs and rollback; choose Kustomize for your own apps with small, readable diffs.&lt;/li&gt;
&lt;li&gt;Both just render YAML, which makes them a natural fit for GitOps with ArgoCD or Flux.&lt;/li&gt;
&lt;li&gt;Avoid over-templating, logic in templates, and silent drift, render from source every time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Packaging is one piece of running Kubernetes well. Pair it with the operational and delivery practices around it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read &lt;a href="https://thesimplifiedtech.com/blog/kubernetes-in-production" rel="noopener noreferrer"&gt;Kubernetes in Production: Beyond the Tutorial&lt;/a&gt; for the reliability concerns your manifests need to encode.&lt;/li&gt;
&lt;li&gt;Read &lt;a href="https://thesimplifiedtech.com/blog/gitops-argocd-flux" rel="noopener noreferrer"&gt;GitOps: Declarative Delivery with ArgoCD &amp;amp; Flux&lt;/a&gt; to see how rendered manifests get continuously reconciled.&lt;/li&gt;
&lt;li&gt;Practice in the &lt;a href="https://thesimplifiedtech.com/labs/helm" rel="noopener noreferrer"&gt;Helm lab&lt;/a&gt; and the &lt;a href="https://thesimplifiedtech.com/labs/kubectl" rel="noopener noreferrer"&gt;kubectl lab&lt;/a&gt;, author a chart, build an overlay, diff the output.&lt;/li&gt;
&lt;li&gt;Follow the full &lt;a href="https://thesimplifiedtech.com/career-paths/devops-engineer" rel="noopener noreferrer"&gt;DevOps Engineer path&lt;/a&gt; to put packaging, pipelines, and observability together.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/helm-and-kustomize" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>docker</category>
      <category>helm</category>
    </item>
    <item>
      <title>Container &amp; Image Security Scanning</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Sat, 07 Nov 2026 16:41:57 +0000</pubDate>
      <link>https://dev.to/sri2614/container-image-security-scanning-ln1</link>
      <guid>https://dev.to/sri2614/container-image-security-scanning-ln1</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Catch CVEs in base images and dependencies before they ship by scanning early and failing the build on HIGH or CRITICAL. Shrink the attack surface with distroless bases and add an admission gate at runtime.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The CVE you shipped without writing a line of code&lt;/li&gt;
&lt;li&gt;Shift left: find it where it's cheap to fix&lt;/li&gt;
&lt;li&gt;The picture: build, gate, deploy&lt;/li&gt;
&lt;li&gt;What to scan (it's more than OS packages)&lt;/li&gt;
&lt;li&gt;The gate: a CI step that fails on HIGH/CRITICAL&lt;/li&gt;
&lt;li&gt;Shrink the target: distroless &amp;amp; minimal bases&lt;/li&gt;
&lt;li&gt;One more gate: runtime &amp;amp; admission control&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The CVE you shipped without writing a line of code
&lt;/h2&gt;

&lt;p&gt;Friday afternoon. Your service is healthy, your tests are green, your code review was spotless. On Monday, security pages you: your production image contains a &lt;strong&gt;critical remote-code-execution CVE&lt;/strong&gt;. You didn't write the vulnerable code, it came in your base image, three layers down, in an OpenSSL build you never chose and never knew was there.&lt;/p&gt;

&lt;p&gt;This is the uncomfortable truth of containers: when you write &lt;code&gt;FROM node:20&lt;/code&gt;, you inherit an entire operating system, hundreds of OS packages, each with its own vulnerability history. Add your &lt;code&gt;npm install&lt;/code&gt; and you pull in a tree of transitive dependencies that no human has read. The average image ships with &lt;strong&gt;dozens of known CVEs&lt;/strong&gt; before your code even runs. The fix isn't heroics at 2 a.m. It's moving the check to the left, scanning every image, on every build, and refusing to ship the broken ones.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Junior-to-mid engineers who build and ship Docker images and want a CI pipeline that &lt;em&gt;stops&lt;/em&gt; vulnerable images from reaching production. You should be comfortable with a Dockerfile and a basic CI YAML file. No security background required, we build the mental model from zero.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Shift left: find it where it's cheap to fix
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A vulnerability caught in CI costs minutes to fix. The same vulnerability caught in production costs an incident, a postmortem, and your weekend.&lt;/p&gt;

&lt;p&gt;The shift-left principle&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;"Shift left" means moving security checks earlier in the timeline, to the &lt;em&gt;left&lt;/em&gt; of the pipeline, toward the developer, instead of bolting them on at the end. A scanner is just a tool that reads what's inside an image (its packages and their versions), looks each one up in public vulnerability databases, and tells you which ones have known CVEs. The leverage isn't the scan; it's &lt;em&gt;where&lt;/em&gt; you run it and &lt;em&gt;whether it can stop the line&lt;/em&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;X-ray machine at the gate&lt;/td&gt;
&lt;td&gt;The scanner (Trivy / Grype) reading every layer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The watchlist of banned items&lt;/td&gt;
&lt;td&gt;CVE databases (NVD, GitHub Advisory, distro feeds)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Confiscating the item before boarding&lt;/td&gt;
&lt;td&gt;Failing the build on a critical finding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Screening luggage AND carry-on&lt;/td&gt;
&lt;td&gt;Scanning OS packages AND your app dependencies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A second check at the jet bridge&lt;/td&gt;
&lt;td&gt;Admission control rejecting unsigned/unscanned images at deploy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Image scanning maps cleanly onto airport security.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: build, gate, deploy
&lt;/h2&gt;

&lt;p&gt;Here is the full path an image travels from your laptop to a running pod. The two control points that matter are the &lt;strong&gt;gate&lt;/strong&gt; in CI (fail on critical) and &lt;strong&gt;admission control&lt;/strong&gt; at the cluster (reject anything that didn't go through the gate).&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcHV0ZSBmaWxsOiMwNzI3MmEsc3Ryb2tlOiMyMmI4YjAsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojN2ZlOWRmOwogIGNsYXNzRGVmIGRhdGEgZmlsbDojMmExNTA4LHN0cm9rZTojZjk3MzE2LHN0cm9rZS13aWR0aDoycHgsY29sb3I6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CBuX2dhdGUKICBuX2dhdGUgLS0-fCJwYXNzInwgbl9yZWdpc3RyeQogIG5fZ2F0ZSAtLi0-fCJmYWlsInwgbl9ibG9jawogIG5fcmVnaXN0cnkgLS0-fCJwdWxsInwgbl9hZG1pc3Npb24KICBuX2FkbWlzc2lvbiAtLT58ImFkbWl0Inwgbl9jbHVzdGVy%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcHV0ZSBmaWxsOiMwNzI3MmEsc3Ryb2tlOiMyMmI4YjAsc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ml4ICYgcmV0cnkiKQogIGNsYXNzIG5fYmxvY2sgb2JzZXJ2YWJpbGl0eTsKICBuX2J1aWxkIC0tPnwiaW1hZ2UifCBuX3NjYW4KICBuX3NjYW4gLS0-fCJyZXBvcnQifCBuX2dhdGUKICBuX2dhdGUgLS0-fCJwYXNzInwgbl9yZWdpc3RyeQogIG5fZ2F0ZSAtLi0-fCJmYWlsInwgbl9ibG9jawogIG5fcmVnaXN0cnkgLS0-fCJwdWxsInwgbl9hZG1pc3Npb24KICBuX2FkbWlzc2lvbiAtLT58ImFkbWl0Inwgbl9jbHVzdGVy%3FbgColor%3D0d1017%26type%3Dpng" alt="Scan in CI to fail fast; enforce again at admission so nothing sneaks in the side door." width="1484" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Scan in CI to fail fast; enforce again at admission so nothing sneaks in the side door.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build the image&lt;/strong&gt;: Your CI runs &lt;code&gt;docker build&lt;/code&gt; and produces a tagged image, base layers plus your app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scan the image&lt;/strong&gt;: Trivy or Grype reads every layer, enumerates packages, and matches versions against CVE feeds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate on severity&lt;/strong&gt;: The scanner exits non-zero if it finds a CRITICAL (or HIGH). A non-zero exit fails the CI job, the line stops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Push only if clean&lt;/strong&gt;: A passing build pushes the image to your registry. A failing build never gets that far.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enforce at admission&lt;/strong&gt;: When something tries to deploy, an admission controller checks the image was scanned/signed and rejects it otherwise.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What to scan (it's more than OS packages)
&lt;/h2&gt;

&lt;p&gt;A common mistake is thinking "image scanning" means "OS package scanning." Your attack surface is wider: the application dependencies you bundle, the infrastructure-as-code that provisions everything, and any secrets that accidentally got baked into a layer. Good news, modern scanners like Trivy cover all four from one binary.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What&lt;/th&gt;
&lt;th&gt;Why it bites&lt;/th&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OS packages&lt;/td&gt;
&lt;td&gt;Base image ships CVEs you never chose (openssl, glibc, curl)&lt;/td&gt;
&lt;td&gt;Trivy, Grype&lt;/td&gt;
&lt;td&gt;On every image build&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;App dependencies&lt;/td&gt;
&lt;td&gt;Transitive npm/pip/maven packages with known CVEs&lt;/td&gt;
&lt;td&gt;Trivy, Grype, Dependabot&lt;/td&gt;
&lt;td&gt;On every build + on a schedule&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;IaC / Dockerfile&lt;/td&gt;
&lt;td&gt;Misconfigs: running as root, open security groups, no resource limits&lt;/td&gt;
&lt;td&gt;Trivy config, Checkov&lt;/td&gt;
&lt;td&gt;On PR, before merge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Secrets&lt;/td&gt;
&lt;td&gt;API keys / tokens accidentally committed or baked into a layer&lt;/td&gt;
&lt;td&gt;Trivy, gitleaks&lt;/td&gt;
&lt;td&gt;On PR + on image build&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Four things to scan, and where each check belongs in the pipeline.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Scan the same image you ship:&lt;/strong&gt; Scan the &lt;em&gt;built artifact&lt;/em&gt;, not just your source tree. A Dockerfile scan won't catch a CVE that arrived through the base image's pre-installed packages, only scanning the final image will.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The gate: a CI step that fails on HIGH/CRITICAL
&lt;/h2&gt;

&lt;p&gt;This is the whole point of the article. Scanning that only &lt;em&gt;reports&lt;/em&gt; is theatre, someone has to read the report, and nobody does. The gate makes the pipeline read it for you. Here's a GitHub Actions job that builds the image, scans it with Trivy, and &lt;strong&gt;fails the build&lt;/strong&gt; the moment a HIGH or CRITICAL with a known fix appears.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.github/workflows/image-scan.yml&lt;/code&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="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;build-and-scan&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;main&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;scan&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v4&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;Build image&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docker build -t app:${{ github.sha }} .&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;Scan image with Trivy&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;aquasecurity/trivy-action@0.24.0&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;image-ref&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app:${{ github.sha }}&lt;/span&gt;
          &lt;span class="na"&gt;format&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;table&lt;/span&gt;
          &lt;span class="c1"&gt;# Fail the job on these severities...&lt;/span&gt;
          &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HIGH,CRITICAL&lt;/span&gt;
          &lt;span class="c1"&gt;# ...but only when an upstream fix actually exists.&lt;/span&gt;
          &lt;span class="na"&gt;ignore-unfixed&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
          &lt;span class="c1"&gt;# exit-code: 1 turns a finding into a failed build (the gate).&lt;/span&gt;
          &lt;span class="na"&gt;exit-code&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1"&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;Push image&lt;/span&gt;
        &lt;span class="c1"&gt;# Only runs if the scan step above passed.&lt;/span&gt;
        &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github.ref == 'refs/heads/main'&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
          &lt;span class="s"&gt;echo "Scan clean, pushing image"&lt;/span&gt;
          &lt;span class="s"&gt;docker push app:${{ github.sha }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;exit-code: "1"&lt;/code&gt;&lt;/strong&gt; is the line that turns a scan into a &lt;em&gt;gate&lt;/em&gt;. Without it, Trivy prints findings and exits 0, the build stays green and nothing stops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ignore-unfixed: true&lt;/code&gt;&lt;/strong&gt; avoids failing on CVEs that have no patch yet, you can't fix what upstream hasn't fixed, so failing there just trains people to ignore the gate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;severity: HIGH,CRITICAL&lt;/code&gt;&lt;/strong&gt; is your threshold. Start strict on CRITICAL, add HIGH once your images are clean, and resist the urge to also fail on LOW (noise kills trust in the gate).&lt;/li&gt;
&lt;li&gt;The push step is guarded by &lt;code&gt;if:&lt;/code&gt; so a failed scan never reaches the registry.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Give yourself an escape hatch, a narrow one:&lt;/strong&gt; For an unfixable CVE that genuinely doesn't apply to you, use a &lt;code&gt;.trivyignore&lt;/code&gt; file listing the specific CVE ID with a comment and an expiry date. Never blanket-disable a severity to get a release out, that's how the base-image CVE shipped in the first place.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Shrink the target: distroless &amp;amp; minimal bases
&lt;/h2&gt;

&lt;p&gt;The cheapest vulnerability to fix is the one that was never in the image. Every package in your base is a package that can have a CVE. A full &lt;code&gt;ubuntu&lt;/code&gt; or &lt;code&gt;node&lt;/code&gt; image carries a shell, a package manager, and hundreds of libraries your app never calls, pure attack surface. &lt;strong&gt;Distroless&lt;/strong&gt; and &lt;strong&gt;minimal&lt;/strong&gt; base images strip that down to just your app and its runtime.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Base image&lt;/th&gt;
&lt;th&gt;What's inside&lt;/th&gt;
&lt;th&gt;Trade-off&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ubuntu / debian&lt;/td&gt;
&lt;td&gt;Full OS, shell, apt, many libs&lt;/td&gt;
&lt;td&gt;Familiar, but the most CVEs to chase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;alpine&lt;/td&gt;
&lt;td&gt;Tiny OS + busybox shell + apk&lt;/td&gt;
&lt;td&gt;Small and popular; musl libc can surprise some apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;distroless&lt;/td&gt;
&lt;td&gt;Just your app + language runtime, no shell&lt;/td&gt;
&lt;td&gt;Tiny CVE surface; harder to debug (no shell)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;scratch&lt;/td&gt;
&lt;td&gt;Literally nothing, your static binary only&lt;/td&gt;
&lt;td&gt;Zero OS CVEs; only works for static binaries (Go, Rust)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Smaller base = fewer packages = fewer CVEs to triage.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pair this with a &lt;a href="https://thesimplifiedtech.com/blog/dockerfile-best-practices" rel="noopener noreferrer"&gt;multi-stage build&lt;/a&gt;: compile in a fat builder stage, then copy only the artifact into a distroless final stage. You get a small, fast image with almost nothing for a scanner to flag.&lt;/p&gt;

&lt;h3&gt;
  
  
  Generate an SBOM while you're at it
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;Software Bill of Materials (SBOM)&lt;/strong&gt; is a machine-readable inventory of everything in your image. Trivy can emit one (&lt;code&gt;trivy image --format cyclonedx&lt;/code&gt;). The win: when the &lt;em&gt;next&lt;/em&gt; big CVE drops, you don't rebuild and rescan every image to find out who's affected, you query your stored SBOMs. Scanning tells you what's vulnerable &lt;em&gt;today&lt;/em&gt;; the SBOM lets you answer that question instantly &lt;em&gt;tomorrow&lt;/em&gt;. This is the heart of &lt;a href="https://thesimplifiedtech.com/blog/securing-the-software-supply-chain" rel="noopener noreferrer"&gt;supply-chain security&lt;/a&gt;, know exactly what you ship.&lt;/p&gt;

&lt;h2&gt;
  
  
  One more gate: runtime &amp;amp; admission control
&lt;/h2&gt;

&lt;p&gt;CI scanning assumes everything reaches production &lt;em&gt;through&lt;/em&gt; CI. In practice, someone will &lt;code&gt;kubectl apply&lt;/code&gt; a hand-tagged image, or a stale one will get redeployed. &lt;strong&gt;Admission control&lt;/strong&gt; is the cluster's own gate: a controller (Kyverno, OPA Gatekeeper, or a registry policy) inspects every image at deploy time and rejects ones that weren't scanned, weren't signed, or pull from an untrusted registry. CI is the lock on the front door; admission control is the lock on the back door, you want both.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Require signed images&lt;/strong&gt;, only admit images signed by your CI (e.g. with cosign), so a random &lt;code&gt;:latest&lt;/code&gt; from Docker Hub can't deploy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restrict registries&lt;/strong&gt;, allow pulls only from your own registry, where every image has already passed the gate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Block privileged pods&lt;/strong&gt;, reject containers asking for root, host networking, or &lt;code&gt;privileged: true&lt;/code&gt; at admission.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime monitoring&lt;/strong&gt;, even an admitted image can be exploited later; tools like Falco watch for suspicious behavior in running containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Scanning but never gating.&lt;/strong&gt; Trivy in a step with &lt;code&gt;exit-code: 0&lt;/code&gt; produces a beautiful report nobody reads. If a finding can't fail the build, it doesn't exist.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fat base images.&lt;/strong&gt; &lt;code&gt;FROM ubuntu&lt;/code&gt; then chasing 80 CVEs every week. Move to distroless/alpine and most of them simply vanish, you can't have a CVE in a package you didn't install.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring transitive dependencies.&lt;/strong&gt; You audited your direct &lt;code&gt;package.json&lt;/code&gt;, but the CVE is four levels deep in a dependency-of-a-dependency. Scanners walk the &lt;em&gt;whole&lt;/em&gt; tree; lockfiles are where the real risk lives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failing on unfixable CVEs.&lt;/strong&gt; Gating on findings with no available patch just teaches everyone to slap &lt;code&gt;|| true&lt;/code&gt; on the scan. Use &lt;code&gt;ignore-unfixed&lt;/code&gt; and a dated &lt;code&gt;.trivyignore&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scanning only at release.&lt;/strong&gt; A scan once a quarter means you find out about Friday's CVE in three months. Scan every build, and re-scan on a schedule since new CVEs land against images you already shipped.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Most container CVEs come from the base image and transitive deps, code you didn't write.&lt;/li&gt;
&lt;li&gt;Shift left: scan on every build, where a fix costs minutes, not an incident.&lt;/li&gt;
&lt;li&gt;Scan four things, OS packages, app deps, IaC/Dockerfile, secrets.&lt;/li&gt;
&lt;li&gt;The gate is &lt;code&gt;exit-code: 1&lt;/code&gt; on HIGH/CRITICAL, a scan that can't fail the build is theatre.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;ignore-unfixed&lt;/code&gt; + a dated &lt;code&gt;.trivyignore&lt;/code&gt; so the gate stays trusted, not bypassed.&lt;/li&gt;
&lt;li&gt;Shrink the target with distroless/minimal bases; emit an SBOM for tomorrow's CVE.&lt;/li&gt;
&lt;li&gt;Add admission control so only scanned, signed images from trusted registries ever deploy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Scanning is one pillar of secure delivery. Pair it with images that are small by design and a supply chain you can trust end to end.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build images that barely register on a scanner: &lt;a href="https://thesimplifiedtech.com/blog/dockerfile-best-practices" rel="noopener noreferrer"&gt;Dockerfile Best Practices: Small, Fast, Secure Images&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Go end-to-end on provenance and signing: &lt;a href="https://thesimplifiedtech.com/blog/securing-the-software-supply-chain" rel="noopener noreferrer"&gt;Securing the Software Supply Chain&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Practice the build → scan → gate loop hands-on in the &lt;a href="https://thesimplifiedtech.com/labs/docker" rel="noopener noreferrer"&gt;Docker lab&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;See where this fits in the bigger picture: the &lt;a href="https://thesimplifiedtech.com/career-paths/devops-engineer" rel="noopener noreferrer"&gt;DevOps Engineer career path&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/container-image-security-scanning" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>docker</category>
      <category>security</category>
    </item>
    <item>
      <title>DORA Metrics: Measuring Delivery Performance</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Fri, 06 Nov 2026 17:46:00 +0000</pubDate>
      <link>https://dev.to/sri2614/dora-metrics-measuring-delivery-performance-3jg2</link>
      <guid>https://dev.to/sri2614/dora-metrics-measuring-delivery-performance-3jg2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Measure delivery with the four DORA keys: deployment frequency, lead time, change failure rate, and recovery time. The key move is computing them from CI and git data while measuring the system, not gaming the people.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Why "are we shipping well?" is so hard to answer&lt;/li&gt;
&lt;li&gt;What DORA actually measures&lt;/li&gt;
&lt;li&gt;The picture: one change, four measurements&lt;/li&gt;
&lt;li&gt;The four keys at a glance&lt;/li&gt;
&lt;li&gt;Computing the metrics from CI + git data&lt;/li&gt;
&lt;li&gt;Improving each metric, without gaming it&lt;/li&gt;
&lt;li&gt;Don't game the metrics: measure the system, not the people&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why "are we shipping well?" is so hard to answer
&lt;/h2&gt;

&lt;p&gt;Someone in leadership asks: "Is our delivery getting faster or slower?" The room goes quiet. One person says deploys feel slow. Another says they feel fine. A third pulls up a Jira burndown that measures something else entirely. Everyone has a vibe; nobody has a number. The conversation ends with "let's circle back" and nothing changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DORA metrics&lt;/strong&gt; end that argument. They come out of the DevOps Research and Assessment program (the team behind the &lt;em&gt;Accelerate&lt;/em&gt; book and the annual &lt;em&gt;State of DevOps&lt;/em&gt; reports), which spent years correlating engineering practices with business outcomes. The headline finding: four metrics, and only four, reliably separate high-performing teams from the rest. They are simple to define, hard to fake when measured honestly, and they pull in the same direction as the things you actually care about: speed and stability.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Senior engineers, tech leads, and platform/SRE folks who want to measure delivery performance with numbers instead of vibes. You should already know what a CI/CD pipeline and a production incident are. No statistics background needed, if you can run a git command and read a SQL query, you're set.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What DORA actually measures
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;DORA's four keys answer two questions at once: how fast can you deliver change (throughput), and how safely (stability)? Elite teams are good at both, speed and stability are not a trade-off.&lt;/p&gt;

&lt;p&gt;Paraphrasing the Accelerate / State of DevOps findings&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The most common mistake is treating speed and stability as a dial you slide between, "we could ship faster if we accepted more breakage." DORA's data says the opposite: the same practices (small batches, automated testing, fast pipelines) make you both faster &lt;em&gt;and&lt;/em&gt; safer. The four metrics split neatly into those two halves.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Speedometer, how fast are you going?&lt;/td&gt;
&lt;td&gt;Deployment frequency, how often you ship to prod&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Time from key-turn to highway speed&lt;/td&gt;
&lt;td&gt;Lead time for changes, commit to production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How often the trip ends in a breakdown&lt;/td&gt;
&lt;td&gt;Change failure rate, % of deploys that break prod&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How long the breakdown keeps you stranded&lt;/td&gt;
&lt;td&gt;Recovery time (MTTR), time to restore service&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;DORA is your delivery dashboard, the same gauges every car has.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: one change, four measurements
&lt;/h2&gt;

&lt;p&gt;All four metrics are timestamps and counts pulled from the same journey: a commit travels through a pipeline, deploys to production, and occasionally causes an incident that someone has to recover from. The diagram below overlays each metric on the point in the flow where it's measured.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZ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SBlZGdlOwogIG5fc2VydmUoIlNlcnZpbmcgVHJhZmZpYzxici8-aGVhbHRoeSBzdGF0ZSIpCiAgY2xhc3Mgbl9zZXJ2ZSBkYXRhOwogIG5faW5jaWRlbnQoIkluY2lkZW50PGJyLz5kZXBsb3kgYnJva2UgcHJvZCIpCiAgY2xhc3Mgbl9pbmNpZGVudCBvYnNlcnZhYmlsaXR5OwogIG5fcmVzdG9yZSgiUmVjb3ZlcmVkPGJyLz5zZXJ2aWNlIHJlc3RvcmVkIikKICBjbGFzcyBuX3Jlc3RvcmUgcXVldWU7CiAgbl9jb21taXQgLS0-fCJsZWFkIHRpbWUgc3RhcnRzInwgbl9waXBlbGluZQogIG5fcGlwZWxpbmUgLS0-fCJsZWFkIHRpbWUgZW5kcyJ8IG5fZGVwbG95CiAgbl9kZXBsb3kgLS0-fCJkZXBsb3kgZnJlcXVlbmN5IGNvdW50cyBoZXJlInwgbl9zZXJ2ZQogIG5fZGVwbG95IC0uLT58ImNoYW5nZSBmYWlsdXJlIHJhdGUifCBuX2luY2lkZW50CiAgbl9pbmNpZGVudCAtLi0-fCJyZWNvdmVyeSB0aW1lIChNVFRSKSJ8IG5fcmVzdG9yZQogIG5fcmVzdG9yZSAtLi0-fCJiYWNrIHRvIGhlYWx0aHkifCBuX3NlcnZl%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUN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uX3BpcGVsaW5lKCJDSS9DRCBQaXBlbGluZTxici8-YnVpbGQgwrcgdGVzdCDCtyBnYXRlIikKICBjbGFzcyBuX3BpcGVsaW5lIGNvbXB1dGU7CiAgbl9kZXBsb3koIlByb2R1Y3Rpb24gRGVwbG95PGJyLz5yZWxlYXNlIGV2ZW50IikKICBjbGFzcyBuX2RlcGxveSBlZGdlOwogIG5fc2VydmUoIlNlcnZpbmcgVHJhZmZpYzxici8-aGVhbHRoeSBzdGF0ZSIpCiAgY2xhc3Mgbl9zZXJ2ZSBkYXRhOwogIG5faW5jaWRlbnQoIkluY2lkZW50PGJyLz5kZXBsb3kgYnJva2UgcHJvZCIpCiAgY2xhc3Mgbl9pbmNpZGVudCBvYnNlcnZhYmlsaXR5OwogIG5fcmVzdG9yZSgiUmVjb3ZlcmVkPGJyLz5zZXJ2aWNlIHJlc3RvcmVkIikKICBjbGFzcyBuX3Jlc3RvcmUgcXVldWU7CiAgbl9jb21taXQgLS0-fCJsZWFkIHRpbWUgc3RhcnRzInwgbl9waXBlbGluZQogIG5fcGlwZWxpbmUgLS0-fCJsZWFkIHRpbWUgZW5kcyJ8IG5fZGVwbG95CiAgbl9kZXBsb3kgLS0-fCJkZXBsb3kgZnJlcXVlbmN5IGNvdW50cyBoZXJlInwgbl9zZXJ2ZQogIG5fZGVwbG95IC0uLT58ImNoYW5nZSBmYWlsdXJlIHJhdGUifCBuX2luY2lkZW50CiAgbl9pbmNpZGVudCAtLi0-fCJyZWNvdmVyeSB0aW1lIChNVFRSKSJ8IG5fcmVzdG9yZQogIG5fcmVzdG9yZSAtLi0-fCJiYWNrIHRvIGhlYWx0aHkifCBuX3NlcnZl%3FbgColor%3D0d1017%26type%3Dpng" alt="A single change flowing from commit to deploy to incident, with the four DORA metrics overlaid on where each is measured" width="1886" height="126"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A single change flowing from commit to deploy to incident, with the four DORA metrics overlaid on where each is measured.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick your two source systems&lt;/strong&gt;: Almost everything comes from your version control (git) and your CI/CD tool. Incidents come from your alerting/on-call tool (PagerDuty, Opsgenie) or an incidents table. You rarely need anything else.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Define a "deploy" precisely&lt;/strong&gt;: Agree on one signal that means "this reached production", a successful prod pipeline run, a GitHub deployment event, or a release tag. Every metric anchors to this definition, so write it down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capture commit and deploy timestamps&lt;/strong&gt;: Lead time = deploy time minus the timestamp of the earliest commit in that release. Deploy frequency = count of prod deploy events per day/week.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capture failures and recoveries&lt;/strong&gt;: A deploy that triggers a rollback, hotfix, or incident is a failure. Recovery time = restored timestamp minus incident-start timestamp.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aggregate over a rolling window&lt;/strong&gt;: Report all four as a trailing 30- or 90-day rolling figure. Single data points are noise; the trend is the signal.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The four keys at a glance
&lt;/h2&gt;

&lt;p&gt;Here are the four metrics, how each is measured, and what DORA's "elite" tier looks like. Use elite as a north star, not a stick, most teams should aim to move &lt;em&gt;up one tier&lt;/em&gt; before chasing the top.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;How it's measured&lt;/th&gt;
&lt;th&gt;What "elite" looks like&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Deployment frequency&lt;/td&gt;
&lt;td&gt;Count of successful production deploys per unit of time&lt;/td&gt;
&lt;td&gt;On-demand, multiple deploys per day&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lead time for changes&lt;/td&gt;
&lt;td&gt;Time from code committed to that code running in production&lt;/td&gt;
&lt;td&gt;Less than one day&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Change failure rate&lt;/td&gt;
&lt;td&gt;% of deploys that cause a failure needing remediation (rollback/hotfix/incident)&lt;/td&gt;
&lt;td&gt;0-15%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recovery time (MTTR)&lt;/td&gt;
&lt;td&gt;Time from a failed deploy / incident start to service restored&lt;/td&gt;
&lt;td&gt;Less than one hour&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The four DORA metrics: definition, measurement, and the elite benchmark.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Tip:&lt;/strong&gt; The first two metrics (frequency, lead time) measure &lt;strong&gt;throughput&lt;/strong&gt;; the last two (failure rate, recovery) measure &lt;strong&gt;stability&lt;/strong&gt;. A healthy team improves both columns together. If one column races ahead while the other rots, you're optimizing in isolation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Computing the metrics from CI + git data
&lt;/h2&gt;

&lt;p&gt;You don't need a commercial dashboard to start. If your deploys and commits land in a database (or you export CI logs to one), two SQL queries get you the throughput half. Assume a &lt;code&gt;deployments&lt;/code&gt; table, one row per successful prod deploy, with the deploy time and the earliest commit time for that release.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dora_throughput.sql&lt;/code&gt;&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="c1"&gt;-- Deployment frequency: prod deploys per day over the last 30 days&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;date_trunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'day'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;deployed_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&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;AS&lt;/span&gt; &lt;span class="n"&gt;deploys&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;deployments&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;environment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'production'&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;deployed_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'30 days'&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;day&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;-- Lead time for changes: median commit -&amp;gt; deploy, last 30 days&lt;/span&gt;
&lt;span class="c1"&gt;-- first_commit_at = timestamp of the earliest commit in the release&lt;/span&gt;
&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;percentile_cont&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;WITHIN&lt;/span&gt; &lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="k"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;epoch&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;deployed_at&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;first_commit_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;median_lead_time_hours&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;deployments&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;environment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'production'&lt;/span&gt;
  &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;deployed_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;interval&lt;/span&gt; &lt;span class="s1"&gt;'30 days'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No database yet? You can approximate lead time straight from git and your CI tool with a few shell commands. This pulls the merge time of the last commit and the time the deploy tag was pushed, crude, but enough to see a trend on day one.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;lead_time.sh&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;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="c"&gt;# Earliest commit time on this release (epoch seconds)&lt;/span&gt;
&lt;span class="nv"&gt;commit_epoch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git log &lt;span class="nt"&gt;-1&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;%ct &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RELEASE_BASE&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;HEAD&lt;/span&gt;&lt;span class="p"&gt;~1&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Deploy time = now (run this at the end of your prod deploy job)&lt;/span&gt;
&lt;span class="nv"&gt;deploy_epoch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; +%s&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;lead_seconds&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt; deploy_epoch &lt;span class="o"&gt;-&lt;/span&gt; commit_epoch &lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="nv"&gt;lead_hours&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s2"&gt;"BEGIN { printf &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;%.1f&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;, &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;lead_seconds&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; / 3600 }"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"lead_time_hours=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;lead_hours&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Emit a metric your monitoring stack can scrape/aggregate&lt;/span&gt;
curl &lt;span class="nt"&gt;-fsS&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;METRICS_URL&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/dora/lead_time"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"value=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;lead_hours&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"service=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;SERVICE_NAME&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Warning:&lt;/strong&gt; Pick a &lt;strong&gt;median or 90th percentile&lt;/strong&gt;, never a mean. One stuck release that sat in review for three weeks will drag a mean lead time into nonsense while the median stays honest. The same goes for recovery time, averages hide your worst incidents.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Improving each metric, without gaming it
&lt;/h2&gt;

&lt;p&gt;The genius and the danger of DORA is that all four are easy to move &lt;em&gt;on paper&lt;/em&gt;. Make deploys tiny and trivial and your frequency soars. Stop counting hotfixes as failures and your failure rate drops to zero. Redefine "recovered" loosely and MTTR shrinks. Each of these makes the dashboard greener while delivery gets no better, or gets worse. Real improvement comes from changing the &lt;em&gt;system&lt;/em&gt;, not the &lt;em&gt;counting&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deployment frequency, make deploys boring
&lt;/h3&gt;

&lt;p&gt;The honest lever is &lt;strong&gt;batch size&lt;/strong&gt;. Smaller, more frequent merges to main reduce risk per deploy and naturally raise frequency. Pair this with &lt;a href="https://thesimplifiedtech.com/labs/git" rel="noopener noreferrer"&gt;trunk-based development&lt;/a&gt; and feature flags so half-finished work can ship dark. The gaming version, splitting one change into ten no-op deploys, inflates the number without shipping value, so anchor frequency to deploys that contain real merged changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lead time, shorten the wait, not the work
&lt;/h3&gt;

&lt;p&gt;Most lead time is &lt;em&gt;waiting&lt;/em&gt;, not &lt;em&gt;working&lt;/em&gt;: code sitting in review, builds queuing, manual approval gates. Attack the queue, faster &lt;a href="https://thesimplifiedtech.com/labs/cicd" rel="noopener noreferrer"&gt;CI/CD pipelines&lt;/a&gt;, smaller PRs, automated tests replacing manual sign-off. The anti-pattern is measuring lead time from PR-open instead of first-commit, which quietly hides the days work sat on a branch. Measure from the commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Change failure rate, fewer failures, honestly counted
&lt;/h3&gt;

&lt;p&gt;Lower it with better tests, &lt;a href="https://thesimplifiedtech.com/blog/deployment-strategies-blue-green-canary" rel="noopener noreferrer"&gt;progressive delivery&lt;/a&gt; (canary catches bad releases before full rollout), and strong pre-prod environments. The gaming version is reclassifying incidents as "not really a failure" or excluding hotfixes. Define a failure once, in writing, &lt;em&gt;any&lt;/em&gt; deploy needing remediation, and never relitigate it during a bad week.&lt;/p&gt;

&lt;h3&gt;
  
  
  Recovery time (MTTR), practice getting back up
&lt;/h3&gt;

&lt;p&gt;The biggest lever is the ability to &lt;strong&gt;roll back instantly&lt;/strong&gt;, a one-command revert or an automated rollback on health-check failure beats any heroic forward-fix. Good runbooks, clear ownership, and observability that points at the cause all shave minutes. Don't game it by marking incidents "resolved" the moment the alert clears while users are still hurting, anchor "recovered" to a real service-health signal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't game the metrics: measure the system, not the people
&lt;/h2&gt;

&lt;p&gt;The fastest way to ruin DORA metrics is to turn them into individual performance targets. The moment "deploy frequency" lands on someone's review, you'll get deploy-frequency, and nothing else. This is &lt;strong&gt;Goodhart's Law&lt;/strong&gt;: when a measure becomes a target, it stops being a good measure. DORA metrics are diagnostics for a &lt;em&gt;delivery system&lt;/em&gt;, not scorecards for &lt;em&gt;humans&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Report all four &lt;strong&gt;together&lt;/strong&gt;. Any single metric in isolation invites a tradeoff that wrecks another, fast deploys with a soaring failure rate is not progress.&lt;/li&gt;
&lt;li&gt;Track &lt;strong&gt;trends, not absolutes&lt;/strong&gt;. "We cut lead time 40% this quarter" is the win. Hitting an arbitrary elite threshold is not.&lt;/li&gt;
&lt;li&gt;Keep definitions &lt;strong&gt;stable&lt;/strong&gt;. Changing what counts as a failure or a deploy mid-stream makes every comparison meaningless. Decide once, document it.&lt;/li&gt;
&lt;li&gt;Tie metrics to &lt;strong&gt;outcomes&lt;/strong&gt;, not bonuses. Use them to find bottlenecks and justify investment in tooling, never to rank engineers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Using averages instead of percentiles.&lt;/strong&gt; One outlier release or one bad incident skews the mean into a lie. Use median and p90.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measuring lead time from PR-open.&lt;/strong&gt; That hides the days a branch sat untouched. Measure from the first commit in the change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Counting non-prod deploys.&lt;/strong&gt; Staging deploys inflate frequency without shipping anything to users. Filter to the production environment only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quietly redefining "failure."&lt;/strong&gt; Excluding hotfixes or reclassifying incidents during a rough week corrupts the one metric people watch most.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turning the dashboard into a leaderboard.&lt;/strong&gt; Per-team or per-person rankings guarantee gaming. Aggregate at the system level.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chasing elite on day one.&lt;/strong&gt; Moving up &lt;em&gt;one tier&lt;/em&gt; is the realistic goal. Skip the vanity sprint to multiple-deploys-per-day on a codebase that isn't ready.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;DORA metrics in eight lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Four metrics, two halves: deployment frequency + lead time (throughput), change failure rate + recovery time (stability).&lt;/li&gt;
&lt;li&gt;Speed and stability are not a trade-off, the same practices improve both.&lt;/li&gt;
&lt;li&gt;All four come from two systems you already have: git/CI and your incident tool.&lt;/li&gt;
&lt;li&gt;Define a "deploy" and a "failure" once, in writing, and never move the goalposts.&lt;/li&gt;
&lt;li&gt;Use medians and p90, never means, outliers ruin averages.&lt;/li&gt;
&lt;li&gt;Report all four together and track trends, not absolute thresholds.&lt;/li&gt;
&lt;li&gt;Improve the system (smaller batches, faster pipelines, instant rollback), not the counting.&lt;/li&gt;
&lt;li&gt;Never make DORA metrics an individual performance target, Goodhart's Law will punish you.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;DORA metrics measure the pipeline, so the next step is making that pipeline faster and safer. Start with the mechanics, then the deployment patterns that move failure rate and recovery time directly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://thesimplifiedtech.com/blog/cicd-fundamentals-what-a-pipeline-does" rel="noopener noreferrer"&gt;CI/CD Fundamentals: What a Pipeline Really Does&lt;/a&gt;, the throughput half of DORA lives in your pipeline; this is how it works.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://thesimplifiedtech.com/blog/deployment-strategies-blue-green-canary" rel="noopener noreferrer"&gt;Deployment Strategies: Blue-Green, Canary &amp;amp; Progressive Delivery&lt;/a&gt;, the patterns that cut change failure rate and recovery time.&lt;/li&gt;
&lt;li&gt;Practice the plumbing in the &lt;a href="https://thesimplifiedtech.com/labs/cicd" rel="noopener noreferrer"&gt;CI/CD lab&lt;/a&gt; and the &lt;a href="https://thesimplifiedtech.com/labs/git" rel="noopener noreferrer"&gt;Git lab&lt;/a&gt;, both feed the timestamps your metrics depend on.&lt;/li&gt;
&lt;li&gt;Follow the full &lt;a href="https://thesimplifiedtech.com/career-paths/devops-engineer" rel="noopener noreferrer"&gt;DevOps Engineer career path&lt;/a&gt; to put measurement, pipelines, and delivery practices together.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/dora-metrics" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>docker</category>
      <category>dora</category>
    </item>
    <item>
      <title>AI/GPU Infrastructure on the Cloud</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Thu, 05 Nov 2026 18:24:35 +0000</pubDate>
      <link>https://dev.to/sri2614/aigpu-infrastructure-on-the-cloud-585</link>
      <guid>https://dev.to/sri2614/aigpu-infrastructure-on-the-cloud-585</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; When the AI team needs GPUs, you will know how to deliver: instance families, quota requests, spot versus reserved, inference serving, and the storage and networking choices that keep training fast and the bill sane.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The AI team needs 8 GPUs by Friday&lt;/li&gt;
&lt;li&gt;One sentence, then a picture&lt;/li&gt;
&lt;li&gt;The shape of a GPU platform&lt;/li&gt;
&lt;li&gt;GPU instance types and accelerators&lt;/li&gt;
&lt;li&gt;Choosing: families and trade-offs&lt;/li&gt;
&lt;li&gt;Stand up a GPU inference deployment&lt;/li&gt;
&lt;li&gt;Storage and networking&lt;/li&gt;
&lt;li&gt;Cost and quota control&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours (and thousands)&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The AI team needs 8 GPUs by Friday
&lt;/h2&gt;

&lt;p&gt;It is Tuesday. The ML lead drops a message: "We need 8 A100s by Friday to fine-tune the new model, and an endpoint to serve it after." You open the cloud console, pick a GPU instance, hit launch, and get &lt;strong&gt;InsufficientInstanceCapacity&lt;/strong&gt;. You request a quota increase and it is "under review." The one region that has capacity costs 40% more. And nobody has said whether these 8 GPUs run for three days or three months.&lt;/p&gt;

&lt;p&gt;GPU infrastructure breaks the instincts you built on CPU clouds. The hardware is scarce, the on-demand price is brutal, idle time is pure waste, and "just autoscale it" does not work the way it does for web servers. This article is the field guide: how to get the GPUs, how to serve a model on them, how to wire up a training cluster, and how to stop the bill from quietly tripling.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Cloud and platform engineers who suddenly own AI workloads, provisioning GPUs, standing up inference endpoints, or supporting a training cluster. You know EC2/VMs, autoscaling, and containers. You do &lt;strong&gt;not&lt;/strong&gt; need to know how transformers work. We cover the infra, not the math.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  One sentence, then a picture
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;GPU infrastructure is just compute where the accelerator is the scarce, expensive resource, so every design decision becomes a question of keeping that accelerator busy.&lt;/p&gt;

&lt;p&gt;The whole article in one line&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A rentable industrial 3D printer charged by the minute&lt;/td&gt;
&lt;td&gt;A GPU instance billed per second, whether or not it prints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reserving a printer for a year vs walking in off the street&lt;/td&gt;
&lt;td&gt;Reserved / committed capacity vs on-demand pricing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Using leftover off-peak printer time at a steep discount&lt;/td&gt;
&lt;td&gt;Spot / preemptible GPU instances&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A finished blueprint file you load before any print&lt;/td&gt;
&lt;td&gt;The model artifact (weights) loaded onto the GPU before serving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A print queue that batches small jobs into one run&lt;/td&gt;
&lt;td&gt;Inference request batching to maximize GPU utilization&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;GPU infra maps cleanly onto things you already run.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape of a GPU platform
&lt;/h2&gt;

&lt;p&gt;There are two distinct workloads and they want opposite things. &lt;strong&gt;Inference&lt;/strong&gt; serves a trained model to users: it wants low latency, autoscaling, and high uptime. &lt;strong&gt;Training&lt;/strong&gt; builds the model: it wants raw throughput, fast inter-node networking, and is happy to be interrupted if it checkpoints. The diagram below shows both, the inference path on the main row, the training cluster branching off.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcn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uX2luZmVyZW5jZSBjb21wdXRlOwogIG5fYXV0b3NjYWxlcigiQXV0b3NjYWxlcjxici8-U2NhbGVzIG9uIEdQVS9xdWV1ZSIpCiAgY2xhc3Mgbl9hdXRvc2NhbGVyIG9ic2VydmFiaWxpdHk7CiAgbl9jbGllbnQoIkNsaWVudHM8YnIvPkFQSSBjb25zdW1lcnMiKQogIGNsYXNzIG5fY2xpZW50IGNsaWVudDsKICBuX3RyYWluc3RvcmUoIkRhdGFzZXQgU3RvcmU8YnIvPlNoYXJkZWQgb2JqZWN0IHN0b3JhZ2UiKQogIGNsYXNzIG5fdHJhaW5zdG9yZSBkYXRhOwogIG5fdHJhaW5jbHVzdGVyKCJUcmFpbmluZyBDbHVzdGVyPGJyLz5NdWx0aS1HUFUsIGZhc3QgZmFicmljIikKICBjbGFzcyBuX3RyYWluY2x1c3RlciBjb21wdXRlOwogIG5fYXJ0aWZhY3QgLS0-fCJsb2FkIHdlaWdodHMifCBuX2dwdW5vZGVzCiAgbl9ncHVub2RlcyAtLT58InJ1biBtb2RlbCJ8IG5faW5mZXJlbmNlCiAgbl9pbmZlcmVuY2UgLS0-fCJwcmVkaWN0aW9ucyJ8IG5fY2xpZW50CiAgbl9hdXRvc2NhbGVyIC0uLT58InNjYWxlIHJlcGxpY2FzInwgbl9pbmZlcmVuY2UKICBuX3RyYWluc3RvcmUgLS4tPnwic3RyZWFtIGRhdGEifCBuX3RyYWluY2x1c3RlcgogIG5fdHJhaW5jbHVzdGVyIC0uLT58IndyaXRlIG5ldyB3ZWlnaHRzInwgbl9hcnRpZmFjdA%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc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Inwgbl9pbmZlcmVuY2UKICBuX3RyYWluc3RvcmUgLS4tPnwic3RyZWFtIGRhdGEifCBuX3RyYWluY2x1c3RlcgogIG5fdHJhaW5jbHVzdGVyIC0uLT58IndyaXRlIG5ldyB3ZWlnaHRzInwgbl9hcnRpZmFjdA%3FbgColor%3D0d1017%26type%3Dpng" alt="Model artifact and GPU nodes feed an inference service behind an autoscaler; a training cluster branch produces new arti" width="1730" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Model artifact and GPU nodes feed an inference service behind an autoscaler; a training cluster branch produces new artifacts.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A request arrives&lt;/strong&gt;: A client calls the inference API. The request lands on the inference service running in a container on a GPU node.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weights are already resident&lt;/strong&gt;: On startup, each replica pulled the model artifact from object storage and loaded it into GPU memory once. Requests reuse that loaded model, you never reload per request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Requests get batched&lt;/strong&gt;: The server groups concurrent requests into a batch and runs them through the GPU in one pass. One GPU pass serving 16 requests is dramatically cheaper per request than 16 passes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The autoscaler watches pressure&lt;/strong&gt;: It tracks GPU utilization or queue depth, not CPU. When the queue backs up it adds a replica (and a GPU node); when traffic falls it removes them so you stop paying for idle accelerators.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Training runs on its own branch&lt;/strong&gt;: Separately, the training cluster streams the dataset from storage, trains across multiple GPUs over a fast network fabric, and writes a new model artifact back to storage, which the inference service can then roll out.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  GPU instance types and accelerators
&lt;/h2&gt;

&lt;p&gt;Cloud GPUs come in families tuned for different jobs. The dimensions that matter: the &lt;strong&gt;accelerator model&lt;/strong&gt; (the GPU chip itself), &lt;strong&gt;GPU memory&lt;/strong&gt; (VRAM, this caps the model size you can load), how many GPUs are attached per instance, and whether those GPUs are linked by a high-speed interconnect for multi-GPU work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Training-class GPUs&lt;/strong&gt; (NVIDIA A100, H100; equivalently AWS &lt;code&gt;p4&lt;/code&gt;/&lt;code&gt;p5&lt;/code&gt;, Azure &lt;code&gt;ND&lt;/code&gt;, GCP &lt;code&gt;A3&lt;/code&gt;): huge VRAM (40-80GB+), connected by NVLink/NVSwitch inside the box and high-bandwidth networking between boxes. Expensive, scarce, and overkill for most inference.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inference / general GPUs&lt;/strong&gt; (NVIDIA L4, A10G, T4; AWS &lt;code&gt;g5&lt;/code&gt;/&lt;code&gt;g6&lt;/code&gt;, Azure &lt;code&gt;NV&lt;/code&gt;, GCP &lt;code&gt;G2&lt;/code&gt;): less VRAM, far cheaper, great latency-per-dollar for serving small and mid-size models. This is where most production endpoints belong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom accelerators&lt;/strong&gt; (AWS Trainium/Inferentia, Google TPUs): can be much cheaper per unit of work, but need a compiled/adapted model and lock you into that vendor's toolchain. Worth it at scale, friction at the start.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fractional / MIG&lt;/strong&gt;: an A100/H100 can be sliced (Multi-Instance GPU) so several small models share one physical card. Excellent utilization for many tiny endpoints.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Size by VRAM first:&lt;/strong&gt; The model's weights plus its activation memory must fit in GPU memory, or it simply will not load. Estimate VRAM before you pick a family, a model needing 60GB rules out a 24GB card no matter how cheap it is.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Choosing: families and trade-offs
&lt;/h2&gt;

&lt;p&gt;Two decisions dominate cost and reliability: which &lt;strong&gt;instance family&lt;/strong&gt;, and which &lt;strong&gt;pricing model&lt;/strong&gt;. The table puts the trade-offs side by side. Read column 0 as the question you are answering.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Decision&lt;/th&gt;
&lt;th&gt;Pick this when…&lt;/th&gt;
&lt;th&gt;Trade-off / watch-out&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Inference-class GPU (L4/T4/A10G)&lt;/td&gt;
&lt;td&gt;Serving a model in production with latency SLAs and variable traffic&lt;/td&gt;
&lt;td&gt;Limited VRAM caps model size; not for large-scale training&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Training-class GPU (A100/H100)&lt;/td&gt;
&lt;td&gt;Fine-tuning or training; large models that need big VRAM + fast interconnect&lt;/td&gt;
&lt;td&gt;Scarce and very expensive; wasteful if left idle for serving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;On-demand pricing&lt;/td&gt;
&lt;td&gt;Production endpoints, anything that must not be interrupted&lt;/td&gt;
&lt;td&gt;Highest per-hour cost; pay full rate even at low utilization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spot / preemptible&lt;/td&gt;
&lt;td&gt;Training, batch, and fault-tolerant jobs that checkpoint&lt;/td&gt;
&lt;td&gt;Can be reclaimed with little warning, never for stateful serving without a fallback&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reserved / committed (1-3 yr)&lt;/td&gt;
&lt;td&gt;Steady, predictable baseline GPU usage you will run for months&lt;/td&gt;
&lt;td&gt;Large up-front commitment; you pay even if usage drops&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Pick the cheapest option that meets the workload's real constraint, not the biggest GPU available.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Stand up a GPU inference deployment
&lt;/h2&gt;

&lt;p&gt;Here is a containerized inference deployment on Kubernetes that &lt;strong&gt;requests a GPU&lt;/strong&gt;, loads the model from object storage on startup, and is targeted by an autoscaler. The &lt;code&gt;nvidia.com/gpu&lt;/code&gt; resource request is the key line, it tells the scheduler to place this pod only on a GPU node and reserve a whole GPU for it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;inference-deployment.yaml&lt;/code&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="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;Deployment&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;model-inference&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;model-inference&lt;/span&gt; &lt;span class="pi"&gt;}&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;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&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="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;model-inference&lt;/span&gt; &lt;span class="pi"&gt;}&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="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;model-inference&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# Only schedule onto GPU nodes (label your GPU node pool to match).&lt;/span&gt;
      &lt;span class="na"&gt;nodeSelector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;cloud.google.com/gke-accelerator&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nvidia-l4&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;server&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;registry.example.com/model-server:1.4.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;8080&lt;/span&gt;
          &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;# Weights are pulled from object storage once, at startup.&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;MODEL_URI&lt;/span&gt;
              &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;s3://models/intent-classifier/v7/"&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;MAX_BATCH_SIZE&lt;/span&gt;
              &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;16"&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;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;nvidia.com/gpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1"&lt;/span&gt;   &lt;span class="c1"&gt;# reserve one whole GPU per replica&lt;/span&gt;
              &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;16Gi"&lt;/span&gt;
              &lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4"&lt;/span&gt;
          &lt;span class="na"&gt;readinessProbe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;/healthz&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;8080&lt;/span&gt; &lt;span class="pi"&gt;}&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;40&lt;/span&gt;   &lt;span class="c1"&gt;# weights take time to load into VRAM&lt;/span&gt;
&lt;span class="nn"&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;autoscaling/v2&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;HorizontalPodAutoscaler&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;model-inference&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;scaleTargetRef&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;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;Deployment&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;model-inference&lt;/span&gt;
  &lt;span class="na"&gt;minReplicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;maxReplicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8&lt;/span&gt;
  &lt;span class="na"&gt;metrics&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Scale on a GPU-aware custom metric (utilization or queue depth),&lt;/span&gt;
    &lt;span class="c1"&gt;# NOT CPU, a busy GPU often shows near-idle CPU.&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pods&lt;/span&gt;
      &lt;span class="na"&gt;pods&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;metric&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;gpu_duty_cycle&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;AverageValue&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;averageValue&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;70"&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Scale on the GPU, not the CPU:&lt;/strong&gt; The most common autoscaling mistake: targeting CPU. A GPU pegged at 100% can show 10% CPU, so a CPU-based HPA never scales up and your endpoint falls over under load. Always scale on a GPU metric, utilization (duty cycle) or request-queue depth.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Behind this you need a &lt;strong&gt;GPU node pool&lt;/strong&gt;: a node group whose machine type has the accelerator attached and the GPU device drivers installed (on managed Kubernetes, install the vendor device plugin / use the GPU node image). Configure the pool to scale to zero when no GPU pods are pending, that is how you stop paying for idle accelerators overnight.&lt;/p&gt;

&lt;h2&gt;
  
  
  Storage and networking
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Storage for models and datasets
&lt;/h3&gt;

&lt;p&gt;Treat the &lt;strong&gt;model artifact&lt;/strong&gt; as an immutable, versioned object: store weights in object storage (S3/GCS/Blob) under a versioned path like &lt;code&gt;models/&amp;lt;name&amp;gt;/v7/&lt;/code&gt;, and have each replica download it once at boot. Never bake giant weights into the container image, it bloats pulls and couples model rollout to image rollout. For &lt;strong&gt;datasets&lt;/strong&gt;, large training corpora live in object storage too, streamed and sharded across workers; when an epoch must re-read data at high throughput, mount a fast parallel/file system or a local NVMe cache so the GPUs are not starved waiting on I/O.&lt;/p&gt;

&lt;h3&gt;
  
  
  Networking for distributed training
&lt;/h3&gt;

&lt;p&gt;Single-GPU jobs do not care about the network. Multi-node training does, intensely. When dozens of GPUs synchronize gradients every step, the inter-node link becomes the bottleneck. This is why training instances offer &lt;strong&gt;high-bandwidth, low-latency fabrics&lt;/strong&gt; (AWS EFA, InfiniBand, GCP equivalents) and why you place the cluster in a single zone with a &lt;strong&gt;placement group / compact placement&lt;/strong&gt; so nodes are physically close. Spread those same nodes across zones and your expensive GPUs sit idle waiting on the network.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Co-locate training nodes:&lt;/strong&gt; For multi-node training, request a cluster placement group and an interconnect-capable instance family. The GPUs are only as fast as their slowest synchronization, cross-zone chatter quietly halves throughput.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Cost and quota control
&lt;/h2&gt;

&lt;p&gt;GPU cost discipline is its own skill. The on-demand price of a single high-end GPU instance can run thousands of dollars a month, and the failure mode is not a crash, it is a GPU sitting idle at full price. Two levers: &lt;strong&gt;capacity/quotas&lt;/strong&gt; (can you even get the hardware) and &lt;strong&gt;spend&lt;/strong&gt; (are you paying only for work done).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Request quota early.&lt;/strong&gt; Cloud accounts start with a GPU quota of zero or near-zero. Increases are reviewed by humans and can take days, file the request the moment a GPU project is on the roadmap, per region and per family.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Match pricing to interruptibility.&lt;/strong&gt; On-demand for serving; &lt;strong&gt;spot/preemptible&lt;/strong&gt; for training and batch (it can be 60-90% cheaper); &lt;strong&gt;reserved/committed&lt;/strong&gt; for a known steady baseline. Mixing all three is normal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scale to zero.&lt;/strong&gt; GPU node pools and inference replicas should drop to zero when idle. A dev endpoint left running over a weekend is a five-figure surprise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Right-size the GPU.&lt;/strong&gt; A 7B model served on an H100 wastes most of the card. Move it to an L4 or share a card via MIG.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make spend visible.&lt;/strong&gt; Tag every GPU resource by team/project and alert on GPU-hour spend, not just dollars, utilization is the metric that catches waste a cost dashboard misses. See &lt;a href="https://thesimplifiedtech.com/blog/cloud-cost-finops" rel="noopener noreferrer"&gt;Cloud Cost &amp;amp; FinOps: Engineering for Spend&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Spot is for training, not serving:&lt;/strong&gt; Spot/preemptible GPUs can vanish on minutes of notice. That is fine for a training job that checkpoints and resumes. It is not fine for a user-facing endpoint, unless you keep an on-demand fallback pool. Never put a stateful or latency-critical service on spot alone.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours (and thousands)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Idle GPUs at full price.&lt;/strong&gt; A GPU node pool or endpoint with no scale-to-zero runs nights and weekends doing nothing. This is the single biggest GPU waste, check utilization, not just uptime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No autoscaling, or autoscaling on CPU.&lt;/strong&gt; A fixed replica count over-provisions off-peak and falls over at peak; a CPU-based HPA never reacts because a busy GPU looks CPU-idle. Scale on a GPU metric.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong instance for the job.&lt;/strong&gt; Serving a small model on a training-class GPU burns money; trying to fine-tune a large model on a low-VRAM card simply fails to load. Size by VRAM and workload, not by "biggest available."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No spot for training.&lt;/strong&gt; Paying full on-demand for interruptible, checkpointed training jobs leaves the easiest 60-90% savings on the table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Weights baked into the image.&lt;/strong&gt; Multi-gigabyte images make pulls slow and couple model versioning to container builds. Load weights from versioned object storage at startup.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting quota until launch day.&lt;/strong&gt; "Insufficient capacity" plus a multi-day quota review turns a Friday deadline into next week. Request quota before you need it.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inference and training are different workloads: serving wants latency + autoscaling; training wants throughput + fast networking.&lt;/li&gt;
&lt;li&gt;Pick the instance by VRAM and job first, inference-class GPUs (L4/T4/A10G) for serving, training-class (A100/H100) for building models.&lt;/li&gt;
&lt;li&gt;Match pricing to interruptibility: on-demand for serving, spot for training, reserved for steady baselines.&lt;/li&gt;
&lt;li&gt;Store weights as versioned objects and load once into VRAM; never bake them into the image or reload per request.&lt;/li&gt;
&lt;li&gt;Batch requests and autoscale on a GPU metric (utilization/queue depth), never on CPU.&lt;/li&gt;
&lt;li&gt;Multi-node training needs co-located nodes and a high-bandwidth fabric, or the GPUs starve.&lt;/li&gt;
&lt;li&gt;The cardinal sin is the idle GPU at full price: scale to zero, right-size, request quota early.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Once the GPUs are running, the next questions are about the model itself, squeezing latency and cost out of each request, and about treating GPU spend with the same rigor as the rest of your cloud bill.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Optimize the model you are serving:&lt;/strong&gt; &lt;a href="https://thesimplifiedtech.com/blog/llm-cost-and-latency-optimization" rel="noopener noreferrer"&gt;LLM Cost &amp;amp; Latency Optimization&lt;/a&gt;, batching, quantization, caching, and the latency/cost levers above the infra layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bring the bill under control:&lt;/strong&gt; &lt;a href="https://thesimplifiedtech.com/blog/cloud-cost-finops" rel="noopener noreferrer"&gt;Cloud Cost &amp;amp; FinOps: Engineering for Spend&lt;/a&gt;, tagging, commitments, and making GPU-hours visible.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Practice the container layer:&lt;/strong&gt; the &lt;a href="https://thesimplifiedtech.com/labs/kubectl" rel="noopener noreferrer"&gt;kubectl lab&lt;/a&gt; and &lt;a href="https://thesimplifiedtech.com/labs/docker" rel="noopener noreferrer"&gt;Docker lab&lt;/a&gt; to get comfortable with deployments, node selectors, and resource requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Follow the full track:&lt;/strong&gt; the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer path&lt;/a&gt; for the foundation-to-senior progression these GPU topics sit on top of.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/ai-gpu-infrastructure-on-the-cloud" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>ai</category>
    </item>
    <item>
      <title>Advanced Cloud Networking: PrivateLink, Hybrid &amp; DNS</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Wed, 04 Nov 2026 18:20:50 +0000</pubDate>
      <link>https://dev.to/sri2614/advanced-cloud-networking-privatelink-hybrid-dns-1p32</link>
      <guid>https://dev.to/sri2614/advanced-cloud-networking-privatelink-hybrid-dns-1p32</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Go past the basic VPC: connect privately to services with PrivateLink, choose peering versus Transit Gateway, link on-prem over VPN or Direct Connect, and make DNS actually resolve across the boundary.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The wall you hit after the VPC works&lt;/li&gt;
&lt;li&gt;One idea: connectivity is plumbing, not magic&lt;/li&gt;
&lt;li&gt;The picture: services, VPCs, and on-prem&lt;/li&gt;
&lt;li&gt;Private connectivity to services (PrivateLink / PSC)&lt;/li&gt;
&lt;li&gt;VPC peering vs Transit Gateway&lt;/li&gt;
&lt;li&gt;Hybrid connectivity (VPN / Direct Connect / ExpressRoute)&lt;/li&gt;
&lt;li&gt;Build it: a PrivateLink endpoint + private DNS zone&lt;/li&gt;
&lt;li&gt;How DNS actually resolves across the boundary&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The wall you hit after the VPC works
&lt;/h2&gt;

&lt;p&gt;You built a VPC. Subnets are carved up, route tables are clean, the NAT gateway works, and your app reaches the internet. Then a real requirement lands: "Reach the managed database, but never over the public internet." "Connect this VPC to four others without a tangle of peerings." "Let the on-prem payroll system call our internal API." "Make &lt;code&gt;db.internal.acme.com&lt;/code&gt; resolve the same from a Lambda, an EC2 box, and a server in the data center." Suddenly the basic VPC mental model runs out of road.&lt;/p&gt;

&lt;p&gt;This is the layer where cloud networking stops being about one VPC and starts being about &lt;strong&gt;connectivity between things&lt;/strong&gt;, services, VPCs, and your own data center, plus the &lt;strong&gt;DNS&lt;/strong&gt; that ties them together. Get it right and traffic stays private, predictable, and cheap. Get it wrong and you either expose internal systems to the internet or spend a day staring at a name that won't resolve.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Engineers who already understand a single VPC (subnets, route tables, security groups) and now need private service access, multi-VPC topologies, hybrid links to on-prem, and DNS that works across all of it. New to VPCs? Start with &lt;a href="https://thesimplifiedtech.com/blog/cloud-networking-fundamentals-vpc-explained" rel="noopener noreferrer"&gt;Cloud Networking Fundamentals: How a VPC Actually Works&lt;/a&gt; first.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  One idea: connectivity is plumbing, not magic
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Advanced cloud networking is just deciding which pipes connect which buildings, and making sure every building uses the same phone book.&lt;/p&gt;

&lt;p&gt;The whole article in one line&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every option below is a different shape of pipe, and DNS is the shared phone book. Before the cloud-specific names overwhelm you, anchor on the physical picture:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A private hallway between two adjacent offices&lt;/td&gt;
&lt;td&gt;VPC peering, direct, 1:1, non-transitive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A central transit hub every office connects to once&lt;/td&gt;
&lt;td&gt;Transit Gateway, hub-and-spoke for many VPCs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A service window into a shop, no street access&lt;/td&gt;
&lt;td&gt;PrivateLink / Private Service Connect, reach one service privately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;An armored tunnel to your old headquarters&lt;/td&gt;
&lt;td&gt;VPN / Direct Connect / ExpressRoute, hybrid to on-prem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The shared phone book every building trusts&lt;/td&gt;
&lt;td&gt;Private DNS zones, internal names that resolve everywhere&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Cloud networking primitives mapped to a city of buildings.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: services, VPCs, and on-prem
&lt;/h2&gt;

&lt;p&gt;Here is the topology most senior cloud engineers end up building. An application VPC reaches a managed service privately through PrivateLink, connects to other VPCs through a Transit Gateway, and reaches the on-prem data center over Direct Connect or a VPN, while a private DNS resolver makes internal names resolve from every side.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI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nBjCiAgbl9hcHB2cGMgLS0-fCJwcml2YXRlIEROUyBuYW1lInwgbl9lbmRwb2ludAogIG5fZW5kcG9pbnQgLS0-fCJQcml2YXRlTGluayJ8IG5fc2VydmljZQogIG5fYXBwdnBjIC0uLT58InF1ZXJpZXMifCBuX3Jlc29sdmVyCiAgbl9yZXNvbHZlciAtLi0-fCJmb3J3YXJkIHpvbmUifCBuX29ucHJlbQ%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcHV0ZSBmaWxsOi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lcnZpY2UgZGF0YTsKICBuX3BlZXJ2cGMoIlNoYXJlZC1TdmNzIFZQQzxici8-MTAuMS4wLjAvMTYiKQogIGNsYXNzIG5fcGVlcnZwYyBjb21wdXRlOwogIG5fcmVzb2x2ZXIoIlByaXZhdGUgUmVzb2x2ZXI8YnIvPlJvdXRlIDUzIC8gQ2xvdWQgRE5TIikKICBjbGFzcyBuX3Jlc29sdmVyIG9ic2VydmFiaWxpdHk7CiAgbl9vbnByZW0gLS0-fCJwcml2YXRlIGNpcmN1aXQifCBuX2R4CiAgbl9keCAtLT58IkJHUCByb3V0ZXMifCBuX3RndwogIG5fdGd3IC0tPnwiYXR0YWNobWVudCJ8IG5fYXBwdnBjCiAgbl90Z3cgLS0-fCJhdHRhY2htZW50Inwgbl9wZWVydnBjCiAgbl9hcHB2cGMgLS0-fCJwcml2YXRlIEROUyBuYW1lInwgbl9lbmRwb2ludAogIG5fZW5kcG9pbnQgLS0-fCJQcml2YXRlTGluayJ8IG5fc2VydmljZQogIG5fYXBwdnBjIC0uLT58InF1ZXJpZXMifCBuX3Jlc29sdmVyCiAgbl9yZXNvbHZlciAtLi0-fCJmb3J3YXJkIHpvbmUifCBuX29ucHJlbQ%3FbgColor%3D0d1017%26type%3Dpng" alt="App VPC reaches a service via PrivateLink, peers VPCs through a Transit Gateway, links on-prem via Direct Connect/VPN, a" width="1729" height="315"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;App VPC reaches a service via PrivateLink, peers VPCs through a Transit Gateway, links on-prem via Direct Connect/VPN, and resolves internal names via a private resolver.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;App makes a request to db.internal.acme.com&lt;/strong&gt;: The app does not know or care whether the target is a managed service, another VPC, or on-prem. It just resolves a name.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The private resolver answers&lt;/strong&gt;: A private hosted zone returns a private IP, the PrivateLink endpoint's ENI, a peer VPC address, or (via a forwarding rule) an on-prem record.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traffic takes a private pipe&lt;/strong&gt;: PrivateLink for a single service, the Transit Gateway for VPC-to-VPC, or Direct Connect/VPN for on-prem. Nothing crosses the public internet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return path mirrors it&lt;/strong&gt;: Route tables on both ends must point back the right way. Asymmetric routing, out one pipe, back another, is the silent killer here.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Private connectivity to services (PrivateLink / PSC)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;PrivateLink&lt;/strong&gt; (AWS) and &lt;strong&gt;Private Service Connect&lt;/strong&gt; (GCP) solve one precise problem: reach a &lt;em&gt;single service&lt;/em&gt; over private IP space without peering whole networks together. The provider exposes the service behind a load balancer; you create an &lt;strong&gt;endpoint&lt;/strong&gt; in your VPC that materializes as a network interface (an ENI) with a private IP in your own subnet. Your traffic to that IP is tunneled to the service, no internet gateway, no public IP, no route changes between networks.&lt;/p&gt;

&lt;p&gt;The win over peering is &lt;strong&gt;isolation and scale&lt;/strong&gt;. Peering joins entire address spaces and forces you to manage overlapping CIDRs and bidirectional trust. PrivateLink exposes &lt;em&gt;only the one service&lt;/em&gt; and is one-directional, the consumer reaches the provider, never the reverse. It is how you consume a SaaS vendor, another team's internal API, or an AWS service (S3, Secrets Manager) without your packets ever touching public routes. The trade-off: it is per-service, so it does not replace VPC-to-VPC routing for general traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  VPC peering vs Transit Gateway
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;VPC peering&lt;/strong&gt; is a direct, point-to-point link between two VPCs. It is cheap and low-latency, but it is &lt;strong&gt;non-transitive&lt;/strong&gt;: if A peers with B and B peers with C, A still cannot reach C. With N VPCs that all need to talk, you face N·(N-1)/2 peerings, a full mesh that becomes unmanageable past a handful.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transit Gateway&lt;/strong&gt; (AWS) / &lt;strong&gt;Cloud Router + VPC peering hubs&lt;/strong&gt; (GCP) is a hub-and-spoke router. Each VPC attaches once to the hub, and the hub routes between all of them, and to on-prem over the same attachment model. It costs more (per-attachment and per-GB) and adds a hop, but it turns an O(N²) mesh into O(N) attachments and gives you one place to apply route tables and segmentation. Rule of thumb: 2-3 VPCs that rarely change, use peering; a growing fleet or anything hybrid, use a Transit Gateway.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;Joins&lt;/th&gt;
&lt;th&gt;Transitive?&lt;/th&gt;
&lt;th&gt;Best when&lt;/th&gt;
&lt;th&gt;Watch out for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;VPC Peering&lt;/td&gt;
&lt;td&gt;Two VPCs, full CIDRs&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;2-3 stable VPCs, lowest cost/latency&lt;/td&gt;
&lt;td&gt;Mesh explosion; overlapping CIDRs block it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Transit Gateway&lt;/td&gt;
&lt;td&gt;Many VPCs + on-prem via a hub&lt;/td&gt;
&lt;td&gt;Yes (per route table)&lt;/td&gt;
&lt;td&gt;Growing fleet, central segmentation, hybrid&lt;/td&gt;
&lt;td&gt;Per-attachment + data cost; extra hop&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PrivateLink / PSC&lt;/td&gt;
&lt;td&gt;Consumer → one service&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;Consume a SaaS/internal API/AWS service privately&lt;/td&gt;
&lt;td&gt;Per-service only; one-directional&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;VPN / Direct Connect&lt;/td&gt;
&lt;td&gt;Cloud ↔ on-prem&lt;/td&gt;
&lt;td&gt;Via TGW/router&lt;/td&gt;
&lt;td&gt;Reaching the data center&lt;/td&gt;
&lt;td&gt;VPN = internet-dependent; DX = lead time + cost&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Pick the connectivity pattern by what you are actually joining.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Hybrid connectivity (VPN / Direct Connect / ExpressRoute)
&lt;/h2&gt;

&lt;p&gt;Hybrid means joining your cloud network to your physical data center. Two grades exist. A &lt;strong&gt;site-to-site VPN&lt;/strong&gt; runs an encrypted IPsec tunnel over the public internet, fast to stand up, cheap, but latency and throughput ride on the open internet, so it varies. &lt;strong&gt;Direct Connect&lt;/strong&gt; (AWS) / &lt;strong&gt;ExpressRoute&lt;/strong&gt; (Azure) / &lt;strong&gt;Cloud Interconnect&lt;/strong&gt; (GCP) is a &lt;em&gt;dedicated private circuit&lt;/em&gt; from a carrier into the cloud provider, consistent latency, higher bandwidth, lower per-GB cost at scale, but weeks of lead time and a monthly port fee.&lt;/p&gt;

&lt;p&gt;The common production pattern is &lt;strong&gt;both&lt;/strong&gt;: Direct Connect as the primary path for predictable performance, with a VPN as automatic failover if the circuit drops. Routes are usually exchanged via &lt;strong&gt;BGP&lt;/strong&gt;, so each side learns the other's prefixes dynamically, which is exactly why your CIDR planning has to be disjoint from day one (more on that in mistakes).&lt;/p&gt;

&lt;h2&gt;
  
  
  Build it: a PrivateLink endpoint + private DNS zone
&lt;/h2&gt;

&lt;p&gt;Here is a minimal Terraform setup: an interface endpoint (PrivateLink) for a service, plus a private hosted zone so a friendly internal name resolves to it. Scope this to your VPC and private subnets.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;privatelink.tf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Interface VPC endpoint (PrivateLink) into the provider's service&lt;/span&gt;
&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc_endpoint"&lt;/span&gt; &lt;span class="s2"&gt;"svc"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt;              &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;service_name&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"com.amazonaws.vpce.eu-west-1.vpce-svc-0abc123"&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_endpoint_type&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Interface"&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_ids&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;private&lt;/span&gt;&lt;span class="p"&gt;[*].&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;security_group_ids&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="nx"&gt;private_dns_enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# service's own DNS name now resolves to the ENI&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"svc-privatelink"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Lock the endpoint down: only the app tier may reach it on 443&lt;/span&gt;
&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_security_group"&lt;/span&gt; &lt;span class="s2"&gt;"endpoint"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"privatelink-endpoint"&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;ingress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;from_port&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;
    &lt;span class="nx"&gt;to_port&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;
    &lt;span class="nx"&gt;protocol&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tcp"&lt;/span&gt;
    &lt;span class="nx"&gt;security_groups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;private-dns.tf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Private hosted zone, internal names that never leak to public DNS&lt;/span&gt;
&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_zone"&lt;/span&gt; &lt;span class="s2"&gt;"internal"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"internal.acme.com"&lt;/span&gt;

  &lt;span class="nx"&gt;vpc&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="c1"&gt;# zone is only visible inside this VPC&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Friendly alias pointing at the PrivateLink endpoint&lt;/span&gt;
&lt;span class="nx"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_record"&lt;/span&gt; &lt;span class="s2"&gt;"db"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;zone_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_route53_zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;zone_id&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"db.internal.acme.com"&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"A"&lt;/span&gt;

  &lt;span class="nx"&gt;alias&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;name&lt;/span&gt;                   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc_endpoint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dns_entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s2"&gt;"dns_name"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nx"&gt;zone_id&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_vpc_endpoint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dns_entry&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s2"&gt;"hosted_zone_id"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nx"&gt;evaluate_target_health&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Verify before you trust it:&lt;/strong&gt; From an instance inside the VPC, run &lt;code&gt;dig db.internal.acme.com&lt;/code&gt;, it must return a &lt;strong&gt;private&lt;/strong&gt; (RFC 1918) address, not a public one. Then &lt;code&gt;nc -vz db.internal.acme.com 443&lt;/code&gt;. If dig returns a public IP, your private DNS or &lt;code&gt;private_dns_enabled&lt;/code&gt; isn't wired up.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How DNS actually resolves across the boundary
&lt;/h2&gt;

&lt;p&gt;DNS is where hybrid setups quietly fall apart, because there are &lt;em&gt;three&lt;/em&gt; name spaces, cloud private zones, on-prem internal zones, and the public internet, and every resolver has to know which one to ask for a given name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Private hosted zones
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;private zone&lt;/strong&gt; (Route 53 private hosted zone / Cloud DNS private zone) is a DNS zone visible only inside the VPCs you associate with it. &lt;code&gt;db.internal.acme.com&lt;/code&gt; resolves to a private IP for anything in the VPC and does not exist on the public internet. This is how you give services stable internal names without ever exposing them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Split-horizon (split-brain) DNS
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Split-horizon&lt;/strong&gt; means the &lt;em&gt;same name&lt;/em&gt; returns &lt;em&gt;different answers&lt;/em&gt; depending on who asks. &lt;code&gt;api.acme.com&lt;/code&gt; resolves to a private endpoint when queried from inside the VPC, and to a public load balancer when queried from the internet. You achieve it by running a public zone and a private zone for the same domain; the private zone wins for in-VPC queries. It is powerful, one hostname everywhere, but it is the single most confusing failure mode when someone debugs from the wrong network and gets the "other" answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resolution across hybrid
&lt;/h3&gt;

&lt;p&gt;For cloud and on-prem to resolve each other's names you need a &lt;strong&gt;resolver with forwarding rules&lt;/strong&gt;: an inbound endpoint so on-prem can query cloud names, and an outbound endpoint with a &lt;strong&gt;conditional forwarder&lt;/strong&gt; that says "send &lt;code&gt;*.corp.local&lt;/code&gt; queries to the on-prem DNS server at 10.10.0.53." Without these, an instance in AWS asking for an on-prem hostname gets NXDOMAIN even though the network path is wide open.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Overlapping CIDRs.&lt;/strong&gt; Two VPCs (or a VPC and on-prem) using &lt;code&gt;10.0.0.0/16&lt;/code&gt; &lt;em&gt;cannot&lt;/em&gt; be peered or routed together, routing is ambiguous. Plan a disjoint IP address scheme across every VPC and data center &lt;em&gt;before&lt;/em&gt; you build anything. This is the #1 retrofit nightmare.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exposing internal services publicly.&lt;/strong&gt; Reaching for a public load balancer or a &lt;code&gt;0.0.0.0/0&lt;/code&gt; security-group rule because "it was faster than PrivateLink." Internal APIs and databases should only ever be reachable over private paths, PrivateLink, peering, or the Transit Gateway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS works in cloud, fails to on-prem (or vice versa).&lt;/strong&gt; Network path is open but names won't resolve, because there is no conditional forwarder / resolver endpoint bridging the two name spaces. Always test resolution &lt;em&gt;from both sides&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split-horizon confusion.&lt;/strong&gt; Debugging &lt;code&gt;api.acme.com&lt;/code&gt; from your laptop (public answer) while the app inside the VPC gets the private answer, and concluding the app is broken. Always check which network the failing query came from.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asymmetric routing.&lt;/strong&gt; Traffic leaves over the Transit Gateway and tries to return over a VPN, or the return route table never got the peer's CIDR. Stateful firewalls drop the reply. Confirm route tables point back symmetrically on both ends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Peering mesh sprawl.&lt;/strong&gt; Adding the fifth, sixth, seventh peering by hand until nobody can reason about the topology. Move to a Transit Gateway hub the moment you outgrow a handful of VPCs.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Advanced networking = choosing pipes between services, VPCs, and on-prem, plus a shared DNS phone book.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PrivateLink / PSC&lt;/strong&gt;: reach one service privately, one-directional, no CIDR entanglement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Peering&lt;/strong&gt;: cheap, direct, 1:1, non-transitive, fine for 2-3 stable VPCs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transit Gateway&lt;/strong&gt;: hub-and-spoke that scales VPC-to-VPC and hybrid; turns O(N²) into O(N).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VPN&lt;/strong&gt; = quick internet-based tunnel; &lt;strong&gt;Direct Connect/ExpressRoute&lt;/strong&gt; = dedicated private circuit. Often both, with VPN as failover.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private zones&lt;/strong&gt; hide internal names; &lt;strong&gt;split-horizon&lt;/strong&gt; serves the same name differently per network; &lt;strong&gt;forwarding rules&lt;/strong&gt; bridge cloud and on-prem.&lt;/li&gt;
&lt;li&gt;Plan &lt;strong&gt;disjoint CIDRs&lt;/strong&gt; first, keep internal services off public paths, and test DNS from &lt;em&gt;both&lt;/em&gt; sides.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;Build the muscle memory hands-on, then zoom out to how this fits a real multi-account organization.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Practice routing, endpoints, and resolution in the &lt;a href="https://thesimplifiedtech.com/labs/networking" rel="noopener noreferrer"&gt;Networking lab&lt;/a&gt; and the &lt;a href="https://thesimplifiedtech.com/labs/networking-dns" rel="noopener noreferrer"&gt;DNS lab&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Solidify the basics first if any of this felt shaky: &lt;a href="https://thesimplifiedtech.com/blog/cloud-networking-fundamentals-vpc-explained" rel="noopener noreferrer"&gt;Cloud Networking Fundamentals: How a VPC Actually Works&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;See where these VPCs and connectivity live in a real org: &lt;a href="https://thesimplifiedtech.com/blog/multi-account-landing-zones-governance" rel="noopener noreferrer"&gt;Multi-Account / Landing Zone Strategy &amp;amp; Governance&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Map the full journey on the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer career path&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/advanced-cloud-networking-privatelink-hybrid-dns" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>networking</category>
    </item>
    <item>
      <title>CDN &amp; Edge Compute: Serving Content and Running Code Close to Users</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Mon, 02 Nov 2026 20:35:44 +0000</pubDate>
      <link>https://dev.to/sri2614/cdn-edge-compute-serving-content-and-running-code-close-to-users-4cje</link>
      <guid>https://dev.to/sri2614/cdn-edge-compute-serving-content-and-running-code-close-to-users-4cje</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Cut the 3,000-mile round trip by caching assets at the edge and running code close to users. The decisive skills: getting cache-control and TTL right, and handling &lt;strong&gt;invalidation&lt;/strong&gt;, the genuinely hard part.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The 3,000-mile round trip&lt;/li&gt;
&lt;li&gt;The mental model&lt;/li&gt;
&lt;li&gt;The picture: a request through the edge&lt;/li&gt;
&lt;li&gt;Where each kind of work belongs&lt;/li&gt;
&lt;li&gt;Caching in practice: cache-control and a tiny edge function&lt;/li&gt;
&lt;li&gt;Cache invalidation: the hard part&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The 3,000-mile round trip
&lt;/h2&gt;

&lt;p&gt;Your origin server lives in one place, say, a data center in Virginia. A user in Sydney requests your homepage. That request crosses an ocean, hits your server, and the response crosses back. Even at the speed of light through fiber, that round trip is &lt;strong&gt;~250ms before your app does any work&lt;/strong&gt;. Add a few more round trips for images, scripts, and fonts, and the page feels sluggish, not because your code is slow, but because the data is simply &lt;em&gt;far away&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;CDN&lt;/strong&gt; (Content Delivery Network) fixes the distance problem by keeping copies of your content in hundreds of locations worldwide, so the Sydney user is served from a server in Sydney. &lt;strong&gt;Edge compute&lt;/strong&gt; takes the next step: it lets you run small bits of code at those same locations, so even dynamic logic happens close to the user instead of 3,000 miles away.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Developers and junior cloud engineers who ship a web app or API and want it to feel fast everywhere, not just near the origin. If you've heard "just put a CDN in front of it" and weren't sure what that actually does (or why your dynamic pages broke when you did), this is for you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The mental model
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A CDN is a globe-spanning cache that serves your content from wherever the user is; edge compute is the ability to run code in that same cache, so decisions happen near the user instead of at the origin.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The central warehouse holding all stock&lt;/td&gt;
&lt;td&gt;Your origin server, the source of truth&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local corner shops in every neighborhood&lt;/td&gt;
&lt;td&gt;Edge PoPs (Points of Presence) worldwide&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Popular items kept on the shop shelf&lt;/td&gt;
&lt;td&gt;Cached assets (cache hit, served locally, fast)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shop is out, so it phones the warehouse&lt;/td&gt;
&lt;td&gt;Cache miss, PoP fetches from origin, then caches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Sell-by" date on each item&lt;/td&gt;
&lt;td&gt;TTL, how long the cached copy stays fresh&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A clerk who can answer simple questions on the spot&lt;/td&gt;
&lt;td&gt;Edge function, small compute running at the PoP&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;A CDN is a chain of local corner shops, restocked from one central warehouse.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The whole game is &lt;strong&gt;moving work and data closer to the user&lt;/strong&gt;. The further down the list you can answer a request, at the shop instead of the warehouse, the faster and cheaper it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: a request through the edge
&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcHV0ZSBmaWxsOiMwNzI3MmEsc3Ryb2tlOiMyMmI4YjAsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojN2ZlOWRmOwogIGNsYXNzRGVm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Im1pc3Mg4oaSIGZldGNoInwgbl9vcmlnaW4KICBuX29yaWdpbiAtLT58InF1ZXJ5Inwgbl9kYg%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcHV0ZSBmaWxsOiMwNzI3MmEsc3Ryb2tlOiMyMmI4YjAsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojN2ZlOWRmOwogIGNsYXNzRGVmIGRhdGEgZmlsbDojMmExNTA4LHN0cm9rZTojZjk3MzE2LHN0cm9rZS13aWR0aD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J5Inwgbl9kYg%3FbgColor%3D0d1017%26type%3Dpng" alt="A user hits the nearest PoP. A cache hit returns instantly; a miss fetches from origin. An edge function runs at the PoP" width="1021" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A user hits the nearest PoP. A cache hit returns instantly; a miss fetches from origin. An edge function runs at the PoP itself.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;User hits the nearest PoP&lt;/strong&gt;: DNS (or anycast routing) sends the request to the geographically closest Point of Presence, not your origin. This is the first big latency win.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PoP checks its cache&lt;/strong&gt;: It builds a cache key (usually method + host + path, sometimes query string or headers) and looks for a fresh copy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache hit → served locally&lt;/strong&gt;: If a fresh copy exists, the PoP returns it immediately. The origin never even hears about this request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache miss → fetch from origin&lt;/strong&gt;: No fresh copy? The PoP requests it from the origin, streams it back to the user, and stores a copy for the next visitor, governed by the response's cache headers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge function runs at the PoP (optional)&lt;/strong&gt;: For requests that need logic, auth checks, redirects, A/B routing, personalization, a small function executes at the PoP, often without touching the origin at all.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where each kind of work belongs
&lt;/h2&gt;

&lt;p&gt;The edge is fantastic for some things and useless for others. The deciding question is almost always: &lt;strong&gt;can this be cached or computed without the origin's data?&lt;/strong&gt; Here's the rough map.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;At the edge (PoP)&lt;/th&gt;
&lt;th&gt;At the origin&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Static, public, read-heavy content&lt;/td&gt;
&lt;td&gt;Dynamic, private, write-heavy logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Static assets (JS, CSS, images, video)&lt;/td&gt;
&lt;td&gt;Cache aggressively, long TTL, served from PoP&lt;/td&gt;
&lt;td&gt;Origin only on first miss&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dynamic / personalized HTML&lt;/td&gt;
&lt;td&gt;Risky, cache only with care (vary keys, short TTL)&lt;/td&gt;
&lt;td&gt;Default home, render per request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Edge function&lt;/td&gt;
&lt;td&gt;Auth gate, redirects, geo-routing, A/B, header rewrites&lt;/td&gt;
&lt;td&gt;Heavy business logic, transactions, ORM queries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data access&lt;/td&gt;
&lt;td&gt;None or a tiny edge KV / read replica&lt;/td&gt;
&lt;td&gt;Full database, object store, internal services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency&lt;/td&gt;
&lt;td&gt;~10-40ms (close to user)&lt;/td&gt;
&lt;td&gt;Tens to hundreds of ms (one location)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost driver&lt;/td&gt;
&lt;td&gt;Requests + egress; minimize origin trips&lt;/td&gt;
&lt;td&gt;Compute + DB time per request&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;What lives where, and why.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Tip:&lt;/strong&gt; Rule of thumb: &lt;strong&gt;cache what's the same for everyone, compute at the origin what's unique to one user.&lt;/strong&gt; Edge functions sit in between, use them for fast, stateless decisions, not for your whole backend.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Caching in practice: cache-control and a tiny edge function
&lt;/h2&gt;

&lt;p&gt;The CDN doesn't guess how long to cache, &lt;em&gt;your response headers tell it&lt;/em&gt;. The single most important header is &lt;code&gt;Cache-Control&lt;/code&gt;. Get it right and the edge does the heavy lifting; get it wrong and you either serve stale data or never cache at all.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;response headers&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;# A static asset with a content hash in its name, cache forever.
# "immutable" tells the browser not to even revalidate.
Cache-Control: public, max-age=31536000, immutable

# An HTML page that can be served stale briefly while refreshing
# in the background (great for read-heavy pages).
Cache-Control: public, max-age=60, stale-while-revalidate=300

# Private, per-user content, never cache at a shared PoP.
Cache-Control: private, no-store
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;max-age=N&lt;/code&gt;&lt;/strong&gt;, how long (seconds) the copy is fresh. This is your TTL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;public&lt;/code&gt; vs &lt;code&gt;private&lt;/code&gt;&lt;/strong&gt;, &lt;code&gt;public&lt;/code&gt; may be cached by shared CDN PoPs; &lt;code&gt;private&lt;/code&gt; means only the user's own browser may cache it (never the edge).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;no-store&lt;/code&gt;&lt;/strong&gt;, do not cache anywhere. Use for anything sensitive or truly per-request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;stale-while-revalidate=N&lt;/code&gt;&lt;/strong&gt;, serve the stale copy instantly for N extra seconds while fetching a fresh one in the background. Users never wait on the miss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;immutable&lt;/code&gt;&lt;/strong&gt;, the content at this URL will never change (use with hashed filenames like &lt;code&gt;app.9f3a2.js&lt;/code&gt;), so skip revalidation entirely.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now a tiny &lt;strong&gt;edge function&lt;/strong&gt;. This one runs at every PoP, redirects EU visitors to a regional path, and adds a security header, all without a round trip to the origin. The exact API varies by provider (Cloudflare Workers, Vercel Edge, Lambda@Edge), but the shape is the same: read the request, decide, respond or pass through.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;edge-function.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Runs at the PoP, milliseconds from the user.&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;country&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cf-ipcountry&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;US&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Geo-redirect EU users, decided at the edge, no origin hop.&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;EU&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DE&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;FR&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;NL&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ES&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;IT&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;EU&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;country&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/eu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pathname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/eu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mi"&gt;302&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Otherwise fetch (cached) origin content and harden the response.&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Headers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-Frame-Options&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;DENY&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;headers&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what this function does &lt;em&gt;not&lt;/em&gt; do: it doesn't query a database, run an ORM, or hold state. Edge runtimes are deliberately lightweight (small CPU/memory budgets, short execution limits). That constraint is the point, it's what keeps them fast and cheap to run in hundreds of places at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cache invalidation: the hard part
&lt;/h2&gt;

&lt;p&gt;There's an old joke that the two hardest problems in computer science are naming things, cache invalidation, and off-by-one errors. Caching is easy; &lt;em&gt;knowing when the cached copy is wrong&lt;/em&gt; is the hard part. You have three main tools.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;TTL expiry (let it lapse).&lt;/strong&gt; The cleanest option: set a sensible &lt;code&gt;max-age&lt;/code&gt; and let copies expire on their own. No action needed, but stale data lives for up to one TTL. Great for content that tolerates being a little behind.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache busting (change the URL).&lt;/strong&gt; Put a content hash in the filename (&lt;code&gt;app.9f3a2.js&lt;/code&gt;). When the file changes, the URL changes, so the old cache entry is simply never requested again. This is why you can cache hashed assets &lt;code&gt;immutable&lt;/code&gt; for a year, the standard trick for static builds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Active purge (tell the CDN to forget).&lt;/strong&gt; Call the CDN's purge API to evict a specific path (or a tag, or everything) right now. Use it when you must force-refresh published content immediately, but it's slower to propagate and easy to over-use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;purge.sh&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;# Targeted purge of one path (fast, surgical), preferred.&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"https://api.cdn.example/zones/&lt;/span&gt;&lt;span class="nv"&gt;$ZONE&lt;/span&gt;&lt;span class="s2"&gt;/purge"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{ "files": ["https://site.com/pricing"] }'&lt;/span&gt;

&lt;span class="c"&gt;# Purge everything (the nuclear option), slow to repopulate,&lt;/span&gt;
&lt;span class="c"&gt;# briefly hammers your origin on the cold cache. Avoid as routine.&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="s2"&gt;"https://api.cdn.example/zones/&lt;/span&gt;&lt;span class="nv"&gt;$ZONE&lt;/span&gt;&lt;span class="s2"&gt;/purge"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{ "purge_everything": true }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Warning:&lt;/strong&gt; Prefer &lt;strong&gt;cache busting over purging&lt;/strong&gt; for assets, and &lt;strong&gt;TTL + stale-while-revalidate&lt;/strong&gt; over purging for pages. Reach for active purge only for the genuine "I published something wrong, fix it now" case. A purge-everything on every deploy turns your CDN into a slow proxy.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Caching dynamic or private data.&lt;/strong&gt; Serving a &lt;code&gt;public&lt;/code&gt;-cached page that includes one user's name or cart means the &lt;em&gt;next&lt;/em&gt; visitor gets &lt;em&gt;their&lt;/em&gt; data. If a response varies per user, mark it &lt;code&gt;private&lt;/code&gt; / &lt;code&gt;no-store&lt;/code&gt;, or vary the cache key on the right header.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No TTL strategy.&lt;/strong&gt; Leaving headers to defaults means either nothing caches (every request hits the origin, you gained nothing) or everything caches too long (users see stale content for days). Decide a TTL per content type, on purpose.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heavy compute at the edge.&lt;/strong&gt; Edge runtimes have tight CPU and time budgets. Pushing a full render, big dependencies, or chatty database calls to the edge gives you the &lt;em&gt;worst&lt;/em&gt; of both worlds: slow functions far from your data. Keep edge logic small and stateless.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting the &lt;code&gt;Vary&lt;/code&gt; header.&lt;/strong&gt; If a response legitimately differs by &lt;code&gt;Accept-Encoding&lt;/code&gt;, &lt;code&gt;Accept-Language&lt;/code&gt;, or auth, but you don't tell the CDN, it will serve one cached variant to everyone. Set &lt;code&gt;Vary&lt;/code&gt; so the cache key includes what actually matters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Purging everything on every deploy.&lt;/strong&gt; It feels safe, but it cold-starts the entire cache and stampedes your origin. Use hashed filenames so deploys need no purge at all.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A CDN serves copies of your content from PoPs near the user; a cache hit never touches your origin.&lt;/li&gt;
&lt;li&gt;Edge compute runs small, stateless code at those PoPs for fast decisions close to the user.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Cache-Control&lt;/code&gt; headers, &lt;code&gt;max-age&lt;/code&gt;, &lt;code&gt;public&lt;/code&gt;/&lt;code&gt;private&lt;/code&gt;, &lt;code&gt;stale-while-revalidate&lt;/code&gt;, &lt;code&gt;immutable&lt;/code&gt;, &lt;em&gt;are&lt;/em&gt; your caching policy.&lt;/li&gt;
&lt;li&gt;Cache what's the same for everyone; compute per-user logic at the origin.&lt;/li&gt;
&lt;li&gt;Invalidate by TTL expiry, cache busting (hashed URLs), or active purge, in that order of preference.&lt;/li&gt;
&lt;li&gt;The edge wins for static, public, read-heavy content; the origin owns dynamic, private, write-heavy work.&lt;/li&gt;
&lt;li&gt;The edge isn't a place to move your backend, it's a place to answer the easy questions before the hard ones reach home.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;The edge is one layer of a fast, global system. Two siblings pair naturally with this one: the gateway that sits in front of your services, and a real-world case study of edge-scale delivery.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://thesimplifiedtech.com/blog/api-gateways-and-the-edge" rel="noopener noreferrer"&gt;API Gateways &amp;amp; the Edge&lt;/a&gt;, the control point that authenticates, routes, and rate-limits requests as they enter your platform.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://thesimplifiedtech.com/blog/how-netflix-built-streaming-pipeline" rel="noopener noreferrer"&gt;How Netflix Streams to 200 Million Devices Without Breaking&lt;/a&gt;, caching, edge delivery, and CDN strategy at planetary scale.&lt;/li&gt;
&lt;li&gt;Build the foundations on the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer path&lt;/a&gt;, networking, latency, and global architecture in context.&lt;/li&gt;
&lt;li&gt;Practice the request-path fundamentals in the &lt;a href="https://thesimplifiedtech.com/labs/networking" rel="noopener noreferrer"&gt;networking lab&lt;/a&gt; and &lt;a href="https://thesimplifiedtech.com/labs/networking-dns" rel="noopener noreferrer"&gt;DNS lab&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/cdn-and-edge-compute" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>cdn</category>
    </item>
    <item>
      <title>API Gateways &amp; the Edge</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Sun, 01 Nov 2026 16:57:56 +0000</pubDate>
      <link>https://dev.to/sri2614/api-gateways-the-edge-2k39</link>
      <guid>https://dev.to/sri2614/api-gateways-the-edge-2k39</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Give your scattered services one front door. You will know what an API gateway actually handles, which managed options you will meet, and how a WAF guards the edge against the traffic you do not want.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You shipped three services. Now what's the URL?&lt;/li&gt;
&lt;li&gt;One sentence, then a picture in your head&lt;/li&gt;
&lt;li&gt;Where it sits&lt;/li&gt;
&lt;li&gt;What the gateway is actually responsible for&lt;/li&gt;
&lt;li&gt;What a route + rate-limit policy looks like&lt;/li&gt;
&lt;li&gt;Managed options you'll actually meet&lt;/li&gt;
&lt;li&gt;The WAF and the edge&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  You shipped three services. Now what's the URL?
&lt;/h2&gt;

&lt;p&gt;You split your app into a few services, one for auth, one for orders, one for payments. Each runs somewhere, each has its own host and port. Now your mobile app needs to call them. Do you hand the client three different URLs? Who checks the token? Who stops a bad actor from hammering the login endpoint 10,000 times a second? Who adds CORS headers, strips the internal &lt;code&gt;X-Debug&lt;/code&gt; header, and caches that one expensive response?&lt;/p&gt;

&lt;p&gt;The honest answer for most teams is: an &lt;strong&gt;API gateway&lt;/strong&gt;. It's the single front door that every request passes through before it reaches a backend service, and once you have one, a whole category of cross-cutting problems stops living in your application code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Junior cloud and backend engineers who have built an API or two and are now staring down multiple services, public traffic, and the question "where does auth and rate limiting actually go?" No prior gateway experience assumed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  One sentence, then a picture in your head
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;An API gateway is a reverse proxy that sits in front of your services and handles routing, authentication, rate limiting, transforms, and caching, so each service doesn't have to.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If that still feels abstract, borrow the hotel. Guests don't wander into the kitchen, the laundry, or the manager's office directly. They walk up to the &lt;strong&gt;front desk&lt;/strong&gt;, and the concierge handles everything from there.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;You check in once at the front desk and get a room key.&lt;/td&gt;
&lt;td&gt;You authenticate once at the gateway and get a token it validates on every later request.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The concierge sends you to the right floor and room.&lt;/td&gt;
&lt;td&gt;The gateway routes /orders to the orders service and /pay to payments.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;One guest can't monopolize the concierge all day.&lt;/td&gt;
&lt;td&gt;Rate limiting caps how many requests one client can make per window.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The desk keeps printed maps ready so it doesn't reprint per guest.&lt;/td&gt;
&lt;td&gt;The gateway caches common responses instead of re-hitting the backend.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A security guard screens people at the entrance.&lt;/td&gt;
&lt;td&gt;A WAF at the edge filters malicious traffic before it even reaches the desk.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;A hotel front desk is an API gateway with a uniform.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it sits
&lt;/h2&gt;

&lt;p&gt;The gateway lives between the public internet and your private services. In front of it, at the very edge, sits a WAF and usually a CDN. Behind it, your services stay on a private network and never take traffic directly from clients.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzI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RnZTsKICBuX2d3KCJBUEkgR2F0ZXdheTxici8-YXV0aG4gwrcgcmF0ZSBsaW1pdCDCtyByb3V0ZSIpCiAgY2xhc3Mgbl9ndyBlZGdlOwogIG5fYXV0aCgiQXV0aCBTZXJ2aWNlPGJyLz5Qcml2YXRlIHN1Ym5ldCIpCiAgY2xhc3Mgbl9hdXRoIGNvbXB1dGU7CiAgbl9vcmRlcnMoIk9yZGVycyBTZXJ2aWNlPGJyLz5Qcml2YXRlIHN1Ym5ldCIpCiAgY2xhc3Mgbl9vcmRlcnMgY29tcHV0ZTsKICBuX3BheSgiUGF5bWVudHMgU2VydmljZTxici8-UHJpdmF0ZSBzdWJuZXQiKQogIGNsYXNzIG5fcGF5IGNvbXB1dGU7CiAgbl9jYWNoZSgiUmVzcG9uc2UgQ2FjaGU8YnIvPkdhdGV3YXktbWFuYWdlZCIpCiAgY2xhc3Mgbl9jYWNoZSBkYXRhOwogIG5fY2xpZW50IC0tPnwiSFRUUFMifCBuX3dhZgogIG5fd2FmIC0tPnwiY2xlYW4gdHJhZmZpYyJ8IG5fZ3cKICBuX2d3IC0tPiBuX2F1dGgKICBuX2d3IC0tPnwicm91dGUifCBuX29yZGVycwogIG5fZ3cgLS0-IG5fcGF5CiAgbl9ndyAtLi0-fCJoaXQvbWlzcyJ8IG5fY2FjaGU%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxN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VudDsKICBuX3dhZigiV0FGPGJyLz5FZGdlIGZpbHRlcmluZyIpCiAgY2xhc3Mgbl93YWYgZWRnZTsKICBuX2d3KCJBUEkgR2F0ZXdheTxici8-YXV0aG4gwrcgcmF0ZSBsaW1pdCDCtyByb3V0ZSIpCiAgY2xhc3Mgbl9ndyBlZGdlOwogIG5fYXV0aCgiQXV0aCBTZXJ2aWNlPGJyLz5Qcml2YXRlIHN1Ym5ldCIpCiAgY2xhc3Mgbl9hdXRoIGNvbXB1dGU7CiAgbl9vcmRlcnMoIk9yZGVycyBTZXJ2aWNlPGJyLz5Qcml2YXRlIHN1Ym5ldCIpCiAgY2xhc3Mgbl9vcmRlcnMgY29tcHV0ZTsKICBuX3BheSgiUGF5bWVudHMgU2VydmljZTxici8-UHJpdmF0ZSBzdWJuZXQiKQogIGNsYXNzIG5fcGF5IGNvbXB1dGU7CiAgbl9jYWNoZSgiUmVzcG9uc2UgQ2FjaGU8YnIvPkdhdGV3YXktbWFuYWdlZCIpCiAgY2xhc3Mgbl9jYWNoZSBkYXRhOwogIG5fY2xpZW50IC0tPnwiSFRUUFMifCBuX3dhZgogIG5fd2FmIC0tPnwiY2xlYW4gdHJhZmZpYyJ8IG5fZ3cKICBuX2d3IC0tPiBuX2F1dGgKICBuX2d3IC0tPnwicm91dGUifCBuX29yZGVycwogIG5fZ3cgLS0-IG5fcGF5CiAgbl9ndyAtLi0-fCJoaXQvbWlzcyJ8IG5fY2FjaGU%3FbgColor%3D0d1017%26type%3Dpng" alt="Clients → WAF (edge) → API gateway → private backend services." width="1154" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Clients → WAF (edge) → API gateway → private backend services.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Request hits the edge&lt;/strong&gt;: The client calls one hostname over HTTPS. The WAF inspects it first and drops anything matching known attack patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway authenticates&lt;/strong&gt;: Clean traffic reaches the gateway, which validates the token or API key. No token, no entry, the backend never sees the request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate limit is checked&lt;/strong&gt;: The gateway counts requests for this client in the current window. Over the limit returns 429 immediately, sparing the backend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route and (maybe) cache&lt;/strong&gt;: The path is matched to a backend route. If a fresh cached response exists, it's returned without touching the service at all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transform and forward&lt;/strong&gt;: The gateway rewrites headers/paths as needed, forwards to the private service, then shapes the response on the way back out.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What the gateway is actually responsible for
&lt;/h2&gt;

&lt;p&gt;The pitch for a gateway is consolidation: every concern below would otherwise be re-implemented (slightly differently, slightly buggily) in each service. Centralize them once.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Why at the gateway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Routing&lt;/td&gt;
&lt;td&gt;Maps an incoming path/host to a backend service&lt;/td&gt;
&lt;td&gt;Clients get one stable URL; you can move or split services behind it freely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Validates tokens, API keys, or mTLS before forwarding&lt;/td&gt;
&lt;td&gt;Reject unauthenticated traffic once, not in every service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rate limiting&lt;/td&gt;
&lt;td&gt;Caps requests per client per time window&lt;/td&gt;
&lt;td&gt;Protects every backend from abuse and runaway clients in one place&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Caching&lt;/td&gt;
&lt;td&gt;Stores and serves common responses&lt;/td&gt;
&lt;td&gt;Cuts latency and backend load without per-service cache code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Transforms&lt;/td&gt;
&lt;td&gt;Rewrites headers, paths, and bodies in/out&lt;/td&gt;
&lt;td&gt;Hide internal shapes; add CORS; strip debug headers consistently&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The five core gateway responsibilities, and why they belong here.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;The rule of thumb:&lt;/strong&gt; Cross-cutting and request-shaped concerns go in the gateway. Anything that needs to know &lt;em&gt;what your business does&lt;/em&gt; stays in the service.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What a route + rate-limit policy looks like
&lt;/h2&gt;

&lt;p&gt;Most gateways are configured declaratively, you describe routes and policies, the gateway enforces them. Here's a vendor-neutral shape: a route for the orders service with JWT auth, a per-client rate limit, and a short response cache.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gateway-route.yaml&lt;/code&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="na"&gt;routes&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;orders&lt;/span&gt;
    &lt;span class="na"&gt;match&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/orders/*&lt;/span&gt;
      &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;GET&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;POST&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;upstream&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;service&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders-service.internal&lt;/span&gt;
      &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8080&lt;/span&gt;
    &lt;span class="na"&gt;policies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="c1"&gt;# 1. Require a valid JWT before forwarding&lt;/span&gt;
      &lt;span class="na"&gt;auth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;jwt&lt;/span&gt;
        &lt;span class="na"&gt;issuer&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://auth.example.com&lt;/span&gt;
        &lt;span class="na"&gt;audience&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;orders-api&lt;/span&gt;
        &lt;span class="na"&gt;forward_claims&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;sub&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;scope&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

      &lt;span class="c1"&gt;# 2. 100 requests per minute, per client key&lt;/span&gt;
      &lt;span class="na"&gt;rate_limit&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="m"&gt;100&lt;/span&gt;
        &lt;span class="na"&gt;per&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;minute&lt;/span&gt;
        &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${request.header.X-Client-Id}&lt;/span&gt;
        &lt;span class="na"&gt;on_exceeded&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;429&lt;/span&gt;
          &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Rate&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;limit&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;exceeded.&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;Retry&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;shortly."&lt;/span&gt;

      &lt;span class="c1"&gt;# 3. Cache successful GETs for 30s&lt;/span&gt;
      &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;GET&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
        &lt;span class="na"&gt;ttl&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;30s&lt;/span&gt;
        &lt;span class="na"&gt;vary&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Authorization&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

      &lt;span class="c1"&gt;# 4. Shape the request/response&lt;/span&gt;
      &lt;span class="na"&gt;transform&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;remove_headers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;X-Debug&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;X-Internal-Trace&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
        &lt;span class="na"&gt;response&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;add_headers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;Access-Control-Allow-Origin&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://app.example.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read it top to bottom and you've read the request lifecycle: authenticate, rate limit, serve from cache if possible, transform, forward. No business logic anywhere in here, that's the point.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managed options you'll actually meet
&lt;/h2&gt;

&lt;p&gt;You rarely build a gateway from scratch. Each major cloud has a managed one, and Apigee is the heavyweight cross-cloud option for serious API programs. They differ in polish and price, not in the fundamentals above.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AWS API Gateway&lt;/strong&gt;, deep integration with Lambda and IAM; REST and HTTP APIs; pay-per-request. The default if you're already on AWS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Azure API Management (APIM)&lt;/strong&gt;, strong policy engine (XML-based transforms), a built-in developer portal, and tiered pricing. Common in enterprise Azure shops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Apigee&lt;/strong&gt;, full API &lt;em&gt;management&lt;/em&gt; platform: monetization, analytics, lifecycle, and a polished portal. Heavier and pricier; chosen when APIs are the product.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-managed (Kong, NGINX, Envoy)&lt;/strong&gt;, open-source data planes you run yourself. Maximum control, you own the upgrades, scaling, and on-call.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The WAF and the edge
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Web Application Firewall&lt;/strong&gt; sits one hop in front of the gateway, at the edge of your network. Where the gateway asks "who are you and where are you going?", the WAF asks "does this request look malicious?" It inspects requests against rules, known SQL injection and XSS patterns, suspicious user agents, traffic floods, requests from flagged IP ranges, and drops the bad ones before they cost you anything downstream.&lt;/p&gt;

&lt;p&gt;The edge is also where your &lt;strong&gt;CDN&lt;/strong&gt; lives, terminating TLS close to users and serving static content from points of presence worldwide. WAF rules typically run right there, so an attack is filtered near its origin rather than after crossing the globe to your gateway. For the CDN side of this story, see &lt;a href="https://thesimplifiedtech.com/blog/cdn-and-edge-compute" rel="noopener noreferrer"&gt;CDN &amp;amp; Edge Compute&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Gateway vs WAF, not the same job:&lt;/strong&gt; The WAF is about threat filtering (is this request hostile?). The gateway is about identity and traffic management (who is this, and where should it go?). You want both, in that order.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Business logic in the gateway.&lt;/strong&gt; It's tempting to add "just one" pricing rule or order check in a transform. Now your business logic is split across two systems with different deploy cycles. Keep the gateway dumb about your domain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No rate limiting.&lt;/strong&gt; Without it, one buggy client or one attacker can take down every service behind the gateway at once. Set sane per-client limits from day one, even generous ones.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Treating the gateway as a single point of failure.&lt;/strong&gt; Everything flows through it, so if it's one box, it's &lt;em&gt;the&lt;/em&gt; outage. Run it across multiple instances and availability zones, and health-check it like the critical infrastructure it is.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skipping the WAF because "the gateway has auth."&lt;/strong&gt; Auth checks identity; it does not catch injection or floods. They solve different problems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching authenticated responses without a &lt;code&gt;vary&lt;/code&gt; key.&lt;/strong&gt; Cache a logged-in user's data without varying on their token and you'll serve their data to the next person. Always vary on the auth header.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An API gateway is the single front door: routing, auth, rate limiting, caching, and transforms in one place.&lt;/li&gt;
&lt;li&gt;It lets clients use one stable URL while you reshape services freely behind it.&lt;/li&gt;
&lt;li&gt;Cross-cutting concerns go in the gateway; business logic stays in the service.&lt;/li&gt;
&lt;li&gt;A WAF sits one hop further out at the edge and filters malicious traffic before the gateway sees it.&lt;/li&gt;
&lt;li&gt;Gateway = identity and routing; WAF = threat filtering. Use both.&lt;/li&gt;
&lt;li&gt;Reach for a managed option, AWS API Gateway, Azure APIM, or Apigee, before building your own.&lt;/li&gt;
&lt;li&gt;Always cap rate limits, run the gateway redundantly, and vary cached responses on auth.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;The gateway handles the front door, but the contracts your services expose through it matter just as much. Pair this with the design and edge sides of the picture, then put it into practice on the path.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read &lt;a href="https://thesimplifiedtech.com/blog/secure-api-design" rel="noopener noreferrer"&gt;Secure API Design&lt;/a&gt; for the contract and auth patterns the gateway enforces.&lt;/li&gt;
&lt;li&gt;Read &lt;a href="https://thesimplifiedtech.com/blog/cdn-and-edge-compute" rel="noopener noreferrer"&gt;CDN &amp;amp; Edge Compute&lt;/a&gt; to go deeper on what else lives at the edge.&lt;/li&gt;
&lt;li&gt;Practice routing and proxy concepts in the &lt;a href="https://thesimplifiedtech.com/labs/networking" rel="noopener noreferrer"&gt;networking lab&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Follow the full track on the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer path&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/api-gateways-and-the-edge" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>apigateway</category>
    </item>
    <item>
      <title>Event-Driven Architecture on the Cloud</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Sat, 31 Oct 2026 15:55:14 +0000</pubDate>
      <link>https://dev.to/sri2614/event-driven-architecture-on-the-cloud-p7h</link>
      <guid>https://dev.to/sri2614/event-driven-architecture-on-the-cloud-p7h</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Replace brittle synchronous calls with events, and learn to pick the right building block: queues, pub/sub, or streams. Because delivery is at-least-once, &lt;strong&gt;idempotency&lt;/strong&gt; is the non-negotiable price of admission.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When one slow call takes down everything&lt;/li&gt;
&lt;li&gt;The mental model: a newsroom, not a phone tree&lt;/li&gt;
&lt;li&gt;The picture: one event, many reactions&lt;/li&gt;
&lt;li&gt;Queues vs pub/sub vs streams&lt;/li&gt;
&lt;li&gt;Publishing and consuming an event&lt;/li&gt;
&lt;li&gt;Delivery guarantees: why idempotency is non-negotiable&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;When event-driven beats a synchronous call&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When one slow call takes down everything
&lt;/h2&gt;

&lt;p&gt;You ship an order service. It takes a payment, then calls the email service, then the analytics service, then the warehouse service, one after another, in the same request. It works great in the demo. Then the email provider has a bad afternoon, its API hangs for 30 seconds, and suddenly &lt;strong&gt;customers can't place orders at all&lt;/strong&gt;. Nobody is buying email. They're buying products. But because checkout calls email &lt;em&gt;synchronously&lt;/em&gt;, a hiccup in a non-critical service became an outage in your most critical one.&lt;/p&gt;

&lt;p&gt;The fix isn't a faster email service. It's changing the &lt;em&gt;shape&lt;/em&gt; of the conversation. Instead of checkout calling everyone and waiting, checkout announces "an order was placed" and walks away. Whoever cares, email, analytics, the warehouse, reacts on their own time. That announcement is an &lt;strong&gt;event&lt;/strong&gt;, and designing around it is event-driven architecture.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Developers and junior cloud engineers who can already build a service that calls another service over HTTP, and are starting to feel the pain, cascading failures, slow requests, services that have to know too much about each other. No prior messaging experience needed. We use AWS, GCP, and Azure names, but the ideas are identical everywhere.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The mental model: a newsroom, not a phone tree
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Event-driven architecture means services communicate by emitting and reacting to events, facts about what happened, instead of directly commanding each other.&lt;/p&gt;

&lt;p&gt;The one-sentence version&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Synchronous calls are a phone tree. To tell five teams something, you phone each one, wait for them to pick up, and you're stuck on the line until the last call ends. If one person doesn't answer, you're frozen mid-tree.&lt;/p&gt;

&lt;p&gt;Event-driven is a &lt;strong&gt;newsroom&lt;/strong&gt;. A reporter publishes a story. They don't know, or care, who reads it. Subscribers (the sports desk, the weather team, an archive bot) each pick it up and do their own thing, at their own pace. The reporter's job is done the moment the story is filed. Add a tenth subscriber tomorrow and the reporter's code never changes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A reporter files a story&lt;/td&gt;
&lt;td&gt;A producer publishes an event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The story itself (a fact that happened)&lt;/td&gt;
&lt;td&gt;The event / message payload&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The newswire everyone reads from&lt;/td&gt;
&lt;td&gt;The topic / queue / stream&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The sports &amp;amp; weather desks&lt;/td&gt;
&lt;td&gt;Independent consumers / subscribers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Anyone can start reading the wire tomorrow&lt;/td&gt;
&lt;td&gt;Add a consumer without touching the producer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The newsroom maps cleanly onto the building blocks.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: one event, many reactions
&lt;/h2&gt;

&lt;p&gt;Here's the order flow rebuilt around an event. Checkout publishes once to a topic; the topic fans the event out to every interested consumer. Checkout finishes in milliseconds and is completely unaffected if a downstream consumer is slow or down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight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ic2VydmFiaWxpdHkgZmlsbDojMWEyNzA4LHN0cm9rZTojODRjYzE2LHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2JlZjI2NDsKICBjbGFzc0RlZiBleHRlcm5hbCBmaWxsOiMxYzE5MTcsc3Ryb2tlOiNhOGEyOWUsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojZTdlNWU0OwogIG5fY2hlY2tvdXQoIkNoZWNrb3V0IFNlcnZpY2U8YnIvPlByb2R1Y2VyIikKICBjbGFzcyBuX2NoZWNrb3V0IGNvbXB1dGU7CiAgbl90b3BpYygiT3JkZXJQbGFjZWQgVG9waWM8YnIvPlNOUyAvIFB1Yi1TdWIgLyBFdmVudCBCdXMiKQogIGNsYXNzIG5fdG9waWMgcXVldWU7CiAgbl9lbWFpbCgiRW1haWwgU2VydmljZTxici8-Q29uc3VtZXIiKQogIGNsYXNzIG5fZW1haWwgY29tcHV0ZTsKICBuX3dhcmVob3VzZSgiV2FyZWhvdXNlIFNlcnZpY2U8YnIvPkNvbnN1bWVyIikKICBjbGFzcyBuX3dhcmVob3VzZSBjb21wdXRlOwogIG5fYW5hbHl0aWNzKCJBbmFseXRpY3MgU2luazxici8-Q29uc3VtZXIiKQogIGNsYXNzIG5fYW5hbHl0aWNzIGRhdGE7CiAgbl9jaGVja291dCAtLT58InB1Ymxpc2ggT3JkZXJQbGFjZWQifCBuX3RvcGljCiAgbl90b3BpYyAtLi0-fCJkZWxpdmVyInwgbl9lbWFpbAogIG5fdG9waWMgLS4tPnwiZGVsaXZlciJ8IG5fd2FyZWhvdXNlCiAgbl90b3BpYyAtLi0-fCJkZWxpdmVyInwgbl9hbmFseXRpY3M%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ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Fzc0RlZiBleHRlcm5hbCBmaWxsOiMxYzE5MTcsc3Ryb2tlOiNhOGEyOWUsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojZTdlNWU0OwogIG5fY2hlY2tvdXQoIkNoZWNrb3V0IFNlcnZpY2U8YnIvPlByb2R1Y2VyIikKICBjbGFzcyBuX2NoZWNrb3V0IGNvbXB1dGU7CiAgbl90b3BpYygiT3JkZXJQbGFjZWQgVG9waWM8YnIvPlNOUyAvIFB1Yi1TdWIgLyBFdmVudCBCdXMiKQogIGNsYXNzIG5fdG9waWMgcXVldWU7CiAgbl9lbWFpbCgiRW1haWwgU2VydmljZTxici8-Q29uc3VtZXIiKQogIGNsYXNzIG5fZW1haWwgY29tcHV0ZTsKICBuX3dhcmVob3VzZSgiV2FyZWhvdXNlIFNlcnZpY2U8YnIvPkNvbnN1bWVyIikKICBjbGFzcyBuX3dhcmVob3VzZSBjb21wdXRlOwogIG5fYW5hbHl0aWNzKCJBbmFseXRpY3MgU2luazxici8-Q29uc3VtZXIiKQogIGNsYXNzIG5fYW5hbHl0aWNzIGRhdGE7CiAgbl9jaGVja291dCAtLT58InB1Ymxpc2ggT3JkZXJQbGFjZWQifCBuX3RvcGljCiAgbl90b3BpYyAtLi0-fCJkZWxpdmVyInwgbl9lbWFpbAogIG5fdG9waWMgLS4tPnwiZGVsaXZlciJ8IG5fd2FyZWhvdXNlCiAgbl90b3BpYyAtLi0-fCJkZWxpdmVyInwgbl9hbmFseXRpY3M%3FbgColor%3D0d1017%26type%3Dpng" alt="A producer publishes once; the topic fans the event out to independent consumers (fan-out)." width="797" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A producer publishes once; the topic fans the event out to independent consumers (fan-out).&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Customer clicks Buy&lt;/strong&gt;: Checkout charges the card and persists the order. That part is still synchronous, it must succeed before we promise anything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checkout publishes one event&lt;/strong&gt;: It sends a single OrderPlaced message to the topic with the order id and details, then returns 200 to the customer. Total added latency: a few milliseconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The topic fans out&lt;/strong&gt;: The messaging service delivers a copy to every subscriber, email, warehouse, analytics. Checkout has no idea who they are.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consumers react independently&lt;/strong&gt;: Email sends a receipt. The warehouse reserves stock. Analytics records the sale. If email is down, the warehouse and analytics are unaffected, and email retries later.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Queues vs pub/sub vs streams
&lt;/h2&gt;

&lt;p&gt;"Messaging" is three different patterns wearing the same coat. Picking the wrong one is the most common early mistake, so anchor on these distinctions before you reach for a service.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Queue&lt;/strong&gt;, one message, one worker. The message is consumed and gone. Use it to &lt;em&gt;distribute work&lt;/em&gt;: ten workers pull from one queue and each grabs different items.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pub/Sub&lt;/strong&gt;, one message, every subscriber gets a copy. Use it to &lt;em&gt;broadcast a fact&lt;/em&gt; so multiple systems can react (this is fan-out).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream&lt;/strong&gt;, an append-only log you can replay. Messages aren't deleted on read; consumers track their own position. Use it for &lt;em&gt;ordered history, replay, and analytics&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Queue&lt;/th&gt;
&lt;th&gt;Pub/Sub&lt;/th&gt;
&lt;th&gt;Stream&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Delivery&lt;/td&gt;
&lt;td&gt;1 message → 1 consumer&lt;/td&gt;
&lt;td&gt;1 message → all subscribers&lt;/td&gt;
&lt;td&gt;1 log → many readers, each at own offset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ordering&lt;/td&gt;
&lt;td&gt;Best-effort (FIFO variants exist)&lt;/td&gt;
&lt;td&gt;Usually unordered&lt;/td&gt;
&lt;td&gt;Strong, per-partition order&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fan-out&lt;/td&gt;
&lt;td&gt;No (work is split, not copied)&lt;/td&gt;
&lt;td&gt;Yes, the whole point&lt;/td&gt;
&lt;td&gt;Yes (each consumer reads the full log)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replay&lt;/td&gt;
&lt;td&gt;No, read = gone&lt;/td&gt;
&lt;td&gt;No, miss it, miss it&lt;/td&gt;
&lt;td&gt;Yes, rewind to any offset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Background jobs, task distribution&lt;/td&gt;
&lt;td&gt;Broadcasting events, decoupling&lt;/td&gt;
&lt;td&gt;Event sourcing, metrics, audit trails&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Managed examples&lt;/td&gt;
&lt;td&gt;SQS, Pub/Sub (pull), Service Bus queues&lt;/td&gt;
&lt;td&gt;SNS, EventBridge, Pub/Sub, Service Bus topics&lt;/td&gt;
&lt;td&gt;Kinesis, Kafka / MSK, Event Hubs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The same event needs different plumbing depending on what you want from it.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Queue + pub/sub is the classic combo:&lt;/strong&gt; On AWS the textbook fan-out is SNS → SQS: SNS broadcasts the event, and each consumer has its own SQS queue subscribed to the topic. You get broadcast AND a durable buffer per consumer, so a slow consumer never blocks the others. EventBridge plays the same role with richer routing rules.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Publishing and consuming an event
&lt;/h2&gt;

&lt;p&gt;Concretely, publishing is a one-liner and consuming is a small loop. Here's the SNS → SQS fan-out from the diagram, in Python with &lt;code&gt;boto3&lt;/code&gt;. First, checkout publishes the event:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;publish_order.py&lt;/code&gt;&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;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;sns&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;sns&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;TOPIC_ARN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arn:aws:sns:eu-west-1:123456789012:OrderPlaced&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;publish_order_placed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&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;type&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;OrderPlaced&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;order_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;order_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;customer_email&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;TopicArn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;TOPIC_ARN&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dumps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="c1"&gt;# idempotency: a stable id lets consumers dedupe
&lt;/span&gt;        &lt;span class="n"&gt;MessageAttributes&lt;/span&gt;&lt;span class="o"&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;event_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&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;DataType&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;String&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;StringValue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;order_id&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# checkout returns to the customer right here, no waiting on consumers
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each consumer owns an SQS queue subscribed to that topic. The email worker just polls its queue, does its job, and deletes the message to acknowledge it:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;email_consumer.py&lt;/code&gt;&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;json&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;

&lt;span class="n"&gt;sqs&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;sqs&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;QUEUE_URL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://sqs.eu-west-1.amazonaws.com/123456789012/email-queue&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sqs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;receive_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;QueueUrl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;QUEUE_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;MaxNumberOfMessages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;WaitTimeSeconds&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# long polling, cheaper, less spin
&lt;/span&gt;    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;resp&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;Messages&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[]):&lt;/span&gt;
        &lt;span class="n"&gt;envelope&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Body&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;        &lt;span class="c1"&gt;# SNS wraps the payload
&lt;/span&gt;        &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;envelope&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Message&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;   &lt;span class="c1"&gt;# our actual event
&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;already_processed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
            &lt;span class="nf"&gt;send_receipt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;customer_email&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
            &lt;span class="nf"&gt;mark_processed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;order_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

        &lt;span class="c1"&gt;# delete = acknowledge. Only do this AFTER the work succeeded.
&lt;/span&gt;        &lt;span class="n"&gt;sqs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;QueueUrl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;QUEUE_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ReceiptHandle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ReceiptHandle&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;p&gt;Notice the &lt;code&gt;already_processed&lt;/code&gt; / &lt;code&gt;mark_processed&lt;/code&gt; guard, and that we delete the message only &lt;em&gt;after&lt;/em&gt; the work succeeds. That's not optional decoration, it's the heart of running this safely. Here's why.&lt;/p&gt;

&lt;h2&gt;
  
  
  Delivery guarantees: why idempotency is non-negotiable
&lt;/h2&gt;

&lt;p&gt;Almost every managed messaging service gives you &lt;strong&gt;at-least-once&lt;/strong&gt; delivery. Read that carefully: &lt;em&gt;at least&lt;/em&gt; once. Not exactly once. The same event can, and eventually will, be delivered to your consumer more than once. This isn't a bug; it's the honest trade-off that makes the system reliable.&lt;/p&gt;

&lt;p&gt;It happens for boring, unavoidable reasons. A consumer processes a message, but its acknowledgement gets lost on the network. The broker never hears "done," so after a visibility timeout it redelivers, and now you've sent two receipt emails for one order. The number of guarantees in plain terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;At-most-once&lt;/strong&gt;, fire and forget. Fast, but you can silently lose messages. Rarely what you want.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;At-least-once&lt;/strong&gt;, never lost, sometimes duplicated. The realistic default for SQS, SNS, Pub/Sub, and Kinesis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exactly-once&lt;/strong&gt;, the dream. A few services offer it in narrow conditions (Kafka transactions, SQS FIFO dedup windows), but it's limited and costs throughput. Don't architect around assuming it.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Design for duplicates, not against them:&lt;/strong&gt; Since you'll get duplicates, make your consumers idempotent: processing the same event twice has the same effect as processing it once. Use the event's stable id as a dedup key, record "I've handled order_id X," and skip it if it shows up again. Idempotency turns at-least-once from a liability into a non-issue.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The same instinct covers the &lt;em&gt;other&lt;/em&gt; failure: a message your consumer can never process (bad data, a permanent bug). Without a backstop it gets redelivered forever, a "poison pill." Configure a &lt;strong&gt;dead-letter queue (DLQ)&lt;/strong&gt; so a message that fails N times moves aside for inspection instead of blocking the line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Treating at-least-once as exactly-once.&lt;/strong&gt; No dedup guard means double-charged cards and duplicate emails the first time a network blip causes a redelivery. Make consumers idempotent from day one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Acknowledging before the work is done.&lt;/strong&gt; Delete or ack the message only &lt;em&gt;after&lt;/em&gt; processing succeeds. Ack first and crash, and the event is gone forever.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No dead-letter queue.&lt;/strong&gt; A single malformed message retries endlessly, drowns your logs, and can stall the whole queue. Always wire a DLQ with a sane retry count.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Putting commands in events.&lt;/strong&gt; An event states a fact (&lt;code&gt;OrderPlaced&lt;/code&gt;), not an instruction (&lt;code&gt;SendEmail&lt;/code&gt;). If the producer is telling a specific consumer what to do, you've just rebuilt a synchronous call with extra steps and lost the decoupling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reaching for a stream when you needed a queue.&lt;/strong&gt; Kafka/Kinesis are powerful and operationally heavy. If you just need background jobs, a plain queue (SQS) is simpler, cheaper, and enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting ordering isn't free.&lt;/strong&gt; Standard queues and pub/sub don't guarantee order. If &lt;code&gt;OrderShipped&lt;/code&gt; can arrive before &lt;code&gt;OrderPlaced&lt;/code&gt;, either use a FIFO/partitioned option or make consumers tolerant of out-of-order events.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  When event-driven beats a synchronous call
&lt;/h2&gt;

&lt;p&gt;Event-driven isn't free, you trade the simplicity of a function call for eventual consistency, harder debugging, and new infrastructure. So don't make &lt;em&gt;everything&lt;/em&gt; an event. Reach for it when the trade pays off:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multiple consumers care about the same thing&lt;/strong&gt;, fan-out beats calling each one yourself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The reaction can happen later&lt;/strong&gt;, receipts, analytics, and indexing don't need to finish before you answer the user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You want failure isolation&lt;/strong&gt;, a down consumer shouldn't take down the producer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load is spiky&lt;/strong&gt;, a queue absorbs bursts and lets workers drain at their own pace.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep it synchronous when the caller genuinely needs the answer &lt;em&gt;now&lt;/em&gt; to continue, reading a user's profile to render a page, or checking inventory before confirming a price. A request that can't proceed without the response shouldn't be fire-and-forget.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Event-driven = services emit and react to facts, instead of commanding each other directly.&lt;/li&gt;
&lt;li&gt;Think newsroom (publish, anyone subscribes), not phone tree (call everyone, wait).&lt;/li&gt;
&lt;li&gt;Queue = work split across workers. Pub/Sub = broadcast a copy to all. Stream = replayable ordered log.&lt;/li&gt;
&lt;li&gt;Fan-out (one event, many consumers) is the superpower, add consumers without touching the producer.&lt;/li&gt;
&lt;li&gt;Delivery is at-least-once, so duplicates are guaranteed, make every consumer idempotent.&lt;/li&gt;
&lt;li&gt;Always add a dead-letter queue so a poison message can't block the line.&lt;/li&gt;
&lt;li&gt;Use events for fan-out, deferrable work, and failure isolation; stay synchronous when the caller needs the answer to continue.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;You now have the vocabulary and the mental model. The fastest way to make it stick is to wire a real producer and consumer, then design a system where events change how it scales.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go deeper on the worker side: &lt;a href="https://thesimplifiedtech.com/blog/async-processing-queues-and-workers" rel="noopener noreferrer"&gt;Async Processing: Queues &amp;amp; Workers&lt;/a&gt; covers retries, visibility timeouts, and worker pools in detail.&lt;/li&gt;
&lt;li&gt;See how decoupling shapes growth: &lt;a href="https://thesimplifiedtech.com/blog/scalability-principles" rel="noopener noreferrer"&gt;Scalability Principles&lt;/a&gt; shows why queues and fan-out are the backbone of systems that scale.&lt;/li&gt;
&lt;li&gt;Ready to build the rest of the stack? The &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer path&lt;/a&gt; walks you from networking to compute to event-driven systems, level by level.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/event-driven-architecture-on-the-cloud" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>eventdriven</category>
    </item>
    <item>
      <title>Disaster Recovery: RTO, RPO &amp; DR Strategies</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Thu, 29 Oct 2026 17:13:02 +0000</pubDate>
      <link>https://dev.to/sri2614/disaster-recovery-rto-rpo-dr-strategies-42f2</link>
      <guid>https://dev.to/sri2614/disaster-recovery-rto-rpo-dr-strategies-42f2</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; Pin down your RTO and RPO, then pick the right one of four DR patterns to match. The real lesson: an untested backup is not a recovery plan, so verify restores and run game-day failovers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The 3 a.m. region outage&lt;/li&gt;
&lt;li&gt;RTO and RPO: the only two numbers that matter&lt;/li&gt;
&lt;li&gt;The picture: one primary, four ways out&lt;/li&gt;
&lt;li&gt;The four DR patterns&lt;/li&gt;
&lt;li&gt;Backups vs. replication: not the same thing&lt;/li&gt;
&lt;li&gt;Build it: backup with a restore-verification check&lt;/li&gt;
&lt;li&gt;Test your restores. Run game-day failovers.&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours (or the company)&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The 3 a.m. region outage
&lt;/h2&gt;

&lt;p&gt;A cloud region goes dark. Not a single instance, not one bad deploy, the whole region. Your API is down, your dashboard is down, and the on-call engineer reaches for the runbook that says "restore from backup." Then comes the discovery that ends careers: the nightly backups have been running green for two years, but nobody has ever restored one. The snapshots are there. They are also corrupt, incomplete, or in the same dead region. The "backup" was a job that produced files, not a recovery capability that produced a running system.&lt;/p&gt;

&lt;p&gt;Disaster recovery (DR) is the discipline of being ready for that day before it arrives. It is not a product you buy; it is a set of decisions, how fast must we come back, how much data can we afford to lose, and how much are we willing to pay to guarantee it. This article gives you the vocabulary (&lt;strong&gt;RTO&lt;/strong&gt; and &lt;strong&gt;RPO&lt;/strong&gt;), the four standard DR patterns and their cost trade-offs, the difference between backups and replication, and the single habit that separates teams that recover from teams that find out: &lt;strong&gt;testing the restore&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Engineers and architects who own a production system and have been asked "what's our DR plan?", and want a real answer, not a backup job. Comfortable with cloud basics (regions, storage, databases); no prior DR experience assumed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  RTO and RPO: the only two numbers that matter
&lt;/h2&gt;

&lt;p&gt;Every DR conversation collapses into two numbers. Get them agreed with the business first; the technology choice falls out of them automatically.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;RTO is how fast you get back. RPO is how much data you can lose.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;RTO (Recovery Time Objective)&lt;/strong&gt; is the maximum acceptable time to restore service after a disaster. "We must be back within 1 hour" is an RTO of 60 minutes. &lt;strong&gt;RPO (Recovery Point Objective)&lt;/strong&gt; is the maximum acceptable amount of data loss, measured in time. "We can lose at most 5 minutes of writes" is an RPO of 5 minutes, meaning your recovery point can be no older than 5 minutes before the failure.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How long until the tow truck gets you driving again&lt;/td&gt;
&lt;td&gt;RTO, time to restore service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How far back you'd have to retrace because your last map save was old&lt;/td&gt;
&lt;td&gt;RPO, acceptable data loss window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A spare tyre in the boot vs. a second car following you&lt;/td&gt;
&lt;td&gt;Backup &amp;amp; restore vs. active-active&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test-driving the spare before the trip, not on the hard shoulder&lt;/td&gt;
&lt;td&gt;Restore drills / game-day failover&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;DR objectives, translated to a road trip.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Lower numbers cost more, non-linearly:&lt;/strong&gt; An RTO of "a few hours" might be a cheap restore script. An RTO of "a few seconds" means running a full duplicate of your stack 24/7. Halving RTO/RPO rarely doubles cost, it often multiplies it. Always ask the business for the real tolerance, not the aspirational one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The picture: one primary, four ways out
&lt;/h2&gt;

&lt;p&gt;Here is the mental model. You run in a primary region. A DR strategy is whatever you keep warm in a secondary region so that when the primary fails, you can fail over to it. The patterns differ only in how much you keep running on the other side.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4Iiw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iAgbl9kbnMoIkROUyAvIEdsb2JhbCBMQjxici8-SGVhbHRoLWNoZWNrZWQgZmFpbG92ZXIiKQogIGNsYXNzIG5fZG5zIGVkZ2U7CiAgbl9wcmltYXJ5KCJQcmltYXJ5IFJlZ2lvbjxici8-TGl2ZTogYXBwICsgZGF0YWJhc2UiKQogIGNsYXNzIG5fcHJpbWFyeSBjb21wdXRlOwogIG5fcGRhdGEoIlByaW1hcnkgRGF0YTxici8-U291cmNlIG9mIHRydXRoIikKICBjbGFzcyBuX3BkYXRhIGRhdGE7CiAgbl9zZWNvbmRhcnkoIlNlY29uZGFyeSBSZWdpb248YnIvPkRSIHRhcmdldCIpCiAgY2xhc3Mgbl9zZWNvbmRhcnkgY29tcHV0ZTsKICBuX2JhY2t1cCgiQmFja3VwcyAvIFJlcGxpY2E8YnIvPkNyb3NzLXJlZ2lvbiBjb3B5IikKICBjbGFzcyBuX2JhY2t1cCBkYXRhOwogIG5fbW9uaXRvcigiSGVhbHRoIENoZWNrczxici8-RGV0ZWN0ICsgdHJpZ2dlciIpCiAgY2xhc3Mgbl9tb25pdG9yIG9ic2VydmFiaWxpdHk7CiAgbl91c2VycyAtLT4gbl9kbnMKICBuX2RucyAtLT58Im5vcm1hbCJ8IG5fcHJpbWFyeQogIG5fcHJpbWFyeSAtLT4gbl9wZGF0YQogIG5fcGRhdGEgLS4tPnwicmVwbGljYXRlIC8gc25hcHNob3QifCBuX2JhY2t1cAogIG5fZG5zIC0uLT58Im9uIGZhaWxvdmVyInwgbl9zZWNvbmRhcnkKICBuX3NlY29uZGFyeSAtLT4gbl9iYWNrdXAKICBuX21vbml0b3IgLS4tPiBuX2Rucw%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0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BuX2Rucw%3FbgColor%3D0d1017%26type%3Dpng" alt="Primary region fails; traffic fails over to the secondary via the DR option you chose." width="1231" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Primary region fails; traffic fails over to the secondary via the DR option you chose.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Building a DR plan is a sequence, not a purchase. Walk it in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Set RTO and RPO with the business&lt;/strong&gt;: Per service, not for the whole company. Your billing pipeline and your blog probably deserve different numbers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick the DR pattern that meets those numbers&lt;/strong&gt;: Choose the cheapest pattern whose recovery characteristics satisfy the agreed RTO/RPO, see the table below.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replicate data and (optionally) infrastructure cross-region&lt;/strong&gt;: Get your source of truth out of the failure domain. Snapshots for loose RPO; continuous replication for tight RPO.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate detection and failover&lt;/strong&gt;: Health checks trigger DNS or load-balancer cutover. Manual failover at 3 a.m. blows your RTO.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document the runbook and the failback&lt;/strong&gt;: Coming back is half the plan: how you return to primary once it recovers, without losing the writes that happened in the secondary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test it on a schedule&lt;/strong&gt;: An untested plan has an unknown RTO, which is the same as no plan.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The four DR patterns
&lt;/h2&gt;

&lt;p&gt;There are four canonical patterns, ordered from cheapest/slowest to most expensive/instant. They are a spectrum: as you move down, you keep more of the secondary running, RTO and RPO shrink, and your monthly bill grows.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backup &amp;amp; restore&lt;/strong&gt;, store backups in another region; spin everything up from scratch when disaster strikes. Cheapest, slowest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pilot light&lt;/strong&gt;, keep a minimal core always running in the secondary (e.g. a replicated database), with app servers switched off until needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warm standby&lt;/strong&gt;, a scaled-down but fully functional copy of the stack is always running; you scale it up and shift traffic on failover.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-site active/active&lt;/strong&gt;, both regions serve live traffic all the time; a region loss is just lost capacity, not lost service.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Pattern&lt;/th&gt;
&lt;th&gt;RTO&lt;/th&gt;
&lt;th&gt;RPO&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;th&gt;Complexity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Backup &amp;amp; restore&lt;/td&gt;
&lt;td&gt;Hours to days&lt;/td&gt;
&lt;td&gt;Hours&lt;/td&gt;
&lt;td&gt;Lowest&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pilot light&lt;/td&gt;
&lt;td&gt;Tens of minutes&lt;/td&gt;
&lt;td&gt;Minutes&lt;/td&gt;
&lt;td&gt;Low-medium&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Warm standby&lt;/td&gt;
&lt;td&gt;Minutes&lt;/td&gt;
&lt;td&gt;Seconds-minutes&lt;/td&gt;
&lt;td&gt;Medium-high&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-site active/active&lt;/td&gt;
&lt;td&gt;Near zero&lt;/td&gt;
&lt;td&gt;Near zero&lt;/td&gt;
&lt;td&gt;Highest&lt;/td&gt;
&lt;td&gt;Highest&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The four DR patterns and their trade-offs. Lower RTO/RPO costs more and adds complexity.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Active/active is not free insurance:&lt;/strong&gt; Running two live regions means dealing with data conflicts, two-way replication lag, and split-brain. It buys the best RTO/RPO but demands the most engineering maturity. Most teams are better served by warm standby until they genuinely need zero-downtime regional failover.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Backups vs. replication: not the same thing
&lt;/h2&gt;

&lt;p&gt;These two get conflated constantly, and the confusion is what produces the 3 a.m. surprise. A &lt;strong&gt;backup&lt;/strong&gt; is a point-in-time copy you can restore from later, it protects against data loss and corruption, including logical errors like a bad migration or a &lt;code&gt;DROP TABLE&lt;/code&gt;. &lt;strong&gt;Replication&lt;/strong&gt; is a continuously-updated live copy of your data in another location, it gives you a low-RPO failover target.&lt;/p&gt;

&lt;p&gt;The critical difference: &lt;strong&gt;replication faithfully copies your mistakes.&lt;/strong&gt; If someone deletes a table, replication deletes it in the replica milliseconds later. A backup from before the delete is the only thing that saves you. You need both, replication for fast failover, backups for the corruption and oops cases. Replication is not a backup, and a backup is not a failover target.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A photo album of how things looked last night&lt;/td&gt;
&lt;td&gt;Backup, point-in-time, survives a bad delete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A live mirror of the room right now&lt;/td&gt;
&lt;td&gt;Replication, current, but reflects mistakes instantly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Region burns down&lt;/td&gt;
&lt;td&gt;Replication / standby saves you&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Engineer runs DROP TABLE in prod&lt;/td&gt;
&lt;td&gt;Only a backup saves you&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Two different protections for two different disasters.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Build it: backup with a restore-verification check
&lt;/h2&gt;

&lt;p&gt;The single most valuable thing you can automate is not the backup, it is proving the backup restores. Below, a nightly job takes a backup, copies it cross-region, then restores it into a throwaway database and runs a sanity query. If the restore or the check fails, it exits non-zero so your alerting fires. A backup whose restore is never exercised has an unknown value.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;backup-and-verify.sh&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;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="c"&gt;# --- config ---&lt;/span&gt;
&lt;span class="nv"&gt;DB_HOST&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"prod-db.internal"&lt;/span&gt;
&lt;span class="nv"&gt;DB_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"app"&lt;/span&gt;
&lt;span class="nv"&gt;TS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;(date -u +%Y%m%dT%H%M%SZ)"&lt;/span&gt;
&lt;span class="nv"&gt;DUMP&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/tmp/&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{DB_NAME}-&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{TS}.sql.gz"&lt;/span&gt;
&lt;span class="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"s3://dr-backups-us-west-2"&lt;/span&gt;   &lt;span class="c"&gt;# secondary region bucket&lt;/span&gt;
&lt;span class="nv"&gt;VERIFY_DB&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"verify_&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{TS}"&lt;/span&gt;

&lt;span class="c"&gt;# 1. take a consistent backup&lt;/span&gt;
pg_dump &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;DB_HOST"&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;DB_NAME"&lt;/span&gt; &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;plain &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;DUMP"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"backup written: &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;DUMP (&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;(du -h "&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;DUMP&lt;span class="s2"&gt;" | cut -f1))"&lt;/span&gt;

&lt;span class="c"&gt;# 2. ship it OUT of the primary region (your RPO copy)&lt;/span&gt;
aws s3 &lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;DUMP"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{BUCKET}/&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{DB_NAME}/&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{TS}.sql.gz"&lt;/span&gt;

&lt;span class="c"&gt;# 3. RESTORE into a throwaway db and verify it is usable&lt;/span&gt;
createdb &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;VERIFY_DB"&lt;/span&gt;
&lt;span class="nb"&gt;trap&lt;/span&gt; &lt;span class="s1"&gt;'dropdb --if-exists "\$VERIFY_DB"; rm -f "\$DUMP"'&lt;/span&gt; EXIT

&lt;span class="nb"&gt;gunzip&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;DUMP"&lt;/span&gt; | psql &lt;span class="nt"&gt;-q&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;VERIFY_DB"&lt;/span&gt;

&lt;span class="c"&gt;# 4. sanity check: the data is actually there&lt;/span&gt;
&lt;span class="nv"&gt;ROWS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;psql &lt;span class="nt"&gt;-tA&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;VERIFY_DB"&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"SELECT count(*) FROM users;"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;ROWS"&lt;/span&gt; &lt;span class="nt"&gt;-lt&lt;/span&gt; 1 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"VERIFY FAILED: users table empty after restore"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
  &lt;span class="nb"&gt;exit &lt;/span&gt;1
&lt;span class="k"&gt;fi

&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"restore verified: &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;ROWS rows in users, backup is usable"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wire the exit code into your monitoring: a non-zero exit (failed backup, failed restore, or empty table) should page someone. The day this job goes red is the day you learn your DR is broken, on a Tuesday afternoon, not during a real outage.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test your restores. Run game-day failovers.
&lt;/h2&gt;

&lt;p&gt;A DR plan you have never executed is a hypothesis, not a plan. Two practices turn the hypothesis into a measured capability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Restore drills
&lt;/h3&gt;

&lt;p&gt;Regularly restore a backup into a fresh environment and confirm the application actually runs against it. This catches the things that silently rot: a backup that excludes a critical schema, a snapshot encrypted with a key you no longer have, an RPO that drifted because the job started failing weeks ago. The verification script above is a continuous restore drill; do a full manual one quarterly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Game-day failover
&lt;/h3&gt;

&lt;p&gt;On a scheduled day, deliberately fail over to your secondary region with the team watching, ideally on real traffic. Measure the actual RTO and RPO and compare them to your targets. You will discover the gaps that only show up under failover: DNS TTLs too long, a secret missing in the secondary, a runbook step that assumes the primary is reachable. Then practice the failback. Each drill makes the real event boring, which is exactly what you want.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Make it routine, not heroic:&lt;/strong&gt; The goal of game-days is to move failover from a terrifying once-a-decade event to a rehearsed procedure anyone on the team can run. If only one person can fail over, you don't have a DR plan, you have a single point of failure with a pulse.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours (or the company)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Untested backups.&lt;/strong&gt; The backup job is green for years and nobody ever restores. You learn it's corrupt during the outage. Verify every restore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No RPO target.&lt;/strong&gt; You replicate "for safety" but never decided how much data loss is acceptable, so you can't tell if your setup is adequate. Set the number first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Single region.&lt;/strong&gt; Backups and replicas living in the same region as production die with it. Get your recovery copy into a different failure domain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confusing replication with backup.&lt;/strong&gt; A replica copies your &lt;code&gt;DROP TABLE&lt;/code&gt; instantly. Keep point-in-time backups for corruption and human error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual failover.&lt;/strong&gt; A runbook that requires a human to notice and act at 3 a.m. cannot meet a tight RTO. Automate detection and cutover.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting failback.&lt;/strong&gt; You fail over fine, then have no plan to return to primary without losing the writes that happened in the secondary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DNS TTLs too long.&lt;/strong&gt; A 24-hour TTL means clients keep hitting the dead region long after you cut over. Lower TTLs on failover-critical records.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;Disaster recovery in nine lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DR is decisions, not a product: how fast back, how much data lost, how much you'll pay.&lt;/li&gt;
&lt;li&gt;RTO = recovery time (how fast you're back). RPO = recovery point (how much data you can lose).&lt;/li&gt;
&lt;li&gt;Agree RTO/RPO with the business per service, the technology falls out of the numbers.&lt;/li&gt;
&lt;li&gt;Four patterns, cheapest→costliest: backup &amp;amp; restore, pilot light, warm standby, active/active.&lt;/li&gt;
&lt;li&gt;Lower RTO/RPO costs more, often non-linearly. Pick the cheapest pattern that meets the target.&lt;/li&gt;
&lt;li&gt;Backups protect against corruption and mistakes; replication gives low-RPO failover. You need both.&lt;/li&gt;
&lt;li&gt;Keep recovery copies in a different region, same-region backups die with production.&lt;/li&gt;
&lt;li&gt;Automate detection and failover; manual cutover at 3 a.m. blows your RTO.&lt;/li&gt;
&lt;li&gt;An untested restore has an unknown RTO. Run restore drills and game-day failovers on a schedule.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;DR is one slice of designing systems that survive the bad day. Two companion reads go deeper on the surrounding ground:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://thesimplifiedtech.com/blog/multi-region-architecture-when-you-need-it" rel="noopener noreferrer"&gt;Multi-Region Architecture: When You Need It&lt;/a&gt;, the infrastructure side of running in more than one region, and when the cost is actually worth it.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://thesimplifiedtech.com/blog/reliability-resilience-design-for-failure" rel="noopener noreferrer"&gt;Reliability &amp;amp; Resilience: Designing for Failure&lt;/a&gt;, error budgets, redundancy, and graceful degradation, the everyday cousins of DR.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ready to put it together end to end? Walk the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer career path&lt;/a&gt; to build resilient, multi-region systems from fundamentals up, including hands-on labs where you replicate data, automate failover, and measure your real RTO.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/disaster-recovery-rto-rpo" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>Serverless Containers: Fargate &amp; Cloud Run</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Wed, 28 Oct 2026 16:55:50 +0000</pubDate>
      <link>https://dev.to/sri2614/serverless-containers-fargate-cloud-run-136d</link>
      <guid>https://dev.to/sri2614/serverless-containers-fargate-cloud-run-136d</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; You will know when to reach for &lt;strong&gt;serverless containers&lt;/strong&gt; over Lambda-style functions or full Kubernetes, and how to deploy on Cloud Run or Fargate while sidestepping the cold-start and concurrency traps that quietly hurt you.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You have a container. Now where does it run?&lt;/li&gt;
&lt;li&gt;The one-sentence definition&lt;/li&gt;
&lt;li&gt;The picture: image to autoscaled instances&lt;/li&gt;
&lt;li&gt;Functions vs serverless containers vs managed Kubernetes&lt;/li&gt;
&lt;li&gt;Deploy it: Cloud Run and a Fargate task definition&lt;/li&gt;
&lt;li&gt;Cold starts and concurrency, the two things that bite&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  You have a container. Now where does it run?
&lt;/h2&gt;

&lt;p&gt;You built a Docker image. It runs perfectly on your laptop. Now you need it on the internet, and suddenly you are staring at a fork in the road. Option A: rent a VM, SSH in, install Docker, run the container, then wake up at 3am when the disk fills or the instance dies. Option B: stand up a Kubernetes cluster, learn Deployments, Services, Ingress, and pay for control-plane nodes that sit idle at night. Both feel like enormous overhead just to run one image.&lt;/p&gt;

&lt;p&gt;There is a third option that most people skip past: &lt;strong&gt;serverless containers&lt;/strong&gt;. You hand the platform your image, it runs it, scales it from zero to thousands of copies, bills you only while requests are flowing, and you never touch a server or a node. That is what &lt;strong&gt;AWS Fargate&lt;/strong&gt; and &lt;strong&gt;Google Cloud Run&lt;/strong&gt; do.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; Developers who can build a Docker image and want it live without learning cluster operations. If you have ever thought &lt;em&gt;I just want to run this container and not think about it&lt;/em&gt;, this is for you. Coming from functions? You will see why a container with cold starts and concurrency might fit better. Coming from Kubernetes? You will see what you can stop paying for.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The one-sentence definition
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A serverless container platform runs your container image on demand, scales the number of running copies to match traffic, including all the way down to zero, and charges you by the time and resources you actually use.&lt;/p&gt;

&lt;p&gt;The whole article in one line&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The word that trips people up is &lt;em&gt;serverless&lt;/em&gt;. There are still servers, you just never see, choose, patch, or pay for the idle ones. The platform owns the fleet; you rent slices of it per request.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;You request a ride and one shows up; you do not own the car&lt;/td&gt;
&lt;td&gt;You send a request and the platform starts a container; you do not own the server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;At 3am with no riders, no cars are circling burning fuel&lt;/td&gt;
&lt;td&gt;Scale-to-zero: with no traffic, nothing runs and you pay nothing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Friday rush: dozens of cars dispatch automatically&lt;/td&gt;
&lt;td&gt;Autoscaling: traffic spikes spin up many identical container copies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You pay per trip, not a monthly car payment&lt;/td&gt;
&lt;td&gt;Per-request / per-second billing instead of a fixed instance bill&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;First car after a quiet night takes a moment to arrive&lt;/td&gt;
&lt;td&gt;Cold start: the first request after idle waits for a container to boot&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Serverless containers map cleanly onto how a good ride-hailing service works.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: image to autoscaled instances
&lt;/h2&gt;

&lt;p&gt;The mental model is short. Your image lives in a registry. You point the platform at it. The platform pulls it, runs it, and replicates it up and down based on incoming requests, bottoming out at zero copies when nobody is calling.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJ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DsKICBjbGFzc0RlZiBleHRlcm5hbCBmaWxsOiMxYzE5MTcsc3Ryb2tlOiNhOGEyOWUsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojZTdlNWU0OwogIG5fZGV2KCJDb250YWluZXIgaW1hZ2U8YnIvPnB1c2hlZCB0byByZWdpc3RyeSIpCiAgY2xhc3Mgbl9kZXYgY2xpZW50OwogIG5fcmVnaXN0cnkoIkltYWdlIHJlZ2lzdHJ5PGJyLz5FQ1IgLyBBcnRpZmFjdCBSZWdpc3RyeSIpCiAgY2xhc3Mgbl9yZWdpc3RyeSBkYXRhOwogIG5fcGxhdGZvcm0oIlNlcnZlcmxlc3MgY29udGFpbmVyIHBsYXRmb3JtPGJyLz5GYXJnYXRlIC8gQ2xvdWQgUnVuIikKICBjbGFzcyBuX3BsYXRmb3JtIGVkZ2U7CiAgbl9pMSgiSW5zdGFuY2UgMTxici8-cnVubmluZyBjb3B5IikKICBjbGFzcyBuX2kxIGNvbXB1dGU7CiAgbl9pMigiSW5zdGFuY2UgMjxici8-cnVubmluZyBjb3B5IikKICBjbGFzcyBuX2kyIGNvbXB1dGU7CiAgbl96ZXJvKCJTY2FsZSB0byB6ZXJvPGJyLz4wIGNvcGllcyB3aGVuIGlkbGUiKQogIGNsYXNzIG5femVybyBvYnNlcnZhYmlsaXR5OwogIG5fZGV2IC0tPnwicHVzaCJ8IG5fcmVnaXN0cnkKICBuX3JlZ2lzdHJ5IC0tPnwicHVsbCBpbWFnZSJ8IG5fcGxhdGZvcm0KICBuX3BsYXRmb3JtIC0tPnwiYXV0b3NjYWxlIHVwInwgbl9pMQogIG5fcGxhdGZvcm0gLS0-IG5faTIKICBuX3BsYXRmb3JtIC0uLT58ImlkbGUifCBuX3plcm8%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2F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9rZS13aWR0aDoycHgsY29sb3I6I2JlZjI2NDsKICBjbGFzc0RlZiBleHRlcm5hbCBmaWxsOiMxYzE5MTcsc3Ryb2tlOiNhOGEyOWUsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojZTdlNWU0OwogIG5fZGV2KCJDb250YWluZXIgaW1hZ2U8YnIvPnB1c2hlZCB0byByZWdpc3RyeSIpCiAgY2xhc3Mgbl9kZXYgY2xpZW50OwogIG5fcmVnaXN0cnkoIkltYWdlIHJlZ2lzdHJ5PGJyLz5FQ1IgLyBBcnRpZmFjdCBSZWdpc3RyeSIpCiAgY2xhc3Mgbl9yZWdpc3RyeSBkYXRhOwogIG5fcGxhdGZvcm0oIlNlcnZlcmxlc3MgY29udGFpbmVyIHBsYXRmb3JtPGJyLz5GYXJnYXRlIC8gQ2xvdWQgUnVuIikKICBjbGFzcyBuX3BsYXRmb3JtIGVkZ2U7CiAgbl9pMSgiSW5zdGFuY2UgMTxici8-cnVubmluZyBjb3B5IikKICBjbGFzcyBuX2kxIGNvbXB1dGU7CiAgbl9pMigiSW5zdGFuY2UgMjxici8-cnVubmluZyBjb3B5IikKICBjbGFzcyBuX2kyIGNvbXB1dGU7CiAgbl96ZXJvKCJTY2FsZSB0byB6ZXJvPGJyLz4wIGNvcGllcyB3aGVuIGlkbGUiKQogIGNsYXNzIG5femVybyBvYnNlcnZhYmlsaXR5OwogIG5fZGV2IC0tPnwicHVzaCJ8IG5fcmVnaXN0cnkKICBuX3JlZ2lzdHJ5IC0tPnwicHVsbCBpbWFnZSJ8IG5fcGxhdGZvcm0KICBuX3BsYXRmb3JtIC0tPnwiYXV0b3NjYWxlIHVwInwgbl9pMQogIG5fcGxhdGZvcm0gLS0-IG5faTIKICBuX3BsYXRmb3JtIC0uLT58ImlkbGUifCBuX3plcm8%3FbgColor%3D0d1017%26type%3Dpng" alt="A request arrives, the platform routes it to a running copy of your image, spinning up more under load and scaling all t" width="1082" height="367"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A request arrives, the platform routes it to a running copy of your image, spinning up more under load and scaling all the way to zero when idle.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build and push your image&lt;/strong&gt;: Package your app into a Docker image and push it to a registry the platform can read, Amazon ECR for Fargate, Artifact Registry for Cloud Run.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Point the platform at the image&lt;/strong&gt;: Create a Cloud Run service or a Fargate task definition that references the image URI plus CPU/memory and the port your app listens on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The platform pulls and starts a copy&lt;/strong&gt;: On the first request it pulls the image and boots one container instance, that first boot is the cold start.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Traffic scales the instance count&lt;/strong&gt;: More concurrent requests than one copy can handle? The platform launches more identical copies. Traffic drops? It tears them down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Idle scales to zero&lt;/strong&gt;: With Cloud Run (and Fargate behind the right autoscaler), sustained no-traffic means zero running copies and a near-zero bill.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Functions vs serverless containers vs managed Kubernetes
&lt;/h2&gt;

&lt;p&gt;These three sit on a spectrum from &lt;em&gt;least to most control&lt;/em&gt;, and the right choice is rarely the most powerful one. Functions give you the least to manage; managed Kubernetes gives you the most knobs. Serverless containers sit deliberately in the middle.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Functions (Lambda-style)&lt;/th&gt;
&lt;th&gt;Serverless containers&lt;/th&gt;
&lt;th&gt;Managed Kubernetes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Scaling&lt;/td&gt;
&lt;td&gt;Automatic, per-invocation&lt;/td&gt;
&lt;td&gt;Automatic, scale-to-zero by request&lt;/td&gt;
&lt;td&gt;You configure HPA + node pools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cold start&lt;/td&gt;
&lt;td&gt;Milliseconds to ~1s&lt;/td&gt;
&lt;td&gt;~1-10s (image + app boot)&lt;/td&gt;
&lt;td&gt;None (pods stay warm), you pay for warm&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Control&lt;/td&gt;
&lt;td&gt;Lowest, runtime + limits fixed&lt;/td&gt;
&lt;td&gt;Medium, any image, your own runtime&lt;/td&gt;
&lt;td&gt;Highest, full cluster, networking, CRDs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost when idle&lt;/td&gt;
&lt;td&gt;Zero&lt;/td&gt;
&lt;td&gt;Zero (scales to zero)&lt;/td&gt;
&lt;td&gt;Pay for nodes + control plane 24/7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best for&lt;/td&gt;
&lt;td&gt;Short event-driven tasks&lt;/td&gt;
&lt;td&gt;HTTP apps, APIs, batch jobs&lt;/td&gt;
&lt;td&gt;Many services, complex networking, scale&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Pick the row that matches the trade-off you actually want.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;The honest default:&lt;/strong&gt; If your workload is an HTTP service or a containerized job and you do not yet have a fleet of services that need to talk to each other over a service mesh, start with serverless containers. You can graduate to &lt;a href="https://thesimplifiedtech.com/blog/managed-kubernetes-eks-aks-gke" rel="noopener noreferrer"&gt;managed Kubernetes&lt;/a&gt; later, your image does not change.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Deploy it: Cloud Run and a Fargate task definition
&lt;/h2&gt;

&lt;p&gt;Cloud Run is the fastest way to feel this. One command takes a local source directory or an image straight to a public HTTPS URL.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;deploy-cloud-run.sh&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;# Deploy an existing image to Cloud Run (fully managed)&lt;/span&gt;
gcloud run deploy my-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;us-docker.pkg.dev/my-project/apps/my-api:1.0 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;europe-west4 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--platform&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;managed &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--allow-unauthenticated&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;8080 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--cpu&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1 &lt;span class="nt"&gt;--memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;512Mi &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--min-instances&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0 &lt;span class="se"&gt;\ &lt;/span&gt;       &lt;span class="c"&gt;# scale to zero when idle&lt;/span&gt;
  &lt;span class="nt"&gt;--max-instances&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;50 &lt;span class="se"&gt;\ &lt;/span&gt;      &lt;span class="c"&gt;# cap the autoscaler&lt;/span&gt;
  &lt;span class="nt"&gt;--concurrency&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;80            &lt;span class="c"&gt;# requests served per instance&lt;/span&gt;

&lt;span class="c"&gt;# Output ends with the public URL:&lt;/span&gt;
&lt;span class="c"&gt;# Service [my-api] revision [my-api-00001] has been deployed&lt;/span&gt;
&lt;span class="c"&gt;# and is serving traffic at https://my-api-xxxx.a.run.app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On AWS, the unit is a &lt;strong&gt;task definition&lt;/strong&gt;, a JSON spec describing the container, that you run on Fargate. The platform provisions the compute; you never pick an instance type.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;task-definition.yaml&lt;/code&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;# ECS task definition for Fargate (register, then run as a service)&lt;/span&gt;
&lt;span class="na"&gt;family&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-api&lt;/span&gt;
&lt;span class="na"&gt;requiresCompatibilities&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;FARGATE&lt;/span&gt;                  &lt;span class="c1"&gt;# serverless launch type, no EC2 to manage&lt;/span&gt;
&lt;span class="na"&gt;networkMode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;awsvpc&lt;/span&gt;
&lt;span class="na"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;256"&lt;/span&gt;                   &lt;span class="c1"&gt;# 0.25 vCPU&lt;/span&gt;
&lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;512"&lt;/span&gt;               &lt;span class="c1"&gt;# 512 MB&lt;/span&gt;
&lt;span class="na"&gt;executionRoleArn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:iam::111122223333:role/ecsTaskExecutionRole&lt;/span&gt;
&lt;span class="na"&gt;containerDefinitions&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;my-api&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;111122223333.dkr.ecr.eu-west-1.amazonaws.com/my-api:1.0&lt;/span&gt;
    &lt;span class="na"&gt;essential&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;portMappings&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;8080&lt;/span&gt;
        &lt;span class="na"&gt;protocol&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;tcp&lt;/span&gt;
    &lt;span class="na"&gt;logConfiguration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;logDriver&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;awslogs&lt;/span&gt;
      &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;awslogs-group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/ecs/my-api&lt;/span&gt;
        &lt;span class="na"&gt;awslogs-region&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;eu-west-1&lt;/span&gt;
        &lt;span class="na"&gt;awslogs-stream-prefix&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ecs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;run-fargate.sh&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;# Register the task definition, then run it on Fargate&lt;/span&gt;
aws ecs register-task-definition &lt;span class="nt"&gt;--cli-input-yaml&lt;/span&gt; file://task-definition.yaml

aws ecs create-service &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--cluster&lt;/span&gt; my-cluster &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--service-name&lt;/span&gt; my-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--task-definition&lt;/span&gt; my-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--launch-type&lt;/span&gt; FARGATE &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--desired-count&lt;/span&gt; 1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--network-configuration&lt;/span&gt; &lt;span class="s2"&gt;"awsvpcConfiguration={subnets=[subnet-abc],securityGroups=[sg-123],assignPublicIp=ENABLED}"&lt;/span&gt;

&lt;span class="c"&gt;# Confirm it is running:&lt;/span&gt;
aws ecs describe-services &lt;span class="nt"&gt;--cluster&lt;/span&gt; my-cluster &lt;span class="nt"&gt;--services&lt;/span&gt; my-api &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s2"&gt;"services[0].runningCount"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;Your app must listen on the right port:&lt;/strong&gt; The single most common first-deploy failure: the platform sends traffic to a port your app is not listening on. Cloud Run injects a &lt;strong&gt;PORT&lt;/strong&gt; env var (default 8080), bind to it. Fargate routes to the &lt;strong&gt;containerPort&lt;/strong&gt; you declared. Mismatch = health checks fail and the container loops forever.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Cold starts and concurrency, the two things that bite
&lt;/h2&gt;

&lt;p&gt;Scale-to-zero is wonderful for your bill and brutal for your tail latency, because the saving and the cost are the same mechanism. When there are zero copies running, the next request cannot be served until a copy exists, and creating one takes time.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a cold start actually is
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;cold start&lt;/strong&gt; is the delay between a request arriving and a brand-new container instance being ready to serve it. It is the sum of: pulling the image (if not cached), starting the container, and your app's own boot time (loading frameworks, opening DB pools, JIT warmup). A 600 MB image with a slow-booting framework can cold-start in 5-10 seconds; a lean image with a fast runtime can do it in under a second.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shrink the image.&lt;/strong&gt; Smaller layers pull faster. Use slim or distroless base images and multi-stage builds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speed up app boot.&lt;/strong&gt; Lazy-load what you can; defer non-critical connections until after the server is listening.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep one copy warm.&lt;/strong&gt; Set &lt;code&gt;--min-instances=1&lt;/code&gt; (Cloud Run) or &lt;code&gt;desiredCount: 1&lt;/code&gt; (Fargate) so there is always a ready instance, you trade a small always-on cost for zero cold starts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Concurrency: how many requests one copy handles
&lt;/h3&gt;

&lt;p&gt;This is the lever functions do not give you. &lt;strong&gt;Concurrency&lt;/strong&gt; is the number of simultaneous requests a single container instance serves before the platform starts another copy. Functions are effectively concurrency-1: one invocation per instance. Serverless containers let one instance handle many requests at once, Cloud Run defaults to 80.&lt;/p&gt;

&lt;p&gt;Higher concurrency means fewer instances for the same traffic, which means lower cost and fewer cold starts, but only if your app is genuinely concurrent (async I/O, a real thread pool). If each request pins a CPU core, high concurrency just makes every request slow. Match concurrency to what your code can actually overlap.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;A quick way to reason about it:&lt;/strong&gt; Instances needed ≈ peak concurrent requests ÷ concurrency-per-instance. Serving 800 concurrent requests at concurrency 80 needs ~10 instances. Drop concurrency to 1 (function-style) and you need ~800. That ratio is the whole cost-and-cold-start story.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Binding to localhost instead of 0.0.0.0.&lt;/strong&gt; Inside a container, &lt;code&gt;127.0.0.1&lt;/code&gt; is unreachable from the platform's router. Bind to &lt;code&gt;0.0.0.0:$PORT&lt;/code&gt; or every request times out.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assuming local state survives.&lt;/strong&gt; Instances are ephemeral and can vanish between requests. Anything you write to local disk or in-memory is gone after scale-down. Use object storage or a database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setting concurrency to 1 out of habit.&lt;/strong&gt; Carrying over the function mindset multiplies your instance count and your cold starts. Start at the default and tune down only if your code is CPU-bound.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Forgetting min-instances on a latency-sensitive path.&lt;/strong&gt; A login or checkout endpoint behind scale-to-zero will hand a multi-second cold start to a real user. Keep one warm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring startup CPU and timeouts.&lt;/strong&gt; A heavy boot can exceed the platform's startup probe window; the instance is killed mid-boot and retried forever. Profile your cold start before you ship.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leaving &lt;code&gt;--allow-unauthenticated&lt;/code&gt; on a private API.&lt;/strong&gt; Convenient for a demo, an open door in production. Lock it down with IAM or an identity-aware proxy.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serverless containers run your image with no servers, no cluster, and no idle nodes to pay for.&lt;/li&gt;
&lt;li&gt;Scale-to-zero means zero cost when idle, at the price of a cold start on the next request.&lt;/li&gt;
&lt;li&gt;Cold start = image pull + container start + your app's boot time. Shrink the image and speed up boot.&lt;/li&gt;
&lt;li&gt;Concurrency lets one instance serve many requests, the lever functions never gave you. Tune it to your workload.&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Cloud Run&lt;/strong&gt; on GCP and &lt;strong&gt;Fargate&lt;/strong&gt; on AWS; you describe an image and a port, not a machine.&lt;/li&gt;
&lt;li&gt;They beat functions when you need a real container, longer runtimes, or many requests per instance.&lt;/li&gt;
&lt;li&gt;They beat Kubernetes until you have a fleet of services that need cluster-level networking and control.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;You now have a container running on the internet without owning a server. To place this in the bigger compute picture and to know when to graduate to a cluster, follow these next:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zoom out: &lt;a href="https://thesimplifiedtech.com/blog/compute-models-vms-containers-serverless" rel="noopener noreferrer"&gt;Compute Models: VMs vs Containers vs Serverless&lt;/a&gt;, where serverless containers sit among all your options.&lt;/li&gt;
&lt;li&gt;Graduate up: &lt;a href="https://thesimplifiedtech.com/blog/managed-kubernetes-eks-aks-gke" rel="noopener noreferrer"&gt;Managed Kubernetes: EKS, AKS &amp;amp; GKE&lt;/a&gt;, for when one service becomes many.&lt;/li&gt;
&lt;li&gt;Get hands-on with images first: the &lt;a href="https://thesimplifiedtech.com/labs/docker" rel="noopener noreferrer"&gt;Docker lab&lt;/a&gt;, build the image you will deploy here.&lt;/li&gt;
&lt;li&gt;Go end-to-end: the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer career path&lt;/a&gt;, where containers, networking, and IaC come together.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/serverless-containers-fargate-cloud-run" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Managed Kubernetes: EKS, AKS &amp; GKE</title>
      <dc:creator>Sri Balaji</dc:creator>
      <pubDate>Tue, 27 Oct 2026 16:07:22 +0000</pubDate>
      <link>https://dev.to/sri2614/managed-kubernetes-eks-aks-gke-3lfi</link>
      <guid>https://dev.to/sri2614/managed-kubernetes-eks-aks-gke-3lfi</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;⚡ &lt;strong&gt;TL;DR:&lt;/strong&gt; A managed control plane removes the part you never wanted to babysit, but node pools, networking, and autoscaling stay your job. Know the &lt;strong&gt;responsibility split&lt;/strong&gt;, compare EKS, AKS, and GKE, and when serverless containers are the better call.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You don't want to babysit a control plane&lt;/li&gt;
&lt;li&gt;One sentence, then a picture in your head&lt;/li&gt;
&lt;li&gt;The picture: control plane, node pool, traffic, autoscaler&lt;/li&gt;
&lt;li&gt;What a managed control plane actually gives you&lt;/li&gt;
&lt;li&gt;Node groups and pools: your half of the deal&lt;/li&gt;
&lt;li&gt;Cluster networking and ingress&lt;/li&gt;
&lt;li&gt;Autoscaling: pods first, then nodes&lt;/li&gt;
&lt;li&gt;EKS vs AKS vs GKE&lt;/li&gt;
&lt;li&gt;Ship a workload to a managed cluster&lt;/li&gt;
&lt;li&gt;What the provider manages vs what you own&lt;/li&gt;
&lt;li&gt;Common mistakes that cost hours (or money)&lt;/li&gt;
&lt;li&gt;Managed Kubernetes vs serverless containers&lt;/li&gt;
&lt;li&gt;Takeaways&lt;/li&gt;
&lt;li&gt;Where to go next&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  You don't want to babysit a control plane
&lt;/h2&gt;

&lt;p&gt;You learned Kubernetes. You can write a Deployment, expose a Service, scale a pod. Then someone says "ship it to the cloud" and reality lands: now you need an API server that never goes down, an etcd cluster you have to back up, a scheduler, a controller manager, and certificates that rotate before they expire. That is the &lt;strong&gt;control plane&lt;/strong&gt;, the brain of Kubernetes, and running it yourself is a full-time job nobody asked for.&lt;/p&gt;

&lt;p&gt;Managed Kubernetes hands that brain to your cloud provider. &lt;a href="https://thesimplifiedtech.com/blog/kubernetes-in-production" rel="noopener noreferrer"&gt;Amazon EKS&lt;/a&gt;, Azure AKS, and Google GKE all run the control plane for you, keep it patched, and back it up. You bring the worker nodes and the workloads. This article is the mental model: what "managed" really covers, who owns what, how nodes and networking fit together, how autoscaling works, and the one decision that matters most, managed Kubernetes versus &lt;a href="https://thesimplifiedtech.com/blog/serverless-containers-fargate-cloud-run" rel="noopener noreferrer"&gt;serverless containers&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📌 &lt;strong&gt;Who this is for:&lt;/strong&gt; You know basic &lt;code&gt;kubectl&lt;/code&gt; (Deployments, Services, pods) and you've maybe done the &lt;a href="https://thesimplifiedtech.com/blog/docker-vs-kubernetes-when-to-use-each" rel="noopener noreferrer"&gt;Docker vs Kubernetes&lt;/a&gt; comparison. You have &lt;strong&gt;not&lt;/strong&gt; run a production cluster. By the end you'll know what a managed cluster gives you, how to ship a workload to one, and when to skip Kubernetes entirely.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  One sentence, then a picture in your head
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Managed Kubernetes means the cloud runs and guarantees the control plane; you run the worker nodes and everything you deploy on them.&lt;/p&gt;

&lt;p&gt;The whole idea in one line&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The split is the entire point, so make it concrete before we touch any YAML.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;In the real world&lt;/th&gt;
&lt;th&gt;In tech&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The building's foundation, lifts, and power&lt;/td&gt;
&lt;td&gt;Control plane: API server, scheduler, etcd, the provider keeps it running&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Your rented floor and the desks on it&lt;/td&gt;
&lt;td&gt;Worker nodes: VMs you pay for, in a node group / node pool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The teams you move in and rearrange&lt;/td&gt;
&lt;td&gt;Pods and Deployments, your workloads, your call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reception that routes visitors to the right floor&lt;/td&gt;
&lt;td&gt;Service + Ingress, networking that sends traffic to the right pods&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Building management adding floors when you grow&lt;/td&gt;
&lt;td&gt;Cluster autoscaler adds worker nodes when pods don't fit&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Managed Kubernetes is a serviced office building, not a house you own.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The picture: control plane, node pool, traffic, autoscaler
&lt;/h2&gt;

&lt;p&gt;Here is a managed cluster end to end. The grey box on the left is what the &lt;strong&gt;provider&lt;/strong&gt; runs and you never SSH into. Everything to its right is yours.&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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcHV0ZSBmaWxsOiMwNzI3MmEsc3Ryb2tlOiMyMmI4YjAsc3Ryb2tlLXdpZHRoOjJweCxjb2xvcjojN2ZlOWRmOwogIGNsYXNzRGVmIGRhdGEgZmlsbDojMmExNTA4LHN0cm9rZTojZjk3MzE2LHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkYmE3NDsKICBjbGFzc0RlZiBxdWV1ZSBmaWxsOiMyYTI0MDgsc3Ryb2tlOiNlYWIzM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LT4gbl9zdmMKICBuX3N2YyAtLT4gbl9wb2RzCiAgbl9wb2RzIC0uLT58InNjaGVkdWxlZCBvbnRvInwgbl9ub2RlCiAgbl9jcCAtLi0-fCJzY2hlZHVsZXMgLyBtYW5hZ2VzInwgbl9wb2RzCiAgbl9ocGEgLS4tPnwiKy8tIHJlcGxpY2FzInwgbl9wb2RzCiAgbl9jYSAtLi0-fCIrLy0gbm9kZXMifCBuX25vZGU%3FbgColor%3D0d1017%26type%3Dpng" 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%2Fmermaid.ink%2Fimg%2FJSV7aW5pdDogeyJ0aGVtZSI6ImJhc2UiLCJ0aGVtZVZhcmlhYmxlcyI6eyJmb250RmFtaWx5IjoidWktc2Fucy1zZXJpZiwgc3lzdGVtLXVpLCAtYXBwbGUtc3lzdGVtLCBTZWdvZSBVSSwgUm9ib3RvLCBIZWx2ZXRpY2EsIEFyaWFsLCBzYW5zLXNlcmlmIiwiZm9udFNpemUiOiIxNXB4IiwibGluZUNvbG9yIjoiIzZiNzY4NCIsInByaW1hcnlUZXh0Q29sb3IiOiIjZTZlZGYzIiwiZWRnZUxhYmVsQmFja2dyb3VuZCI6IiMwZDEwMTcifSwiZmxvd2NoYXJ0Ijp7ImN1cnZlIjoiYmFzaXMiLCJub2RlU3BhY2luZyI6NjAsInJhbmtTcGFjaW5nIjo3OCwicGFkZGluZyI6MTZ9fX0lJQpmbG93Y2hhcnQgTFIKICBjbGFzc0RlZiBjbGllbnQgZmlsbDojMmIyMTBhLHN0cm9rZTojZjU5ZTBiLHN0cm9rZS13aWR0aDoycHgsY29sb3I6I2ZkZTY4YTsKICBjbGFzc0RlZiBlZGdlIGZpbGw6IzA2MjUxYyxzdHJva2U6IzEwYjk4MSxzdHJva2Utd2lkdGg6MnB4LGNvbG9yOiM2ZWU3Yjc7CiAgY2xhc3NEZWYgY29tcH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BuX2hwYSgiSFBBPGJyLz5TY2FsZXMgcG9kIGNvdW50IikKICBjbGFzcyBuX2hwYSBvYnNlcnZhYmlsaXR5OwogIG5fY2EoIkNsdXN0ZXIgYXV0b3NjYWxlcjxici8-U2NhbGVzIG5vZGUgY291bnQiKQogIGNsYXNzIG5fY2Egb2JzZXJ2YWJpbGl0eTsKICBuX3VzZXIgLS0-fCJIVFRQUyJ8IG5faW5ncmVzcwogIG5faW5ncmVzcyAtLT4gbl9zdmMKICBuX3N2YyAtLT4gbl9wb2RzCiAgbl9wb2RzIC0uLT58InNjaGVkdWxlZCBvbnRvInwgbl9ub2RlCiAgbl9jcCAtLi0-fCJzY2hlZHVsZXMgLyBtYW5hZ2VzInwgbl9wb2RzCiAgbl9ocGEgLS4tPnwiKy8tIHJlcGxpY2FzInwgbl9wb2RzCiAgbl9jYSAtLi0-fCIrLy0gbm9kZXMifCBuX25vZGU%3FbgColor%3D0d1017%26type%3Dpng" alt="A managed cluster: provider-run control plane, your node pool, traffic in via Ingress, autoscaler watching for pressure." width="1424" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A managed cluster: provider-run control plane, your node pool, traffic in via Ingress, autoscaler watching for pressure.&lt;/em&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create the cluster&lt;/strong&gt;: One CLI command provisions a managed control plane. The provider stands up the API server, etcd, and schedulers across availability zones, you get a kubeconfig back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a node pool&lt;/strong&gt;: You declare a group of worker VMs (size, count, autoscaling range). These are the machines your pods actually run on, and the only compute you pay per-hour for.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deploy your workload&lt;/strong&gt;: &lt;code&gt;kubectl apply&lt;/code&gt; a Deployment. The control plane's scheduler places your pods onto nodes that have room.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expose it&lt;/strong&gt;: A Service gives pods a stable address; an Ingress wires a cloud load balancer to it so the internet can reach your app over HTTPS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let it scale&lt;/strong&gt;: The Horizontal Pod Autoscaler adds replicas under load; the cluster autoscaler adds nodes when replicas have nowhere to fit.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What a managed control plane actually gives you
&lt;/h2&gt;

&lt;p&gt;When people say "managed," they mean the control plane specifically. You stop owning a long list of undifferentiated, high-stakes chores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High availability&lt;/strong&gt;, the API server and etcd run replicated across zones, so a single machine failure doesn't take your cluster's brain offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Patching and upgrades&lt;/strong&gt;, security patches for the control plane land automatically; you trigger Kubernetes version upgrades with a click or a flag instead of a weekend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;etcd backups&lt;/strong&gt;, the cluster's entire state store is backed up by the provider, so you're not the person who lost the database that holds every object.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Certificate rotation&lt;/strong&gt;, the internal TLS certs that let components talk to each other rotate before they expire, which is a classic self-managed outage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A managed endpoint&lt;/strong&gt;, you get a single API URL and a kubeconfig; you never SSH into a master node, because there are no master nodes you can touch.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;The honest trade-off:&lt;/strong&gt; You give up deep control of the control plane (you can't hand-tune etcd or run an exotic admission controller on the masters) in exchange for never being paged at 3am because a certificate expired. For 95% of teams that is a fantastic deal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Node groups and pools: your half of the deal
&lt;/h2&gt;

&lt;p&gt;The worker side is yours. A &lt;strong&gt;node group&lt;/strong&gt; (EKS) or &lt;strong&gt;node pool&lt;/strong&gt; (AKS, GKE) is a set of identical VMs with a min and max count. You'll usually run more than one pool: a general pool for normal services, plus a special pool for GPU jobs, spot instances, or memory-heavy workloads. Pods land on the right pool using labels, taints, and tolerations.&lt;/p&gt;

&lt;p&gt;Because nodes are just VMs, you pay for them whether or not pods are running on them. That single fact drives most Kubernetes cost decisions, and it's the seam where serverless containers compete.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cluster networking and ingress
&lt;/h2&gt;

&lt;p&gt;Inside the cluster every pod gets its own IP and can reach every other pod, that's the flat pod network. A &lt;strong&gt;Service&lt;/strong&gt; gives a changing set of pods one stable virtual address so callers don't chase moving IPs. To reach the outside world you go one level up: an &lt;strong&gt;Ingress&lt;/strong&gt; maps hostnames and paths to Services and provisions a real cloud load balancer (an ALB on AWS, an Application Gateway on Azure, a Cloud Load Balancer on GCP) with TLS termination.&lt;/p&gt;

&lt;p&gt;The mental shortcut: &lt;strong&gt;Service = stable address inside the cluster; Ingress = the front door from the internet.&lt;/strong&gt; Most apps need both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Autoscaling: pods first, then nodes
&lt;/h2&gt;

&lt;p&gt;Managed Kubernetes scales at two layers, and they work as a team. The &lt;strong&gt;Horizontal Pod Autoscaler (HPA)&lt;/strong&gt; watches a metric like CPU and changes the &lt;em&gt;replica count&lt;/em&gt; of a Deployment. The &lt;strong&gt;cluster autoscaler&lt;/strong&gt; watches for pods that can't be scheduled because no node has room, and adds &lt;em&gt;nodes&lt;/em&gt; to the pool (and removes them when they sit idle).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Traffic rises, CPU per pod climbs past the target.&lt;/li&gt;
&lt;li&gt;HPA bumps replicas from 3 to 8.&lt;/li&gt;
&lt;li&gt;Three of the new pods are "Pending", no node has room.&lt;/li&gt;
&lt;li&gt;Cluster autoscaler sees Pending pods and adds a node.&lt;/li&gt;
&lt;li&gt;Pods schedule, traffic is served; when load drops both scale back down.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;HPA needs requests:&lt;/strong&gt; The HPA computes CPU usage as a percentage of each pod's CPU &lt;strong&gt;request&lt;/strong&gt;. If you don't set &lt;code&gt;resources.requests&lt;/code&gt;, the HPA has no baseline and silently does nothing. Always set requests on autoscaled workloads.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  EKS vs AKS vs GKE
&lt;/h2&gt;

&lt;p&gt;All three run the same upstream Kubernetes, your YAML is portable. They differ in defaults, networking model, and how much they automate. The short version: GKE is the most hands-off, EKS is the most flexible and AWS-native, AKS is the friendliest if you live in Azure.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;EKS (AWS)&lt;/th&gt;
&lt;th&gt;AKS (Azure)&lt;/th&gt;
&lt;th&gt;GKE (Google)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Control plane&lt;/td&gt;
&lt;td&gt;Managed, hourly fee per cluster&lt;/td&gt;
&lt;td&gt;Managed, free (pay nodes only)&lt;/td&gt;
&lt;td&gt;Managed; Autopilot or Standard&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Networking&lt;/td&gt;
&lt;td&gt;VPC CNI, pods get VPC IPs&lt;/td&gt;
&lt;td&gt;Azure CNI or kubenet&lt;/td&gt;
&lt;td&gt;VPC-native, strong defaults&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Autoscaling&lt;/td&gt;
&lt;td&gt;Cluster Autoscaler / Karpenter&lt;/td&gt;
&lt;td&gt;Cluster Autoscaler + KEDA&lt;/td&gt;
&lt;td&gt;Autoscaler + Autopilot (node-free)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ease / opinion&lt;/td&gt;
&lt;td&gt;Most flexible, most setup&lt;/td&gt;
&lt;td&gt;Smooth Azure + AD integration&lt;/td&gt;
&lt;td&gt;Most automated, least to manage&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Same Kubernetes underneath; different ergonomics and defaults.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Pick by where you already are:&lt;/strong&gt; The right managed Kubernetes is almost always the one in the cloud you already use, because networking, IAM, and load balancers integrate natively. Don't pick GKE for its polish if your whole stack is on AWS.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Ship a workload to a managed cluster
&lt;/h2&gt;

&lt;p&gt;Here's the full loop on EKS, create a cluster with a node pool, deploy an app, expose it, and add autoscaling. The cluster commands differ per provider (&lt;code&gt;az aks create&lt;/code&gt;, &lt;code&gt;gcloud container clusters create&lt;/code&gt;), but everything after &lt;code&gt;kubectl&lt;/code&gt; is identical across all three.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;create-and-deploy.sh&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;# 1. Create a managed cluster with one autoscaling node pool (AWS / eksctl)&lt;/span&gt;
eksctl create cluster &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; shop &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; eu-west-1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--nodegroup-name&lt;/span&gt; general &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--node-type&lt;/span&gt; t3.medium &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--nodes&lt;/span&gt; 3 &lt;span class="nt"&gt;--nodes-min&lt;/span&gt; 3 &lt;span class="nt"&gt;--nodes-max&lt;/span&gt; 10 &lt;span class="nt"&gt;--managed&lt;/span&gt;

&lt;span class="c"&gt;# 2. Point kubectl at it (eksctl writes your kubeconfig automatically)&lt;/span&gt;
kubectl get nodes        &lt;span class="c"&gt;# you should see 3 Ready nodes&lt;/span&gt;

&lt;span class="c"&gt;# 3. Deploy + expose the app&lt;/span&gt;
kubectl apply &lt;span class="nt"&gt;-f&lt;/span&gt; app.yaml

&lt;span class="c"&gt;# 4. Watch the load balancer get an external address&lt;/span&gt;
kubectl get ingress shop &lt;span class="nt"&gt;-w&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workload itself, a Deployment with resource requests, a Service, and an HPA, is plain Kubernetes and runs unchanged on any of the three:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;app.yaml&lt;/code&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="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;Deployment&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;shop&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;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="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;shop&lt;/span&gt; &lt;span class="pi"&gt;}&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="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;shop&lt;/span&gt; &lt;span class="pi"&gt;}&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;shop&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;ghcr.io/acme/shop:1.4.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="nv"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;8080&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="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;250m&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;256Mi&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;# HPA needs this&lt;/span&gt;
            &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;   &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;cpu&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;500m&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;512Mi&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
&lt;span class="nn"&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;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;Service&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;shop&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;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;shop&lt;/span&gt; &lt;span class="pi"&gt;}&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="nv"&gt;port&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;80&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;targetPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;8080&lt;/span&gt; &lt;span class="pi"&gt;}]&lt;/span&gt;
&lt;span class="nn"&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;autoscaling/v2&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;HorizontalPodAutoscaler&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;shop&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;scaleTargetRef&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;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;Deployment&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;shop&lt;/span&gt;
  &lt;span class="na"&gt;minReplicas&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;maxReplicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;
  &lt;span class="na"&gt;metrics&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Resource&lt;/span&gt;
      &lt;span class="na"&gt;resource&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;cpu&lt;/span&gt;
        &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;Utilization&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;averageUtilization&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;70&lt;/span&gt; &lt;span class="pi"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify it the same way everywhere: &lt;code&gt;kubectl get hpa shop&lt;/code&gt; shows current vs target CPU and the live replica count, and &lt;code&gt;kubectl get pods -w&lt;/code&gt; lets you watch new replicas appear under load. Practice these commands in the free &lt;a href="https://thesimplifiedtech.com/labs/kubectl" rel="noopener noreferrer"&gt;kubectl lab&lt;/a&gt; before you point them at a real cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the provider manages vs what you own
&lt;/h2&gt;

&lt;p&gt;This table is the line you must internalize. Anything on the right is your responsibility, the provider will not save you from a bad Deployment, an open Service, or a runaway bill.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concern&lt;/th&gt;
&lt;th&gt;Provider manages&lt;/th&gt;
&lt;th&gt;You own&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Control plane&lt;/td&gt;
&lt;td&gt;API server, etcd, scheduler, upgrades&lt;/td&gt;
&lt;td&gt;Choosing when to upgrade versions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Worker nodes&lt;/td&gt;
&lt;td&gt;Provisioning the VMs you request&lt;/td&gt;
&lt;td&gt;Sizing, patching OS images, cost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Workloads&lt;/td&gt;
&lt;td&gt;Scheduling pods onto nodes&lt;/td&gt;
&lt;td&gt;Manifests, images, resource requests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Networking&lt;/td&gt;
&lt;td&gt;Load balancer + CNI plumbing&lt;/td&gt;
&lt;td&gt;Services, Ingress rules, network policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Control-plane isolation&lt;/td&gt;
&lt;td&gt;RBAC, secrets, pod security, image scanning&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;The managed Kubernetes responsibility split.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistakes that cost hours (or money)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;No resource requests.&lt;/strong&gt; Without them the scheduler packs nodes blindly, the HPA can't compute usage, and the cluster autoscaler can't tell when you're out of room. Set requests on every workload.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expecting the cluster autoscaler to scale pods.&lt;/strong&gt; It only adds &lt;em&gt;nodes&lt;/em&gt;. If your Deployment is stuck at 3 replicas under load, you needed an HPA, not more nodes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leaving node pools oversized.&lt;/strong&gt; Nodes bill by the hour whether idle or not. Set a sane &lt;code&gt;min&lt;/code&gt;, enable the autoscaler, and you stop paying for empty VMs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exposing everything with a LoadBalancer Service.&lt;/strong&gt; Each one provisions a separate cloud load balancer (and bill). Use one Ingress to fan out to many Services instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring the version treadmill.&lt;/strong&gt; Managed control planes only support a few recent Kubernetes versions; skip upgrades too long and you're forced into a rushed multi-version jump.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assuming managed means secure.&lt;/strong&gt; The provider isolates the control plane; your RBAC, secrets, and public Services are entirely on you.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Managed Kubernetes vs serverless containers
&lt;/h2&gt;

&lt;p&gt;The biggest decision isn't EKS vs GKE, it's whether you need Kubernetes at all. If you just want to run a container and forget it, &lt;strong&gt;serverless containers&lt;/strong&gt; (AWS Fargate, Google Cloud Run, Azure Container Apps) give you no nodes to manage, no autoscaler to tune, and scale-to-zero billing. You give up the rich Kubernetes ecosystem, operators, service meshes, fine-grained scheduling, that you may never need.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reach for managed Kubernetes when&lt;/strong&gt; you run many interdependent services, need custom networking or a service mesh, rely on the operator/Helm ecosystem, or want one portable platform across clouds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reach for serverless containers when&lt;/strong&gt; you have a handful of stateless services, want zero infrastructure to babysit, have spiky or low traffic (scale to zero), and don't need Kubernetes-specific tooling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Full breakdown in &lt;a href="https://thesimplifiedtech.com/blog/serverless-containers-fargate-cloud-run" rel="noopener noreferrer"&gt;Serverless Containers: Fargate &amp;amp; Cloud Run&lt;/a&gt;. A common, healthy pattern: start serverless, graduate to managed Kubernetes only when complexity actually demands it.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;The whole article in seven lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Managed Kubernetes = the cloud runs the control plane (API server, etcd, scheduler); you run the worker nodes and workloads.&lt;/li&gt;
&lt;li&gt;Worker nodes live in node groups / node pools, VMs you pay for hourly, so size and autoscale them deliberately.&lt;/li&gt;
&lt;li&gt;Service = stable address inside the cluster; Ingress = the front door from the internet via a cloud load balancer.&lt;/li&gt;
&lt;li&gt;Two autoscalers: HPA changes pod replicas, the cluster autoscaler changes node count, they work as a team.&lt;/li&gt;
&lt;li&gt;EKS, AKS, GKE run the same Kubernetes; pick the one in the cloud you already use.&lt;/li&gt;
&lt;li&gt;Set resource requests on everything, the scheduler, HPA, and autoscaler all depend on them.&lt;/li&gt;
&lt;li&gt;If you don't need Kubernetes' ecosystem, serverless containers are simpler and cheaper to run.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;You can now reason about a managed cluster end to end. Next, get hands-on and see how these pieces behave under real load and real failure.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Practice the commands from this article in the free &lt;a href="https://thesimplifiedtech.com/labs/kubectl" rel="noopener noreferrer"&gt;kubectl lab&lt;/a&gt;, no cluster or credit card needed.&lt;/li&gt;
&lt;li&gt;Step back to fundamentals with &lt;a href="https://thesimplifiedtech.com/blog/docker-vs-kubernetes-when-to-use-each" rel="noopener noreferrer"&gt;Docker vs Kubernetes: when to use each&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Decide if you even need a cluster: &lt;a href="https://thesimplifiedtech.com/blog/serverless-containers-fargate-cloud-run" rel="noopener noreferrer"&gt;Serverless Containers: Fargate &amp;amp; Cloud Run&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Take a cluster to production-grade with &lt;a href="https://thesimplifiedtech.com/blog/kubernetes-in-production" rel="noopener noreferrer"&gt;Kubernetes in Production&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Put it all on a roadmap with the &lt;a href="https://thesimplifiedtech.com/career-paths/cloud-engineer" rel="noopener noreferrer"&gt;Cloud Engineer career path&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://thesimplifiedtech.com/blog/managed-kubernetes-eks-aks-gke" rel="noopener noreferrer"&gt;TheSimplifiedTech&lt;/a&gt;, where this guide is interactive, with in-browser terminal labs and diagrams. Learn cloud and DevOps by doing, no videos.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>cloud</category>
      <category>kubernetes</category>
    </item>
  </channel>
</rss>
