<?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: Sascha Mirow-Stanitzok</title>
    <description>The latest articles on DEV Community by Sascha Mirow-Stanitzok (@sascha-ms).</description>
    <link>https://dev.to/sascha-ms</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%2F4206244%2F7cfde56f-a896-4ecc-be0b-60af11cb40bb.jpg</url>
      <title>DEV Community: Sascha Mirow-Stanitzok</title>
      <link>https://dev.to/sascha-ms</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sascha-ms"/>
    <language>en</language>
    <item>
      <title>Stop copying Lambda boilerplate: the Middy onion model explained</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Wed, 18 Nov 2026 13:47:58 +0000</pubDate>
      <link>https://dev.to/sascha-ms/middy-middleware-for-aws-lambda-in-typescript-g8p</link>
      <guid>https://dev.to/sascha-ms/middy-middleware-for-aws-lambda-in-typescript-g8p</guid>
      <description>&lt;p&gt;In a code review not long ago I opened three Lambda handlers from the same team, side by side. All three parsed the JSON body, checked a few headers, validated input and turned errors into HTTP responses. All three did it slightly differently. One returned errors as plain text, one as JSON, and one forgot the correlation ID on failures. Nobody had done anything wrong; they had just copied and adjusted the same 30 lines of boilerplate.&lt;/p&gt;

&lt;p&gt;That is the problem Middy solves for me. I walk through a complete example, a small library API where members borrow books, in &lt;a href="https://sascha-ms.de/en/middy-middleware-lambda-typescript?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Middy middleware for AWS Lambda in TypeScript&lt;/a&gt;. This post covers the ideas that matter most.&lt;/p&gt;

&lt;h2&gt;
  
  
  A frame around the handler
&lt;/h2&gt;

&lt;p&gt;Lambda gives you an event and a context and expects a result. There is no built-in place for cross-cutting concerns like logging, validation or error formatting. Middy adds that place. It is an open-source library built only for Lambda, with a tiny core (&lt;code&gt;@middy/core&lt;/code&gt;) and separate packages you install as needed. Version 7 requires Node.js 22 or newer, and Node.js 24 is recommended.&lt;/p&gt;

&lt;p&gt;A middleware is just an object with up to three functions: &lt;code&gt;before&lt;/code&gt;, &lt;code&gt;after&lt;/code&gt; and &lt;code&gt;onError&lt;/code&gt;. All of them receive the same &lt;code&gt;request&lt;/code&gt; with event, context, response and error. Writing your own is surprisingly little code. A body validator, for example, can be this small:&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;validateBody&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Check&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&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="nc"&gt;MiddlewareObj&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;unknown&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;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="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="s2"&gt;"validateBody"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;before&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&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;body&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;result&lt;/span&gt;&lt;span class="p"&gt;.&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="k"&gt;throw&lt;/span&gt; &lt;span class="nf"&gt;createError&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="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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;problems&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;request&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;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&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;p&gt;The handler that remains only contains business logic, like refusing to lend reference books. And because a Middy handler is still a plain async function, you can test it with Vitest and a hand-built event, no AWS account needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Order is everything
&lt;/h2&gt;

&lt;p&gt;The single most important thing to understand is the onion model. &lt;code&gt;before&lt;/code&gt; functions run in the order you register them with &lt;code&gt;.use()&lt;/code&gt;. &lt;code&gt;after&lt;/code&gt; and &lt;code&gt;onError&lt;/code&gt; run in reverse. Whoever goes in first comes out last.&lt;/p&gt;

&lt;p&gt;This has very practical consequences. In my example, a correlation ID middleware adds an &lt;code&gt;x-correlation-id&lt;/code&gt; header to every response. If it is registered after &lt;code&gt;httpErrorHandler&lt;/code&gt;, its &lt;code&gt;onError&lt;/code&gt; runs before the error response exists, and failed requests end up without an ID, which are exactly the ones you need when debugging. Registered before the error handler, everything lines up.&lt;/p&gt;

&lt;p&gt;The second trap: a &lt;code&gt;before&lt;/code&gt; function can return a value to end the chain early, handy for caches or a maintenance mode. But that skips the handler and every &lt;code&gt;after&lt;/code&gt; function of the outer layers too. Your 503 maintenance response will silently lack headers that other middlewares would normally add.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where I draw the line
&lt;/h2&gt;

&lt;p&gt;Middy is pleasantly careful about errors: the HTTP error handler only exposes messages for status codes below 500, so an internal error does not leak details to the client. I always set &lt;code&gt;fallbackMessage&lt;/code&gt;, though, so a 500 has a meaningful body.&lt;/p&gt;

&lt;p&gt;I also push back on putting everything into middlewares. Business rules belong in the handler. Middlewares are for the technical parts that are identical across functions. Every middleware is another package in the bundle and another step per invocation, so ten layers around three lines of logic are a warning sign. And Middy versus Powertools is not an either-or: Powertools for TypeScript ships its own Middy middlewares for logging, metrics and tracing, so they slot right into the same chain.&lt;/p&gt;

&lt;p&gt;My recommendation for teams: a small shared base chain that every HTTP function uses, plus only what each function really needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A step-by-step project setup with ES modules, &lt;code&gt;NodeNext&lt;/code&gt; and the right Middy packages&lt;/li&gt;
&lt;li&gt;Two custom typed middlewares for correlation IDs and validation&lt;/li&gt;
&lt;li&gt;The full handler with five middlewares and why they sit in exactly that order&lt;/li&gt;
&lt;li&gt;Vitest tests, including one that makes the onion order and early returns visible&lt;/li&gt;
&lt;li&gt;Deployment with Serverless Framework v4 on &lt;code&gt;nodejs24.x&lt;/code&gt;, plus common mistakes and an FAQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read it here: &lt;a href="https://sascha-ms.de/en/middy-middleware-lambda-typescript?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Middy middleware for AWS Lambda in TypeScript&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/middy-middleware-lambda-typescript?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Curious what your own Lambda functions cost? Try my &lt;a href="https://sascha-ms.de/en/tools/lambda-cost-calculator/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Lambda cost calculator&lt;/a&gt; – it runs right in your browser.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/middy-middleware-lambda-typescript?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>backend</category>
      <category>serverless</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Where did our focus time go? Running a meeting audit with your team</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Wed, 18 Nov 2026 12:46:52 +0000</pubDate>
      <link>https://dev.to/sascha-ms/reduce-meetings-a-meeting-audit-for-dev-teams-4jc2</link>
      <guid>https://dev.to/sascha-ms/reduce-meetings-a-meeting-audit-for-dev-teams-4jc2</guid>
      <description>&lt;p&gt;Try this with your team: ask everyone to open their calendar for next week and look for one uninterrupted block of three hours. In many development teams, a surprising number of people come up empty. No single meeting is to blame. The daily makes sense, the business sync makes sense, the architecture round makes sense. It is the sum that leaves no room for deep work.&lt;/p&gt;

&lt;p&gt;As a team lead I now send invitations myself, so I have had to look at this from both sides. In &lt;a href="https://sascha-ms.de/en/reduce-meetings-audit?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Reduce meetings: a meeting audit for dev teams&lt;/a&gt; I describe a four-week process for cleaning up recurring meetings. Here is the short version.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real cost is fragmentation
&lt;/h2&gt;

&lt;p&gt;Paul Graham's essay on maker and manager schedules from 2009 still explains the core issue well. Managers think in hourly slots, so one more meeting is just one more slot. People who build things need long stretches, and a single meeting in the middle of the afternoon breaks that time into pieces too small for hard problems. Even knowing a meeting is coming makes you pick smaller tasks.&lt;/p&gt;

&lt;p&gt;Research by Gloria Mark and colleagues (CHI 2008) adds a twist: interrupted people in their experiment actually finished tasks faster, but reported more stress, frustration and effort. The damage does not show up in delivery numbers right away. It shows up later as exhaustion and mistakes. That is why I treat protecting focus time as part of leading with people first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flip the burden of proof
&lt;/h2&gt;

&lt;p&gt;Shopify famously cleared all recurring meetings with more than two attendees from calendars in January 2023 and asked teams to wait before adding any back. The company later reported around a third less meeting time. Those are its own numbers, not an independent study, but the mechanics are useful even for a small team:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A meeting has to justify coming back, not the other way around.&lt;/li&gt;
&lt;li&gt;A real pause shows what the team actually misses.&lt;/li&gt;
&lt;li&gt;Focus rules apply to everyone, leadership included.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The audit in a nutshell
&lt;/h2&gt;

&lt;p&gt;The audit itself takes about four weeks: one week to prepare, two weeks of trial and one week to review. First you list every recurring meeting with cadence, length, attendees and a one-sentence purpose. Then you make the cost visible as person-hours per month, and note when each meeting splits a morning or afternoon in half.&lt;/p&gt;

&lt;p&gt;The heart of it is a short set of questions for each meeting. My favorite is: what exactly would happen if this meeting were skipped for two weeks? It forces honest answers. Each meeting ends with one of four decisions: keep, shorten or meet less often, move to async, or cancel. Instead of deleting anything for good, you suspend the candidates for a two-week trial and let the team note what goes missing.&lt;/p&gt;

&lt;p&gt;Two practical tips I like: schedule 25 or 50 minutes instead of 30 or 60, and put focus blocks into the calendar as real events so people outside the team can see them too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't cut the wrong things
&lt;/h2&gt;

&lt;p&gt;Some meetings I would defend in any audit: regular one-on-ones, retrospectives and, especially in remote teams, voluntary social formats. And the most common mistake is cancelling a meeting without agreeing where its decisions happen now. If that answer is "in chat", you have traded one meeting for fifty interruptions.&lt;/p&gt;

&lt;p&gt;The other trap sits with the leader. If I keep calling spontaneous "quick five minutes" calls, every rule looks like theater. Reducing meetings is first of all a leadership job, because only a leader can push back on meetings owned by other departments and show that declining an invitation is a sign of respect for everyone's time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;All seven audit steps, including a template for the meeting inventory&lt;/li&gt;
&lt;li&gt;The complete list of five questions to ask about every recurring meeting&lt;/li&gt;
&lt;li&gt;A decision table with examples for keep, shorten, async and cancel&lt;/li&gt;
&lt;li&gt;How to protect focus time and write the results down as a team agreement&lt;/li&gt;
&lt;li&gt;Common mistakes, an FAQ and the sources behind the figures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read it here: &lt;a href="https://sascha-ms.de/en/reduce-meetings-audit?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Reduce meetings: a meeting audit for dev teams&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/reduce-meetings-audit?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Preparing a first one-on-one? My &lt;a href="https://sascha-ms.de/en/cheat-sheets/first-one-on-one-questions/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;question cheat sheet&lt;/a&gt; puts the best questions on one printable page.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/reduce-meetings-audit?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>leadership</category>
      <category>management</category>
      <category>productivity</category>
    </item>
    <item>
      <title>The third seat at the pairing table: where AI assistants fit in</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Wed, 18 Nov 2026 11:47:26 +0000</pubDate>
      <link>https://dev.to/sascha-ms/pair-programming-with-ai-roles-for-humans-and-assistants-1jap</link>
      <guid>https://dev.to/sascha-ms/pair-programming-with-ai-roles-for-humans-and-assistants-1jap</guid>
      <description>&lt;p&gt;A situation I have seen more than once lately: two developers are pairing, one has the keyboard and is busy prompting an AI assistant, reading its suggestions and accepting them. The other one nods along. From the outside it looks like pair programming. In reality, one person is working with their AI and a second person is watching.&lt;/p&gt;

&lt;p&gt;That made me ask a simple question: if an assistant already reads along and suggests code, who should actually sit at the pairing table? I explore it in detail in &lt;a href="https://sascha-ms.de/en/pair-programming-ai?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Pair programming with AI: roles for humans and assistants&lt;/a&gt;. Here are the main ideas.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an assistant can and cannot take over
&lt;/h2&gt;

&lt;p&gt;Birgitta Böckeler of Thoughtworks broke down the benefits of pairing on martinfowler.com in 2023 and checked how many of them a coding assistant covers. Her answer: only a small part, and I agree. An assistant is great at explaining unfamiliar APIs, getting you unstuck and producing routine code. What it cannot do is carry tacit knowledge: why a field has a strange name, which approach already failed last year, which department gets nervous about which change. That knowledge spreads from head to head as a side effect of pairing.&lt;/p&gt;

&lt;p&gt;There is also shared responsibility. When one person writes code alone with an assistant, exactly one human can explain it afterwards. That is a step backwards for your bus factor. So my conclusion is not "assistant or pairing", but the assistant as a third seat inside the pair.&lt;/p&gt;

&lt;h2&gt;
  
  
  A clear split of roles
&lt;/h2&gt;

&lt;p&gt;Once an assistant joins, the pair needs a new agreement. The split that works for me:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Driver:&lt;/strong&gt; types and writes the prompts, and reads every suggestion out loud before accepting it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Navigator:&lt;/strong&gt; holds the goal, checks suggestions against architecture and team agreements, and has the final say together with the driver.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assistant:&lt;/strong&gt; delivers drafts, tests and explanations, but never decides anything.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two small rules make a big difference. First, when you switch roles, the right to talk to the assistant switches too, so nobody becomes the permanent prompter. Second, for juniors in strong-style pairing, an AI suggestion is only accepted once the driver can explain it in their own words.&lt;/p&gt;

&lt;p&gt;A short, verifiable instruction keeps the assistant in its lane, for example after the navigator has written a failing test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Implement extendLoan in src/loans/extend.ts so that the tests in
extend.test.ts pass. Return a new object instead of mutating the
input. No new dependencies. Then explain in two sentences how you
handled the date calculation.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small steps, a commit after every green test, and a quick check together: does it fit the goal, do we understand every line, would we approve this in a review?&lt;/p&gt;

&lt;h2&gt;
  
  
  Feeling fast is not being fast
&lt;/h2&gt;

&lt;p&gt;One finding I keep coming back to: a randomized study by METR from 2025 with 16 experienced open-source developers found they took 19 percent longer with AI tools, while estimating afterwards that they had been about 20 percent faster. The study has clear limits, and METR itself warns against generalizing. Still, it is a good reason not to judge your pairing experiments by gut feeling alone.&lt;/p&gt;

&lt;p&gt;For managers, the 2025 DORA report describes AI as an amplifier of what an organization already is. A team that collaborates well will likely benefit. A team where everyone works alone will drift further apart. That is why I would not mandate anything. I would suggest a time-boxed experiment and look at lead time, defects and how many people can explain a given piece of code, not at accepted suggestions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Three setups (solo, pair, mob with an assistant) and their typical risks&lt;/li&gt;
&lt;li&gt;A detailed breakdown of which pairing benefits an assistant covers and which stay human&lt;/li&gt;
&lt;li&gt;A complete two-hour session plan, including an &lt;code&gt;AGENTS.md&lt;/code&gt; excerpt and a ping-pong test example&lt;/li&gt;
&lt;li&gt;When to close the assistant: architecture decisions, domain onboarding, uneven pace&lt;/li&gt;
&lt;li&gt;Common mistakes such as prompt ping-pong, plus an FAQ on juniors and Copilot&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read it here: &lt;a href="https://sascha-ms.de/en/pair-programming-ai?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Pair programming with AI: roles for humans and assistants&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/pair-programming-ai?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; More for team leads: my &lt;a href="https://sascha-ms.de/en/cheat-sheets/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;cheat sheets&lt;/a&gt; put the essentials on one printable page.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/pair-programming-ai?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>learning</category>
      <category>programming</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Printing at the shop counter: a case for Step Functions activities</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Wed, 18 Nov 2026 09:57:03 +0000</pubDate>
      <link>https://dev.to/sascha-ms/step-functions-activity-vs-callback-when-to-poll-eci</link>
      <guid>https://dev.to/sascha-ms/step-functions-activity-vs-callback-when-to-poll-eci</guid>
      <description>&lt;p&gt;A bike rental wants the rental contract printed at the shop counter as soon as someone books online. The booking workflow runs in AWS Step Functions. The printer hangs off a PC behind a cheap internet router that accepts no inbound connections. How does the workflow get the job to that PC?&lt;/p&gt;

&lt;p&gt;Most teams would reach for a callback with a task token and a queue in between. In &lt;a href="https://sascha-ms.de/en/step-functions-activity-worker?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Step Functions Activity vs. Callback: When to Poll&lt;/a&gt; I argue that there is a leaner option for exactly this case: the Step Functions activity. Here is the gist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Push versus pull
&lt;/h2&gt;

&lt;p&gt;Both patterns rely on the same thing under the hood: a task token that identifies a waiting execution. The difference is how the work reaches the worker.&lt;/p&gt;

&lt;p&gt;With a &lt;code&gt;.waitForTaskToken&lt;/code&gt; callback, Step Functions pushes the task out through an integration, for example SQS, Lambda or EventBridge. With an activity, the worker pulls it. An activity is little more than a name with an ARN. The worker calls &lt;code&gt;GetActivityTask&lt;/code&gt;, receives the input plus a token, and later answers with &lt;code&gt;SendTaskSuccess&lt;/code&gt; or &lt;code&gt;SendTaskFailure&lt;/code&gt;, sending &lt;code&gt;SendTaskHeartbeat&lt;/code&gt; in between for longer jobs.&lt;/p&gt;

&lt;p&gt;The call uses long polling: Step Functions holds the request open for up to 60 seconds and answers as soon as a task appears. A waiting worker costs almost nothing and still reacts quickly. And it only needs outbound HTTPS: no open ports, no port forwarding, no VPN.&lt;/p&gt;

&lt;h2&gt;
  
  
  When polling is the better choice
&lt;/h2&gt;

&lt;p&gt;I reach for an activity in two situations: workers that AWS cannot and should not reach (a shop PC, a machine on a factory floor, a server in your own data center), and long-running containers or special hardware that runs around the clock anyway. In both cases you skip the queue and have one less moving part.&lt;/p&gt;

&lt;p&gt;I stick with the callback when the worker is a Lambda function (polling in a loop means paying for every second of waiting), or when I need what a queue offers: a dead-letter queue, redrive, fan-out or queue-length metrics. And note that Express workflows support neither option.&lt;/p&gt;

&lt;p&gt;A minimal poll loop looks roughly like this. The important detail is the client timeout, which should be at least 65 seconds:&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;const&lt;/span&gt; &lt;span class="n"&gt;sfn&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;SFNClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;requestHandler&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;NodeHttpHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;requestTimeout&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;70_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;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;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;running&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;task&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;sfn&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;GetActivityTaskCommand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;activityArn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;workerName&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;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;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;taskToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// empty poll after up to 60 s&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&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;printContract&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;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt; &lt;span class="o"&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;await&lt;/span&gt; &lt;span class="n"&gt;sfn&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;SendTaskSuccessCommand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;taskToken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;taskToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;output&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;result&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The real worker in the article adds several pollers, a concurrency limit, heartbeats and error handling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where tasks get stuck
&lt;/h2&gt;

&lt;p&gt;The simplicity has a price: polling, heartbeats, shutdown and idempotency are entirely your job. The traps I would watch first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Short client timeouts or proxies&lt;/strong&gt; that cut idle connections make empty polls fail and can lose tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No &lt;code&gt;TimeoutSeconds&lt;/code&gt; on the task state&lt;/strong&gt; means an execution may wait until the maximum run time, which is a year for standard workflows, if no worker is running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cutting off polls on shutdown&lt;/strong&gt; can drop a token that was just being assigned. Let open polls return on their own.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retries after a heartbeat timeout&lt;/strong&gt; can print the contract twice. Make the work idempotent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Changing the input format&lt;/strong&gt; of an existing activity breaks old workers, because activities are not versioned.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;AWS also recommends keeping at least 100 polls open per activity ARN for production systems. For a shop PC with a few contracts per hour that is oversized, but for a throughput worker in ECS it is worth calculating.&lt;/p&gt;

&lt;p&gt;My advice in one line: use activities at the edges of your system, and stay with events at its core.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A comparison table of activity and callback, plus the full decision guide&lt;/li&gt;
&lt;li&gt;A CDK stack with the activity, state machine, scoped IAM role and CloudWatch alarm&lt;/li&gt;
&lt;li&gt;The complete TypeScript worker with pollers, heartbeats, &lt;code&gt;AbortSignal&lt;/code&gt; and clean shutdown&lt;/li&gt;
&lt;li&gt;Vitest tests without an AWS account, throttling limits, and security tips such as IAM Roles Anywhere&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything, including the runnable code: &lt;a href="https://sascha-ms.de/en/step-functions-activity-worker?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Step Functions Activity vs. Callback: When to Poll&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/step-functions-activity-worker?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Working with AWS CDK? Grab my printable &lt;a href="https://sascha-ms.de/en/cheat-sheets/aws-cdk/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;AWS CDK cheat sheet&lt;/a&gt; with commands, concepts and a stack skeleton.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/step-functions-activity-worker?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>aws</category>
      <category>backend</category>
      <category>serverless</category>
    </item>
    <item>
      <title>When 300 readers click at once: stopping cache stampedes on Lambda</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Wed, 18 Nov 2026 08:55:25 +0000</pubDate>
      <link>https://dev.to/sascha-ms/prevent-a-cache-stampede-lambda-valkey-and-bedrock-3p9a</link>
      <guid>https://dev.to/sascha-ms/prevent-a-cache-stampede-lambda-valkey-and-bedrock-3p9a</guid>
      <description>&lt;p&gt;Saturday morning, a newsletter goes out. Three hundred readers click the same link within seconds. The cached answer behind that page expired a moment ago, so every one of those requests sees an empty cache and starts recomputing it. If the computation is a database query, that is annoying. If it is a call to a language model on Amazon Bedrock, it is slow, expensive, and may run straight into your quotas.&lt;/p&gt;

&lt;p&gt;That is a cache stampede, and it is the topic of &lt;a href="https://sascha-ms.de/en/cache-stampede-lambda-valkey?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Prevent a cache stampede: Lambda, Valkey and Bedrock&lt;/a&gt;. Here are the ideas behind it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Lambda makes this harder
&lt;/h2&gt;

&lt;p&gt;In a classic Node.js server you could coalesce identical requests in memory: the first one starts the work, the others wait on the same promise. In Lambda that does not help. In the standard model, each execution environment handles one request at a time, so 300 parallel requests mean many environments, each with its own memory. Coordination has to happen somewhere everyone can see, and the natural place is the cache itself, in my example ElastiCache Serverless for Valkey.&lt;/p&gt;

&lt;p&gt;In front of a model, three things hurt at once: a call takes seconds, so the window of the empty cache is long. Every call costs tokens, so you pay for 300 identical answers. And a stampede can use up Bedrock quotas that unrelated requests also depend on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four building blocks that combine well
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;A short lock.&lt;/strong&gt; Only the request that wins &lt;code&gt;SET key token NX PX 20000&lt;/code&gt; recomputes. &lt;code&gt;NX&lt;/code&gt; writes only if the key doesn't exist, &lt;code&gt;PX&lt;/code&gt; makes the lock disappear on its own if the function crashes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A stale value.&lt;/strong&gt; Keep the entry longer than it is fresh. In the example, a pick counts as fresh for ten minutes but stays stored for an hour. Everyone who doesn't get the lock immediately receives the previous answer. Waiting only happens when there is nothing at all in the cache.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Early refresh (XFetch).&lt;/strong&gt; A probabilistic method from a 2015 paper: each request rolls the dice on whether to refresh shortly before expiry, and slow computations get a bigger head start automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Jitter on the TTL.&lt;/strong&gt; A few percent of randomness keeps keys that were written together from all expiring together.&lt;/p&gt;

&lt;h2&gt;
  
  
  The detail that matters most
&lt;/h2&gt;

&lt;p&gt;Releasing the lock sounds trivial, but it is where things go wrong. If your computation takes longer than the lock's lifetime, a second request can grab a new lock. If the first one then blindly runs &lt;code&gt;DEL&lt;/code&gt;, it deletes someone else's lock. That's why the lock holds a random token, and you only delete it if the token is still yours:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight lua"&gt;&lt;code&gt;&lt;span class="c1"&gt;-- delete the lock only if it still holds our token&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"get"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;KEYS&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="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;ARGV&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="k"&gt;then&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;call&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"del"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;KEYS&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="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Valkey 9 or newer, the single command &lt;code&gt;DELIFEQ&lt;/code&gt; does the same.&lt;/p&gt;

&lt;p&gt;A few related rules from the article: the Lambda timeout must be longer than the lock, waiting requests should answer with 503 and &lt;code&gt;Retry-After&lt;/code&gt; instead of calling Bedrock themselves, only valid values get cached, and a fixed list of allowed keys keeps anyone from draining your model budget with made-up paths.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where I draw the line
&lt;/h2&gt;

&lt;p&gt;This is an efficiency lock, not a correctness lock. If it gets lost now and then, two requests compute the same value, which costs one extra call. That's why I don't reach for Redlock or fencing tokens here. If money, stock or double bookings are at stake, a cache is the wrong place for a lock anyway.&lt;/p&gt;

&lt;p&gt;I also wouldn't add it everywhere. For a 20 ms query, a stampede is barely measurable. But once a model, a slow partner API or an expensive report sits behind the cache, lock plus stale value is part of my standard toolkit.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The complete &lt;code&gt;getOrCompute&lt;/code&gt; function in TypeScript, combining lock, stale value, XFetch and jitter&lt;/li&gt;
&lt;li&gt;A Valkey GLIDE adapter with the safe release, plus the Bedrock call and handler&lt;/li&gt;
&lt;li&gt;An AWS CDK stack for Lambda and the HTTP API, and tests that need no AWS account&lt;/li&gt;
&lt;li&gt;A small load test and a Logs Insights query to measure the effect, plus a table of common mistakes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The full walkthrough with runnable code: &lt;a href="https://sascha-ms.de/en/cache-stampede-lambda-valkey?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Prevent a cache stampede: Lambda, Valkey and Bedrock&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/cache-stampede-lambda-valkey?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Curious what your own Lambda functions cost? Try my &lt;a href="https://sascha-ms.de/en/tools/lambda-cost-calculator/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Lambda cost calculator&lt;/a&gt; – it runs right in your browser.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/cache-stampede-lambda-valkey?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>aws</category>
      <category>performance</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Same question, different words: caching Bedrock answers by meaning</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Wed, 18 Nov 2026 07:56:22 +0000</pubDate>
      <link>https://dev.to/sascha-ms/semantic-cache-for-bedrock-with-elasticache-and-lambda-27po</link>
      <guid>https://dev.to/sascha-ms/semantic-cache-for-bedrock-with-elasticache-and-lambda-27po</guid>
      <description>&lt;p&gt;Look at the logs of almost any FAQ bot and you'll see the same pattern I keep running into: hundreds of people asking the same twenty questions, each time in slightly different words. "How long can I rent a bike?" and "What is the maximum rental period?" mean the same thing, yet the language model computes the answer from scratch every single time.&lt;/p&gt;

&lt;p&gt;A semantic cache fixes that by comparing meaning instead of wording. In &lt;a href="https://sascha-ms.de/en/semantic-cache-bedrock?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Semantic cache for Bedrock with ElastiCache and Lambda&lt;/a&gt; I build one for a fictional bike rental. Just as important as the code is the question of when such a cache becomes dangerous. This post sums up both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meaning instead of exact keys
&lt;/h2&gt;

&lt;p&gt;An embedding model turns each question into a vector, so questions with similar meaning land close to each other. The cache looks up the nearest stored vector, and if the cosine distance is small enough, it returns the stored answer. Otherwise it asks the model and stores the result for next time.&lt;/p&gt;

&lt;p&gt;This is not the same as prompt caching in Bedrock. Prompt caching still calls the model and only processes a repeated prompt prefix more cheaply. A semantic cache skips the model call entirely. The two work well together: prompt caching helps with every cache miss.&lt;/p&gt;

&lt;p&gt;My setup has three levels, asked in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An &lt;strong&gt;exact cache&lt;/strong&gt;: normalize the question, hash it, one read, no embedding needed.&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;semantic level&lt;/strong&gt;: create an embedding with Titan Text Embeddings V2 and run a filtered nearest-neighbor search in ElastiCache Serverless for Valkey.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;model&lt;/strong&gt; itself, whose answer is then written to both levels with a time to live.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Everything runs in one Lambda function, deployed with the Serverless Framework. The cache uses a public endpoint with TLS and IAM, so no VPC and no NAT gateway.&lt;/p&gt;

&lt;h2&gt;
  
  
  The dangerous part: false hits
&lt;/h2&gt;

&lt;p&gt;A cache miss costs money. A false hit delivers a wrong answer with full confidence. Take "Do I need a helmet for the e-bike?" and "Do I need a helmet for the cargo bike?" To an embedding model these are nearly identical sentences, but the answers may differ completely.&lt;/p&gt;

&lt;p&gt;A threshold alone can't solve this, because it's always one compromise for all questions. What helped me is a set of &lt;strong&gt;hard filters before the vector search&lt;/strong&gt;. Valkey supports TAG filters ahead of the KNN query, so only entries that match exactly are searched at all. In the example these are the topic, a knowledge version (so old answers stop matching after a price change) and the bike type detected from the question. Almost every domain has a handful of such terms: plan names, product variants, countries, contract types.&lt;/p&gt;

&lt;p&gt;Some questions never belong in the cache: anything personal like a booking number, anything time-sensitive like current availability, and follow-ups in multi-turn dialogs. The example has a deliberately strict rule that bypasses the cache for those.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calibrate instead of guessing
&lt;/h2&gt;

&lt;p&gt;Don't just copy a threshold from a blog post, including mine. Suitable distances depend on the embedding model, the dimension and your language. I collect 30 to 50 question pairs from real requests and label whether the same answer would fit:&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;const&lt;/span&gt; &lt;span class="n"&gt;pairs&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="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"How long can I rent a bike?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"What is the maximum rental period?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;same&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Do you have child seats?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Can I book a child seat as an extra?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;same&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"What happens if I get a flat tire?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"What happens if I bring the bike back late?"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;same&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&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 small script computes the distance per pair. All "same" pairs should fall below the boundary, all "different" ones above. If they overlap, a further hard filter is usually the better fix than a stricter threshold.&lt;/p&gt;

&lt;p&gt;For me, a semantic cache is a business decision as much as a technical one. Which terms flip an answer and when content goes stale is something the domain team knows better than any vector index. And before building it, measure for a week how often questions really repeat.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Creating the ElastiCache Serverless cache and the vector index with TAG fields&lt;/li&gt;
&lt;li&gt;The full TypeScript code for policy rules, lookup, storage, the Bedrock call and the handler&lt;/li&gt;
&lt;li&gt;Hit-rate metrics with Embedded Metric Format, tests without AWS, and the calibration script&lt;/li&gt;
&lt;li&gt;A table of common mistakes and a cost calculation to see when the cache pays off&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All details and the runnable project: &lt;a href="https://sascha-ms.de/en/semantic-cache-bedrock?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Semantic cache for Bedrock with ElastiCache and Lambda&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/semantic-cache-bedrock?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Not sure which AWS service fits your use case? My &lt;a href="https://sascha-ms.de/en/tools/aws-service-finder/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;AWS service finder&lt;/a&gt; asks a few questions and points you to the right one.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/semantic-cache-bedrock?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Why remote pairing fails without a rhythm, and how to fix it</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Tue, 17 Nov 2026 17:46:03 +0000</pubDate>
      <link>https://dev.to/sascha-ms/remote-pair-programming-roles-timers-and-rotation-495o</link>
      <guid>https://dev.to/sascha-ms/remote-pair-programming-roles-timers-and-rotation-495o</guid>
      <description>&lt;p&gt;Picture a typical remote pairing attempt: two people join a video call, one shares the screen, the other turns off the camera "just for a moment". Two hours later, one has been typing nonstop while the other has quietly answered emails on the side. Both leave the call tired, and both conclude that pairing does not work remotely.&lt;/p&gt;

&lt;p&gt;I see this pattern a lot, as a developer and as a team lead. In my experience, the problem is rarely the tool. It is the missing rhythm. I wrote a detailed guide on this, &lt;a href="https://sascha-ms.de/en/remote-pair-programming?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Remote pair programming: roles, timers and rotation&lt;/a&gt;, and this post sums up the ideas that matter most.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick a style on purpose
&lt;/h2&gt;

&lt;p&gt;Pairing is not one technique. The style should match what you want to achieve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Driver and navigator&lt;/strong&gt; is the all-rounder. One person handles the next concrete line, the other watches names, edge cases and the overall direction. You swap after a fixed time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ping-pong&lt;/strong&gt; suits test-driven work: one writes a failing test, the other makes it pass and writes the next one. Role switches happen naturally, and nobody can hide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strong-style&lt;/strong&gt;, based on Llewellyn Falco's rule that an idea has to travel through someone else's hands, is great for onboarding. The newcomer types, the experienced person explains. Treat it as a transition, not a permanent setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For decisions that affect everyone, ensemble (formerly mob) programming brings three or more people onto one piece of code. The Remote Mob Programming authors suggest rotating the typist roughly every ten minutes and consider three to four people the sweet spot. For routine work, it is usually too expensive.&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure beats tooling
&lt;/h2&gt;

&lt;p&gt;My advice for the first weeks: use whatever screen sharing or shared editor you already have. A new tool and a new way of working at the same time is too much. Turn cameras on, wear a decent headset and mute notifications.&lt;/p&gt;

&lt;p&gt;What really makes the difference is a visible timer and planned breaks. Birgitta Böckeler and Nina Siessegger recommend Pomodoro blocks of about 25 minutes with short breaks, and see roughly six hours of pairing per day as the upper limit. If you work on separate machines, the open source tool &lt;code&gt;mob&lt;/code&gt; takes care of Git handovers through a temporary WIP branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mob start 10   &lt;span class="c"&gt;# start a session with a 10-minute timer&lt;/span&gt;
mob next       &lt;span class="c"&gt;# hand over the current state&lt;/span&gt;
mob &lt;span class="k"&gt;done&lt;/span&gt;       &lt;span class="c"&gt;# squash everything back onto your branch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bracket every session with five minutes at each end: agree on the goal, the starting roles and any constraints at the beginning, and do a tiny retrospective at the end.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rotation and the human side
&lt;/h2&gt;

&lt;p&gt;There are two kinds of rotation, and they work on different timescales. Roles inside a pair switch every few minutes. Who pairs with whom changes over days, ideally with a clear reason such as a finished topic or knowledge that so far sits in only one head. Changing pairs too often costs ramp-up time.&lt;/p&gt;

&lt;p&gt;The most common pitfalls are not technical: a navigator who only watches, pairing as an all-day default, hierarchy that silently decides every question, and calendars full of meetings. As a team lead, I would not mandate pairing. Start it as a four-week experiment, protect calendar time, never use it as a control instrument, and join in yourself if you still write code.&lt;/p&gt;

&lt;p&gt;I am convinced remote pairing is underrated for distributed teams, because it brings back the over-the-shoulder exchange that home office takes away. At the same time, I do not believe in pairing on everything. People differ, and a good team leaves room for both.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A closer look at all three pairing styles and when ensemble programming pays off&lt;/li&gt;
&lt;li&gt;A six-step setup for your first remote session, including tool options and the full &lt;code&gt;mob&lt;/code&gt; workflow&lt;/li&gt;
&lt;li&gt;Concrete starting values for rotating roles, typists and pairs&lt;/li&gt;
&lt;li&gt;Five common mistakes in detail and what team leads can do about them, plus a short FAQ&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the complete guide: &lt;a href="https://sascha-ms.de/en/remote-pair-programming?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Remote pair programming: roles, timers and rotation&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/remote-pair-programming?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; More for team leads: my &lt;a href="https://sascha-ms.de/en/cheat-sheets/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;cheat sheets&lt;/a&gt; put the essentials on one printable page.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/remote-pair-programming?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>remote</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Swapped IDs compile fine in TypeScript. Branded types stop that.</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Tue, 17 Nov 2026 15:50:27 +0000</pubDate>
      <link>https://dev.to/sascha-ms/typescript-branded-types-type-safe-ids-in-lambda-38hl</link>
      <guid>https://dev.to/sascha-ms/typescript-branded-types-type-safe-ids-in-lambda-38hl</guid>
      <description>&lt;p&gt;Here is a bug I have seen in more than one Serverless codebase: a function takes &lt;code&gt;memberId: string&lt;/code&gt; and &lt;code&gt;bookId: string&lt;/code&gt;, someone passes the arguments in the wrong order, and a DynamoDB item ends up under the wrong partition key. The code compiles, the tests pass, and the data looks perfectly valid. It only surfaces weeks later when a "member" suddenly has a book ID as a name.&lt;/p&gt;

&lt;p&gt;TypeScript cannot catch this on its own, but a small pattern called branded types can. I wrote a full hands-on guide with a runnable Lambda example: &lt;a href="https://sascha-ms.de/en/typescript-branded-types-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;TypeScript Branded Types: Type-Safe IDs in Lambda&lt;/a&gt;. This post explains the idea and the rules I follow when using it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why TypeScript lets the bug through
&lt;/h2&gt;

&lt;p&gt;TypeScript compares types by structure, not by name. A &lt;code&gt;type MemberId = string&lt;/code&gt; is therefore just another name for &lt;code&gt;string&lt;/code&gt;, and any string fits. That alias documents intent but protects you from nothing. Languages like Java or C# behave differently because the declared name counts there.&lt;/p&gt;

&lt;p&gt;The trick is to give each ID a property that exists only for the compiler. Structurally, &lt;code&gt;MemberId&lt;/code&gt; and &lt;code&gt;BookId&lt;/code&gt; now differ, so swapping them becomes a type error. At runtime, nothing changes: the value is still a plain string, and no extra byte ships.&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;declare&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;brand&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;unique&lt;/span&gt; &lt;span class="kt"&gt;symbol&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Brand&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;T&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;B&lt;/span&gt; &lt;span class="k"&gt;extends&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="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;T&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;brand&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;B&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;MemberId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Brand&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="s2"&gt;"MemberId"&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;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;memberId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&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="nc"&gt;MemberId&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;M&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;6&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="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&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="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Invalid member ID"&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;value&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nc"&gt;MemberId&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;Using a non-exported &lt;code&gt;unique symbol&lt;/code&gt; instead of a &lt;code&gt;__brand&lt;/code&gt; string property keeps the brand out of autocompletion and prevents other modules or libraries from accidentally creating compatible brands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the brand should come from
&lt;/h2&gt;

&lt;p&gt;The function above is a so-called smart constructor, and it is the heart of the pattern. My core rule: the &lt;code&gt;as&lt;/code&gt; cast to a branded type appears only inside these constructors and in test data. If you sprinkle &lt;code&gt;as MemberId&lt;/code&gt; across handlers, you have brands but no guarantee.&lt;/p&gt;

&lt;p&gt;In a Lambda function, the natural place to assign brands is the system boundary. Everything from the event is &lt;code&gt;unknown&lt;/code&gt; until it has been checked. In the guide I use Zod for that: &lt;code&gt;regex()&lt;/code&gt; checks the format, and &lt;code&gt;transform()&lt;/code&gt; hands the string to the smart constructor. From then on, service and repository only see branded types and never touch raw input.&lt;/p&gt;

&lt;p&gt;The same idea works for numbers. A &lt;code&gt;Cents&lt;/code&gt; brand keeps money amounts as whole cents instead of decimal euros, and composite DynamoDB keys like &lt;code&gt;MEMBER#...&lt;/code&gt; can get their own brand so that a key function cannot be fed with any random string.&lt;/p&gt;

&lt;h2&gt;
  
  
  The traps worth knowing
&lt;/h2&gt;

&lt;p&gt;A few things tend to trip people up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Serialization drops the brand.&lt;/strong&gt; Whatever comes from &lt;code&gt;JSON.parse&lt;/code&gt;, DynamoDB, SQS or environment variables is a plain value again. That is intentional, because that is where the next check belongs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arithmetic and string methods drop it too.&lt;/strong&gt; Adding two &lt;code&gt;Cents&lt;/code&gt; gives a plain &lt;code&gt;number&lt;/code&gt;, and &lt;code&gt;trim()&lt;/code&gt; returns a plain &lt;code&gt;string&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Brands from different sources do not match.&lt;/strong&gt; A Zod &lt;code&gt;.brand()&lt;/code&gt; type is not compatible with your own &lt;code&gt;Brand&lt;/code&gt; type of the same name. Pick one approach per project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do not brand everything.&lt;/strong&gt; It pays off for easily confused values like IDs and units, not for display names.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I prefer my own brand type over Zod's built-in one, because it keeps the domain logic independent of the validation library. And I would not introduce brands in one big refactoring. Start with the two IDs that most often sit next to each other as parameters, and explain to the team why validation happens at the boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A step-by-step loan API for a library with smart constructors, a &lt;code&gt;Cents&lt;/code&gt; brand and branded DynamoDB keys&lt;/li&gt;
&lt;li&gt;Zod schemas at the Lambda boundary, plus service, repository and handler&lt;/li&gt;
&lt;li&gt;Type-level tests with &lt;code&gt;@ts-expect-error&lt;/code&gt; that prove wrong code does not compile, alongside Vitest runtime tests&lt;/li&gt;
&lt;li&gt;Deployment with the Serverless Framework and a comparison of Zod's &lt;code&gt;.brand()&lt;/code&gt; with a custom brand type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the full guide: &lt;a href="https://sascha-ms.de/en/typescript-branded-types-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;TypeScript Branded Types: Type-Safe IDs in Lambda&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/typescript-branded-types-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; New here? My &lt;a href="https://sascha-ms.de/en/start-here/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;start page&lt;/a&gt; collects the best articles, tools and learning paths in one place.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/typescript-branded-types-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>backend</category>
      <category>serverless</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Large CSV imports on AWS without home-grown queues and workers</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Tue, 17 Nov 2026 13:57:02 +0000</pubDate>
      <link>https://dev.to/sascha-ms/step-functions-distributed-map-process-csv-with-lambda-2o22</link>
      <guid>https://dev.to/sascha-ms/step-functions-distributed-map-process-csv-with-lambda-2o22</guid>
      <description>&lt;p&gt;A large CSV lands in S3 every night. One Lambda function reads it and pushes rows to SQS, a worker processes them, and the next morning someone asks a simple question: did every row make it? Nobody can say for sure, because the setup has no real start, no end and no summary. I have seen this improvised pipeline in more Serverless projects than I can count.&lt;/p&gt;

&lt;p&gt;The Step Functions Distributed Map is my preferred answer to that question. You describe which file to read, how big the chunks are and how many may run in parallel, and Step Functions handles the fan-out, a failure threshold and a result report. My full tutorial, &lt;a href="https://sascha-ms.de/en/step-functions-distributed-map-csv-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Step Functions Distributed Map: Process CSV with Lambda&lt;/a&gt;, builds a complete import with the Serverless Framework and TypeScript. Here is the condensed version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inline Map or Distributed Map?
&lt;/h2&gt;

&lt;p&gt;The regular (inline) Map runs inside the parent execution, which brings tight limits: 256 KiB of input, one shared history capped at 25,000 entries and at most 40 parallel iterations. If any of these three limits gets in your way, it is time for the Distributed Map. Otherwise I would stay with the inline version, because it is simpler and needs fewer permissions.&lt;/p&gt;

&lt;p&gt;In distributed mode, every item or batch becomes its own child workflow with its own history, and data is read straight from S3 (CSV, JSON, JSON Lines, Parquet and more). The parent has to be a Standard workflow, while the children can be Express, which suits short batch handovers to Lambda.&lt;/p&gt;

&lt;h2&gt;
  
  
  The few settings that matter
&lt;/h2&gt;

&lt;p&gt;The example in the article is a nightly catalog import for a city library: a semicolon-separated export with ISBN, title, author, year and copies. The Map state configuration fits on one screen, and a handful of fields do the heavy lifting:&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;ItemReader&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;Resource&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:states:::s3:getObject&lt;/span&gt;
  &lt;span class="na"&gt;ReaderConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;InputType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CSV&lt;/span&gt;
    &lt;span class="na"&gt;CSVHeaderLocation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;FIRST_ROW&lt;/span&gt;
    &lt;span class="na"&gt;CSVDelimiter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SEMICOLON&lt;/span&gt;
&lt;span class="na"&gt;ItemBatcher&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;MaxItemsPerBatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt;
&lt;span class="na"&gt;MaxConcurrency&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="na"&gt;ToleratedFailurePercentage&lt;/span&gt;&lt;span class="p"&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;Batching is the biggest cost lever: 200,000 rows become 400 child workflows instead of 200,000. &lt;code&gt;MaxConcurrency&lt;/code&gt; is the one setting I would never skip, because without it Step Functions may start up to 10,000 child workflows at once and your database will notice. &lt;code&gt;ToleratedFailurePercentage&lt;/code&gt; lets the run continue despite a few bad items, and a &lt;code&gt;ResultWriter&lt;/code&gt; writes the outcome to S3 instead of blowing up the execution output beyond 256 KiB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons from building it
&lt;/h2&gt;

&lt;p&gt;A few points I would pass on to anyone trying this for the first time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Separate business errors from technical ones.&lt;/strong&gt; With batching, a thrown exception fails all 500 rows. The Lambda function therefore returns invalid rows (such as a wrong ISBN check digit) as rejected entries and only throws when something technical breaks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put retries inside the child workflow.&lt;/strong&gt; A retry on the Map state itself starts a completely new Map Run, including the batches that already succeeded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expect IAM to be the hurdle.&lt;/strong&gt; The state machine role needs &lt;code&gt;states:StartExecution&lt;/code&gt; on its own state machine, because each child is technically a new execution, plus narrowly scoped S3 read and write access. Building the ARN as text avoids a circular dependency in CloudFormation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch for Excel quirks.&lt;/strong&gt; A byte order mark in the export can garble the first column name.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Distributed Map is not the answer to everything. For loading a file into DynamoDB without logic, Bulk Put Items is simpler, and for an endless stream of events, SQS with partial batch response fits better. Its strength is a job with a clear end, where you want to know exactly what worked and what did not. That built-in bracket is what I value most.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The complete &lt;code&gt;serverless.yml&lt;/code&gt; with state machine, Express child workflows, bucket, table and all IAM permissions&lt;/li&gt;
&lt;li&gt;TypeScript code for row validation and batched DynamoDB writes with backoff, plus Vitest tests and a CSV generator&lt;/li&gt;
&lt;li&gt;How to deploy, start and monitor a run with 200,000 rows, and what the ResultWriter files contain&lt;/li&gt;
&lt;li&gt;Common mistakes, a cost breakdown and a comparison with Bulk Put Items, SQS and the inline Map&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the full tutorial: &lt;a href="https://sascha-ms.de/en/step-functions-distributed-map-csv-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Step Functions Distributed Map: Process CSV with Lambda&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/step-functions-distributed-map-csv-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Not sure which AWS service fits your use case? My &lt;a href="https://sascha-ms.de/en/tools/aws-service-finder/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;AWS service finder&lt;/a&gt; asks a few questions and points you to the right one.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/step-functions-distributed-map-csv-lambda?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>serverless</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Stop accidental DNS outages: locking records in Route 53</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:53:02 +0000</pubDate>
      <link>https://dev.to/sascha-ms/route-53-record-set-protection-lock-critical-dns-records-iio</link>
      <guid>https://dev.to/sascha-ms/route-53-record-set-protection-lock-critical-dns-records-iio</guid>
      <description>&lt;p&gt;Most DNS outages I have seen were not attacks. They were a deployment with the wrong variable, a tired click in the console, or someone "cleaning up" a CNAME that turned out to be the ACM validation record. One overwritten apex record and the website is gone; one deleted MX record and mail stops arriving.&lt;/p&gt;

&lt;p&gt;Since November 12, 2026, Route 53 has a simple answer for this: record set protection. I walked through the setup, the permission model and an automated guard in my article &lt;a href="https://sascha-ms.de/en/route-53-record-set-protection?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Route 53 Record Set Protection: Lock Critical DNS Records&lt;/a&gt;. Here is the condensed version.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the lock works
&lt;/h2&gt;

&lt;p&gt;A protection targets one combination of record name and type in a hosted zone. As long as it exists, Route 53 rejects every &lt;code&gt;ChangeResourceRecordSets&lt;/code&gt; request that would create, modify or delete those records, and that includes principals with &lt;code&gt;route53:*&lt;/code&gt;. To change the record, someone has to remove the protection first, on purpose.&lt;/p&gt;

&lt;p&gt;A few behaviors are worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A protection covers all records with that name and type, so three weighted &lt;code&gt;A&lt;/code&gt; records for &lt;code&gt;www&lt;/code&gt; are protected together.&lt;/li&gt;
&lt;li&gt;You can protect a name that does not exist yet. That effectively reserves it, which is handy for names like &lt;code&gt;admin&lt;/code&gt; that should never appear.&lt;/li&gt;
&lt;li&gt;If one change in a batch hits a protection, the whole batch fails with &lt;code&gt;InvalidChangeBatch&lt;/code&gt;. Nothing is applied partially.&lt;/li&gt;
&lt;li&gt;Each protection can carry a comment of up to 256 characters, and Route 53 includes it in the error message. Perfect for "read the runbook first".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A simplified example of protecting the MX record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws route53 create-resource-record-set-protections \
  --hosted-zone-id &lt;span class="s2"&gt;"$ZONE_ID"&lt;/span&gt; \
  --protections &lt;span class="s1"&gt;'[{"RecordName":"bikerental.example",
    "RecordType":"MX",
    "Comment":"Mail routing. See DNS runbook before changing."}]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before this feature, you needed record-level conditions in the IAM policy of every role that could touch DNS. That worked, but it was scattered, and callers only saw a generic "Access Denied". The new protection lives on the zone, is visible to everyone and explains itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to protect, and what to leave alone
&lt;/h2&gt;

&lt;p&gt;My rule of thumb: protect records that rarely change and would cause an outage if changed by accident. Apex records, MX, DMARC and DKIM entries, ACM validation CNAMEs and the apex NS/SOA are good candidates. Test and preview subdomains are not. Protecting too much trains people to click past the hurdle out of habit. The apex &lt;code&gt;TXT&lt;/code&gt; record needs a little thought, because SPF and SaaS verifications pile up there and every new entry becomes "remove, change, protect again".&lt;/p&gt;

&lt;h2&gt;
  
  
  The parts that decide whether it really helps
&lt;/h2&gt;

&lt;p&gt;The protection is only worth as much as your control over &lt;code&gt;route53:DeleteResourceRecordSetProtections&lt;/code&gt;. That action has no condition keys of its own, so anyone allowed to use it on the zone can remove every protection. In an AWS Organization, I would deny it via an SCP for everyone except a dedicated DNS admin role, and alert on removals through CloudTrail and EventBridge.&lt;/p&gt;

&lt;p&gt;The second thing to clarify with your team before the first protection: CloudFormation, and therefore CDK and the Serverless Framework, fails on protected records just like the CLI. A deployment that touches one rolls back, and a hosted zone with protections cannot be deleted at all. I also could not find a CloudFormation resource for protections yet, so they live outside your stacks for now. I actually like that, because the protection shouldn't vanish with the very deployment that breaks the record.&lt;/p&gt;

&lt;p&gt;Finally, a protection that someone removed and forgot to restore is worse than none, because everyone feels safe. That is why the full article builds a small serverless "DNS guard" that compares desired and actual protections on a schedule, repairs gaps and raises an alarm.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Step-by-step CLI setup, including testing the protection and reserving names&lt;/li&gt;
&lt;li&gt;A TypeScript script that changes a protected record safely and always restores the protection&lt;/li&gt;
&lt;li&gt;An example SCP so only one role can remove protections&lt;/li&gt;
&lt;li&gt;The complete DNS guard: Lambda handler, EMF metric, alarm, &lt;code&gt;serverless.yml&lt;/code&gt; and tests&lt;/li&gt;
&lt;li&gt;Common mistakes such as name normalization, mixed batches and throttling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All the details are in the original: &lt;a href="https://sascha-ms.de/en/route-53-record-set-protection?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Route 53 Record Set Protection: Lock Critical DNS Records&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/route-53-record-set-protection?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Working with AWS CDK? Grab my printable &lt;a href="https://sascha-ms.de/en/cheat-sheets/aws-cdk/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;AWS CDK cheat sheet&lt;/a&gt; with commands, concepts and a stack skeleton.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/route-53-record-set-protection?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>infrastructure</category>
      <category>networking</category>
      <category>security</category>
    </item>
    <item>
      <title>One secret, two AWS accounts: replicating secrets instead of sharing them</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Tue, 17 Nov 2026 08:54:03 +0000</pubDate>
      <link>https://dev.to/sascha-ms/secrets-manager-cross-account-replication-setup-guide-6ah</link>
      <guid>https://dev.to/sascha-ms/secrets-manager-cross-account-replication-setup-guide-6ah</guid>
      <description>&lt;p&gt;Here is a setup many multi-account teams will recognize: a platform team owns the payment provider's API key in a central account, and the booking service in another account needs it for every payment. The classic solution is a resource policy on the secret, a grant on the KMS key, and a Lambda that reaches across the account boundary at runtime. It works, but every reader now depends directly on the central account.&lt;/p&gt;

&lt;p&gt;Since November 13, 2026, Secrets Manager can replicate a secret into another AWS account. I built the full setup with two accounts, two KMS keys, a replication role and a Lambda that reads only locally in my article &lt;a href="https://sascha-ms.de/en/secrets-manager-cross-account-replication?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Secrets Manager Cross-Account Replication: Setup Guide&lt;/a&gt;. This post gives you the key ideas.&lt;/p&gt;

&lt;h2&gt;
  
  
  Primary, replica and what actually gets copied
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;primary secret&lt;/strong&gt; lives in the primary account. That is where the value is maintained and rotated. The &lt;strong&gt;replica secret&lt;/strong&gt; is an independent resource in the replica account with its own KMS key, resource policy and tags. Every value change on the primary, whether a &lt;code&gt;PutSecretValue&lt;/code&gt; or a rotation, is copied over, including staging labels like &lt;code&gt;AWSCURRENT&lt;/code&gt; and &lt;code&gt;AWSPREVIOUS&lt;/code&gt;. Who may read the copy is decided by the replica account alone.&lt;/p&gt;

&lt;p&gt;Some hard rules to know before you start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Primary and replica must be in the same Region.&lt;/li&gt;
&lt;li&gt;Each primary gets exactly one cross-account replica.&lt;/li&gt;
&lt;li&gt;Both sides need customer managed KMS keys, because &lt;code&gt;aws/secretsmanager&lt;/code&gt; cannot be used across accounts in this setup.&lt;/li&gt;
&lt;li&gt;Replication is asynchronous, so the copy is eventually consistent.&lt;/li&gt;
&lt;li&gt;The replica is read-only: write calls, rotation and even deletion are rejected.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When the replica beats shared access
&lt;/h2&gt;

&lt;p&gt;My rule of thumb: if a single account reads occasionally, classic shared access stays simpler. If many workloads in several accounts rely on one centrally maintained secret, or you want an emergency copy in an isolated recovery account, the replica is the cleaner design. The runtime dependency on the central account disappears; what remains is a dependency only when the value changes.&lt;/p&gt;

&lt;p&gt;For the KMS calls during replication, I recommend a dedicated &lt;strong&gt;replication role&lt;/strong&gt; in the primary account rather than forward access sessions. With a role, only that one identity needs permissions on both keys. Otherwise, every writing identity, including a rotation Lambda, would need encrypt access to a foreign key, which is exactly the sprawl you want to avoid.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it usually breaks, and the emergency exit
&lt;/h2&gt;

&lt;p&gt;Almost every problem is about permissions, and the &lt;code&gt;StatusMessage&lt;/code&gt; in &lt;code&gt;DescribeSecret&lt;/code&gt; tells you fairly precisely what is missing. Typical culprits: a missing &lt;code&gt;kms:Decrypt&lt;/code&gt; on the primary key, a key policy grant whose encryption context doesn't contain the full replica ARN (including the random suffix), a trust policy that doesn't match the primary secret, or an SCP or RCP silently blocking KMS calls. That last one is the error you will search for the longest.&lt;/p&gt;

&lt;p&gt;The part I would document in a runbook before you need it: the replica account can cut the connection on its own and turn the replica into a normal, writable secret. That is your exit if the primary account is ever compromised.&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;# In the replica account: detach and make the replica standalone&lt;/span&gt;
aws secretsmanager stop-replication-to-replica \
  --profile booking \
  --secret-id &lt;span class="s2"&gt;"$REPLICA_SECRET_ARN"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My take: I like that this follows a principle I generally favor in serverless architectures, namely that at runtime every workload has everything it needs in its own account. Two things dampen my enthusiasm. The one-replica limit does not fit the common "one secret, many consumers" case, and CloudFormation does not support the replica yet, so part of the setup lives in CLI commands. For disaster recovery with an isolated vault account, though, I would use it right away.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A complete AWS CDK project for both accounts, including KMS keys and a tightly scoped replication role&lt;/li&gt;
&lt;li&gt;The CLI steps to create, associate and monitor the replica, plus a TypeScript script that waits for &lt;code&gt;InSync&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;A booking Lambda that reads only its local copy and caches the value&lt;/li&gt;
&lt;li&gt;Detailed troubleshooting for KMS, trust policy and organization restrictions&lt;/li&gt;
&lt;li&gt;Cost considerations and how to stop or detach a replica from either side&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the full walkthrough here: &lt;a href="https://sascha-ms.de/en/secrets-manager-cross-account-replication?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Secrets Manager Cross-Account Replication: Setup Guide&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/secrets-manager-cross-account-replication?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Working with AWS CDK? Grab my printable &lt;a href="https://sascha-ms.de/en/cheat-sheets/aws-cdk/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;AWS CDK cheat sheet&lt;/a&gt; with commands, concepts and a stack skeleton.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/secrets-manager-cross-account-replication?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>aws</category>
      <category>infrastructure</category>
      <category>security</category>
    </item>
    <item>
      <title>Who could your team not survive losing? Measuring the bus factor</title>
      <dc:creator>Sascha Mirow-Stanitzok</dc:creator>
      <pubDate>Tue, 17 Nov 2026 07:51:19 +0000</pubDate>
      <link>https://dev.to/sascha-ms/bus-factor-how-to-break-up-knowledge-silos-in-teams-1755</link>
      <guid>https://dev.to/sascha-ms/bus-factor-how-to-break-up-knowledge-silos-in-teams-1755</guid>
      <description>&lt;p&gt;It is 11 pm, the payment integration is failing, and the only person who really understands it is on holiday. Most teams have at least one area like that. The uncomfortable question behind it is the bus factor: how many people could drop out tomorrow before something important stops moving? If the honest answer is "one", you have a knowledge silo.&lt;/p&gt;

&lt;p&gt;As a team lead, I look at this from two sides: it is an operational risk, and almost always a people topic too. I wrote a full guide with a workshop format, a TypeScript script for Git analysis and a 30-day plan in &lt;a href="https://sascha-ms.de/en/bus-factor-knowledge-silos?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Bus factor: how to break up knowledge silos in teams&lt;/a&gt;. Here are the main points.&lt;/p&gt;

&lt;h2&gt;
  
  
  The cost you don't see on the risk register
&lt;/h2&gt;

&lt;p&gt;The obvious risk is someone being absent. The less obvious effects show up in normal weeks. The expert becomes a bottleneck, because every change in "their" area goes through them. They get called on holiday, receive the alerts at night and rarely get to pick up new topics. And an area only one person understands gets no real pushback in reviews, so shortcuts quietly accumulate.&lt;/p&gt;

&lt;p&gt;The problem is common. A 2016 study by Avelino and colleagues found that 65 percent of 133 popular open source projects on GitHub had a bus factor of 2 or less. It also helps to remember there is no single bus factor for a team: your booking API may be well covered while the deployment pipeline depends on one person.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two ways to make it visible
&lt;/h2&gt;

&lt;p&gt;I recommend combining two perspectives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A knowledge map workshop.&lt;/strong&gt; Topics as rows, people as columns, everyone rates themselves from 0 ("no idea") to 3 ("I can explain it to others"). The bus factor per topic is simply the number of people at level 2 or 3. It also captures knowledge that never shows up in code, like on-call duty or contacts in business departments. It only works if everyone knows the table will not feed into performance reviews.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Git history analysis.&lt;/strong&gt; Research by Avelino, Passos, Hora and Valente describes how to compute a "degree of authorship" per person and file, then greedily remove the most dominant authors until fewer than half the files still have someone who knows them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The core formula is short:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DOA = 3.293 + 1.098 × FA + 0.164 × DL − 0.321 × ln(1 + AC)

FA = created the file (1 or 0)
DL = own changes, AC = changes by others
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Treat the result as a conversation starter, not a verdict. In Germany, an analysis of commits per person also touches co-determination rights of the works council, so keep it within the team and show results per directory, not as rankings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Moving knowledge without devaluing anyone
&lt;/h2&gt;

&lt;p&gt;Measuring is the easy part. In my experience, documentation alone rarely moves knowledge, because nobody reads the wiki until they have to. What works better is two people working on real tasks together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pairing with swapped roles:&lt;/strong&gt; the person who does not know the topic holds the keyboard; the expert only explains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deliberate reviews and rotation:&lt;/strong&gt; changes in a silo area get a reviewer who is still learning it, and the next ticket goes to someone else with the expert as contact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The absence test:&lt;/strong&gt; the expert is unavailable for a planned day and the team notes everything that gets stuck.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The human side matters most to me. "We need to raise your bus factor" can sound like "we are making you replaceable". I frame it as taking weight off someone's shoulders: whoever shares knowledge can go on holiday without a laptop and turns from bottleneck into multiplier. And I would never turn the bus factor into a KPI with a target, because then you get alibi commits instead of real learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the full article covers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A step-by-step plan for running the knowledge map workshop in about an hour&lt;/li&gt;
&lt;li&gt;A complete TypeScript script (around 120 lines) that estimates the bus factor from &lt;code&gt;git log&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Common pitfalls such as shallow clones, squash merges, bots and monorepos&lt;/li&gt;
&lt;li&gt;More measures for spreading knowledge, from CODEOWNERS to runbooks and ADRs&lt;/li&gt;
&lt;li&gt;A 30-day plan for team leads to get started next week&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read the full guide: &lt;a href="https://sascha-ms.de/en/bus-factor-knowledge-silos?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;Bus factor: how to break up knowledge silos in teams&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;📖 &lt;strong&gt;This is the condensed version.&lt;/strong&gt; The &lt;a href="https://sascha-ms.de/en/bus-factor-knowledge-silos?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;full article on sascha-ms.de&lt;/a&gt; goes deeper – with all code samples, diagrams and a short knowledge check.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;👉 &lt;strong&gt;Next step:&lt;/strong&gt; Preparing a first one-on-one? My &lt;a href="https://sascha-ms.de/en/cheat-sheets/first-one-on-one-questions/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;question cheat sheet&lt;/a&gt; puts the best questions on one printable page.&lt;/p&gt;

&lt;p&gt;📬 &lt;strong&gt;Stay updated:&lt;/strong&gt; New articles on serverless, AI and leading tech teams via &lt;a href="https://sascha-ms.de/en/stay-updated/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;RSS, browser push or the weekly newsletter (in German)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sascha-ms.de/en/bus-factor-knowledge-silos?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de&lt;/a&gt;.&lt;/em&gt; More articles on serverless, AI in everyday development and leading tech teams: &lt;a href="https://sascha-ms.de/en/?utm_source=devto&amp;amp;utm_medium=crosspost" rel="noopener noreferrer"&gt;sascha-ms.de/en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>leadership</category>
      <category>management</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
