<?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: Ed Stuurman</title>
    <description>The latest articles on DEV Community by Ed Stuurman (@edstuurman).</description>
    <link>https://dev.to/edstuurman</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%2F4243696%2Fed1488ae-3b23-4828-9b8c-b6c897c5536a.jpg</url>
      <title>DEV Community: Ed Stuurman</title>
      <link>https://dev.to/edstuurman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/edstuurman"/>
    <language>en</language>
    <item>
      <title>Why Don't You Write More About Email?</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Fri, 04 Dec 2026 12:10:02 +0000</pubDate>
      <link>https://dev.to/edstuurman/why-dont-you-write-more-about-email-4gme</link>
      <guid>https://dev.to/edstuurman/why-dont-you-write-more-about-email-4gme</guid>
      <description>&lt;p&gt;Every so often, someone who knows what I do for a living scrolls through this site and asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"You've spent most of your career in enterprise email. So why is your blog all Astro themes, garden trenches, homelab setups, and tin-can telephones—and hardly anything about email?"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's a fair question. The usual career advice says to build your writing around your specialty: definitive guides to DMARC alignment, deep dives into ARC headers, war stories about queue tuning at scale.&lt;/p&gt;

&lt;p&gt;There are a couple of email posts here: a reality check on running your own mail server, and a blueprint for routing homelab mail through SES. But for someone who has spent most of a career in this field, it's a suspiciously short list.&lt;/p&gt;

&lt;p&gt;Here's the honest reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Audience Trap: Either You Already Know, or You Don't Care
&lt;/h2&gt;

&lt;p&gt;Writing about email has a problem most technical topics don't: it splits the audience cleanly in two.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The people who run mail.&lt;/strong&gt; Write about SPF syntax, IP warm-up schedules, Microsoft's SNDS dashboard, or fighting a blocklist false positive, and the small circle of mail engineers reading it will just shrug: &lt;em&gt;"Cool story, lived through that in 2018."&lt;/em&gt; You're not teaching them anything. You're just swapping war stories.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Everyone else.&lt;/strong&gt; For developers, product managers, homelab hobbyists, and friends, it's alphabet soup: &lt;code&gt;RFC 5322&lt;/code&gt;, &lt;code&gt;HELO&lt;/code&gt;, milters, backscatter, &lt;code&gt;550 5.7.1&lt;/code&gt;. It has nothing to do with being smart; nobody wakes up wanting to learn how the water treatment plant works. They just want the tap to run.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's very little middle ground. You either bore the people who understand it or lose everyone who doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  Email Moves at the Speed of Continental Drift
&lt;/h2&gt;

&lt;p&gt;In web development, AI, or cloud infrastructure, the ground shifts every eighteen months. There's always a new framework to try, a new architecture to argue about, a new pattern replacing an old one. Writing about it feels like exploring.&lt;/p&gt;

&lt;p&gt;Email is the opposite.&lt;/p&gt;

&lt;p&gt;SMTP dates back to 1982. There's no CEO of email, no binding steering committee with an enforceable roadmap (working groups like M3AAWG and the IETF can recommend best practices, but they can't compel a single server to upgrade), and no mechanism to deprecate anything without breaking delivery. To make one coordinated change, you'd have to get Google, Microsoft, Apple, Yahoo, thousands of regional telecom operators, enterprise appliances, and millions of unpatched servers sitting in closets and basements to align at the exact same time.&lt;/p&gt;

&lt;p&gt;And it gets worse: a surprising amount of the world's mail runs on &lt;strong&gt;configs copy-pasted from tech blogs like this one&lt;/strong&gt;, written years ago, slightly wrong when they were published, and now quietly triggering edge cases on some other platform. Someone pastes a snippet to "fix" their SPF record, stacks up enough &lt;code&gt;include:&lt;/code&gt; statements to blow past the 10-DNS-lookup limit, and invoices to three of their biggest customers start disappearing without anyone noticing for weeks.&lt;/p&gt;

&lt;p&gt;So email doesn't get replaced. It gets things bolted on, layer after layer, like barnacles on an old ship:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the beginning, anyone could claim to be anyone.&lt;/li&gt;
&lt;li&gt;Then came &lt;strong&gt;SPF&lt;/strong&gt;: a DNS record listing which servers may send for your domain.&lt;/li&gt;
&lt;li&gt;Then &lt;strong&gt;DKIM&lt;/strong&gt;: a cryptographic signature on the message.&lt;/li&gt;
&lt;li&gt;Then &lt;strong&gt;DMARC&lt;/strong&gt;: instructions for what to do when the first two fail.&lt;/li&gt;
&lt;li&gt;Then &lt;strong&gt;ARC&lt;/strong&gt;: a way to keep those results intact when a message gets forwarded.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each one took years to standardise and years more before most of the internet actually used it. Explaining why email works the way it does is a lot like explaining why standard rail gauge is 4 feet 8½ inches: history, all the way down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some Things Are Better Kept for Work
&lt;/h2&gt;

&lt;p&gt;There's also a simpler reason: &lt;strong&gt;email is my profession, and this site is where I write about what I tinker with.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mail engineering lives on deliverability data, customer environments, and operational detail that rightly belongs to whoever I'm working for, not to a personal blog. The interesting email problems are rarely ones I could write up honestly without that context, and a sanitized version wouldn't teach anyone much.&lt;/p&gt;

&lt;p&gt;So when I sit down to write here, I want to write about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Things I can touch&lt;/strong&gt;: digging water and power trenches across the garden, or drilling a tin-can telephone with a proud preteen in full safety gear.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Homelab projects I do by choice&lt;/strong&gt;: building a zero-inbound-port setup with Proxmox, WireGuard, and CloudFront, just to see how lean it can get when there's no SLA and nobody's paging me.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The oddities of everyday life&lt;/strong&gt;: relearning to type on a Japanese keyboard, or untangling app store accounts across three countries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are the projects that remind me why I got into computers in the first place: building something just to see whether it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Respect for Boring Infrastructure
&lt;/h2&gt;

&lt;p&gt;None of this is a knock on email.&lt;/p&gt;

&lt;p&gt;Email is the one open, federated communication system that became part of everyday life for nearly everyone. Others are still around and loved by their communities (XMPP quietly powers plenty of chat systems, and Mastodon and the wider fediverse are very much alive), but none of them became the background plumbing of the whole internet. The commercial networks that tried to replace email (AIM, MSN Messenger, BBM, Slack, Teams, WhatsApp) each ended up inside one company's walls.&lt;/p&gt;

&lt;p&gt;Email has lasted more than four decades precisely because it's boring, slow to change, and owned by no one. It recovers your bank password, holds your plane tickets, and crosses every border without an API fee.&lt;/p&gt;

&lt;p&gt;I'm happy to work on it professionally. Here, though, I'd rather write about the projects that make me lose track of time.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-12-04-why-dont-you-write-more-about-email/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-12-04-why-dont-you-write-more-about-email/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>email</category>
      <category>career</category>
      <category>reflection</category>
      <category>opinion</category>
    </item>
    <item>
      <title>Port Forwarding Is Weird in Japan: NTT FLET'S, IPv6 IPoE, MAP-E, and Shared IPv4</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Tue, 01 Dec 2026 21:36:45 +0000</pubDate>
      <link>https://dev.to/edstuurman/port-forwarding-is-weird-in-japan-ntt-flets-ipv6-ipoe-map-e-and-shared-ipv4-1f3g</link>
      <guid>https://dev.to/edstuurman/port-forwarding-is-weird-in-japan-ntt-flets-ipv6-ipoe-map-e-and-shared-ipv4-1f3g</guid>
      <description>&lt;p&gt;Almost every self-hosting tutorial has the same step three: &lt;em&gt;log into your router and forward port 443 to your server.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;On most home fiber in Japan, that step quietly does nothing. The router has a port forwarding page, you fill it in, you save, and nothing from the outside ever arrives. The reason is simple once you know it: the public IPv4 address you'd be forwarding from isn't really yours. You're sharing it with other households.&lt;/p&gt;

&lt;p&gt;We're in the lucky minority. Our line is &lt;strong&gt;NURO Hikari&lt;/strong&gt;, which runs its own network and gives us a real global IPv4 address. I &lt;em&gt;could&lt;/em&gt; forward port 443 tomorrow. I still don't. The router at home accepts &lt;strong&gt;zero inbound connections&lt;/strong&gt;. The public side of &lt;code&gt;home-lab.net&lt;/code&gt; lives on S3 and CloudFront and never touches the house, and when we reach the private services from our phones or laptops away from home, that traffic rides an outbound WireGuard-based overlay instead of an open port.&lt;/p&gt;

&lt;p&gt;This post covers both halves: why port forwarding is broken for most people here, and why I skip it even though it works for us. It's written for anyone self-hosting in Japan, and for anyone elsewhere who has wondered why "just open a port" isn't universal advice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note&lt;/p&gt;
&lt;p&gt;
Japanese ISP plans change often and vary by provider. Treat the details here as a map of the territory, not a contract, and always check your own router's status page.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. How Japanese Fiber Is Actually Built
&lt;/h2&gt;

&lt;p&gt;Most home fiber in Japan runs over &lt;strong&gt;NTT FLET'S Hikari&lt;/strong&gt;, the next-generation network (NGN) run by NTT East and NTT West. You sign up with an ISP, or a reseller that bundles one, but the physical line and the regional network belong to NTT. From there, your traffic leaves the NGN for the internet in one of two ways.&lt;/p&gt;

&lt;p&gt;The old way is &lt;strong&gt;PPPoE&lt;/strong&gt;. Your router dials a session to your ISP across the NGN, and you usually get a single &lt;strong&gt;dynamic global IPv4 address&lt;/strong&gt; all to yourself. Port forwarding works exactly like the tutorials say. The catch is that those sessions pass through network termination equipment that gets badly congested in the evenings. If you've ever wondered why your 1 Gbps line does 20 Mbps at 9 p.m., this is usually why.&lt;/p&gt;

&lt;p&gt;The modern way is &lt;strong&gt;IPv6 IPoE&lt;/strong&gt;. Native IPv6 is delivered through a &lt;strong&gt;VNE&lt;/strong&gt; (Virtual Network Enabler), a company that connects directly to the NGN on behalf of many ISPs. &lt;strong&gt;JPIX (formerly JPNE)&lt;/strong&gt; and &lt;strong&gt;Internet Multifeed&lt;/strong&gt; are two of the big names, alongside a handful of others. IPoE skips the congested PPPoE equipment, so evening speeds are dramatically better, and most ISPs now put new customers on it by default.&lt;/p&gt;

&lt;p&gt;That fixes the speed problem, but it hands you a new one. IPoE is IPv6, and much of the internet is still IPv4. So how does an IPv6 line reach an IPv4-only website?&lt;/p&gt;

&lt;h2&gt;
  
  
  2. IPv4 Tunneled Inside IPv6: MAP-E and DS-Lite
&lt;/h2&gt;

&lt;p&gt;Your IPv4 traffic gets tunneled inside IPv6 to the VNE, which unwraps it and sends it out onto the IPv4 internet. There are two common ways to do this, and they behave very differently when you want to host something:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;MAP-E&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;DS-Lite&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Typical brand names&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;v6プラス&lt;/code&gt;, OCN Virtual Connect, and others&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;transix&lt;/code&gt; (Internet Multifeed), &lt;code&gt;Xpass&lt;/code&gt;, &lt;code&gt;v6コネクト&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where IPv4 NAT happens&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;On your router&lt;/strong&gt;, into a set of ports assigned to you&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;At the carrier&lt;/strong&gt;, in one big shared NAT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Your public IPv4 address&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Shared&lt;/strong&gt; with other customers (up to ~256 on typical 240-port plans)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Shared&lt;/strong&gt; with many customers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inbound IPv4 port forwarding&lt;/td&gt;
&lt;td&gt;Only on &lt;strong&gt;your assigned ports&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;None&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ports &lt;code&gt;80&lt;/code&gt; / &lt;code&gt;443&lt;/code&gt; from outside&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;MAP-E&lt;/strong&gt; is the clever one. Your router works out a shared public IPv4 address &lt;em&gt;and&lt;/em&gt; a set of ports from your IPv6 prefix. On a typical 1 Gbps &lt;code&gt;v6プラス&lt;/code&gt; line, that's 240 ports: 15 blocks of 16, scattered above port 4095 rather than a tidy &lt;code&gt;40000–40239&lt;/code&gt;. The exact count can vary by VNE and plan. Your router squeezes all of your outgoing IPv4 connections into those ports, while the neighbors sharing your address get different blocks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DS-Lite&lt;/strong&gt; is simpler. Your router wraps IPv4 packets in IPv6 and hands them to the carrier, which runs one large NAT for everyone. There's nothing on your side to forward.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding out which one you have
&lt;/h3&gt;

&lt;p&gt;Your router's status page will usually say &lt;code&gt;MAP-E&lt;/code&gt;, &lt;code&gt;DS-Lite&lt;/code&gt;, &lt;code&gt;v6プラス&lt;/code&gt;, &lt;code&gt;transix&lt;/code&gt;, or something similar. For a quick sanity check, run these from any machine on your network:&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;# The IPv4 address the internet sees you as&lt;/span&gt;
curl -4 https://ifconfig.me

&lt;span class="c"&gt;# Your IPv6 address (if this works, IPoE is active)&lt;/span&gt;
curl -6 https://ifconfig.me
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the IPv4 address doesn't match what your router's WAN page reports, or the router says it's sharing an address, you're behind some form of shared IPv4.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. What Shared IPv4 Breaks
&lt;/h2&gt;

&lt;p&gt;For everyday browsing, nothing, which is why most people never notice. For self-hosting and a few other things, quite a lot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No ports &lt;code&gt;80&lt;/code&gt; or &lt;code&gt;443&lt;/code&gt;.&lt;/strong&gt; On MAP-E you &lt;em&gt;can&lt;/em&gt; forward one of your assigned ports, so a server could technically answer at something like &lt;code&gt;https://203.0.113.10:4097&lt;/code&gt;. Nobody wants to give Grandma a URL with a port number in it, and the standard HTTP challenge for automatic certificates needs port &lt;code&gt;80&lt;/code&gt; anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing inbound at all on DS-Lite&lt;/strong&gt;, at least over IPv4.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game consoles complain.&lt;/strong&gt; Peer-to-peer games want open or predictable ports. A strict NAT warning on a PlayStation is one of the most common complaints on shared IPv4, and often the first hint that something unusual is going on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MAP-E can run out of ports.&lt;/strong&gt; Every outgoing IPv4 connection uses one of your roughly 240 ports. Add up a few phones, dozens of browser tabs, a console download, and a couple of cloud backup clients, and a busy household can genuinely hit the ceiling. The symptom is random connections that fail to open. It's rare, but it's a very confusing thing to troubleshoot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outbound port &lt;code&gt;25&lt;/code&gt; is blocked anyway.&lt;/strong&gt; This one isn't specific to IPoE. Most Japanese residential ISPs block outbound SMTP on port &lt;code&gt;25&lt;/code&gt; (OP25B) to stop infected machines from sending spam, so running a mail server that delivers straight to other mail servers isn't an option on a home line, whatever transition method you're on. That's why my homelab's outbound mail relays through Amazon SES.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. IPv6 Is the Open Door (Mostly)
&lt;/h2&gt;

&lt;p&gt;Here's the twist. On IPoE, every device can get a &lt;strong&gt;real, globally routable IPv6 address&lt;/strong&gt;. No NAT, no shared ports. On paper, IPv6 makes your home network more reachable than it has ever been.&lt;/p&gt;

&lt;p&gt;In practice, three things get in the way.&lt;/p&gt;

&lt;p&gt;First, there's &lt;strong&gt;the NTT router's IPv6 firewall&lt;/strong&gt;. If you rent NTT's home gateway, usually because you have Hikari Denwa (the fiber phone service), it blocks unsolicited inbound IPv6 by default. You can relax it, but it's a blunt switch for the whole house.&lt;/p&gt;

&lt;p&gt;Second, &lt;strong&gt;your prefix size depends on your contract&lt;/strong&gt;. On the standard 1 Gbps FLET'S Hikari Next, having Hikari Denwa and the NTT gateway usually lets your own router request a &lt;code&gt;/56&lt;/code&gt; via DHCPv6-PD, which means every VLAN can have its own &lt;code&gt;/64&lt;/code&gt;. Without it, you typically get a single &lt;code&gt;/64&lt;/code&gt; via router advertisements, and multi-VLAN IPv6 turns into a pile of workarounds. The 10 Gbps FLET'S Hikari Cross plans are friendlier here and typically hand out a &lt;code&gt;/56&lt;/code&gt; directly.&lt;/p&gt;

&lt;p&gt;Third, &lt;strong&gt;your visitors might not have IPv6&lt;/strong&gt;. Plenty of office networks, hotel Wi-Fi, and older home setups around the world are still IPv4-only, and an IPv6-only service is simply invisible to them.&lt;/p&gt;

&lt;p&gt;So IPv6 is great for reaching your own home from your own IPv6-capable phone. It isn't a reliable way to publish something to everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. The Exception: NURO Hikari
&lt;/h2&gt;

&lt;p&gt;Everything above applies to FLET'S-based lines, which is most of them. &lt;strong&gt;NURO Hikari&lt;/strong&gt;, run by Sony Network Communications, is built differently. It leases spare, unused fiber in NTT's ground ("dark fiber"), lights it with its own equipment, and runs its own network behind it. There's no FLET'S NGN, no VNE, and no PPPoE-versus-IPoE decision to make.&lt;/p&gt;

&lt;p&gt;Here's what that looks like on our line:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A real global IPv4 address.&lt;/strong&gt; It's dynamic, but it's ours alone. No MAP-E port set, no carrier NAT.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port forwarding works.&lt;/strong&gt; The NURO-supplied ONU (the fiber box on the wall) doubles as a router, and its port mapping page does exactly what the tutorials expect, &lt;code&gt;443&lt;/code&gt; included.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native IPv6 as well&lt;/strong&gt;, without the Hikari Denwa prefix quirks of the FLET'S world (though consumer NURO ONUs can still be awkward about delegating sub-prefixes to a second router behind them).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outbound port &lt;code&gt;25&lt;/code&gt; is still blocked.&lt;/strong&gt; NURO applies OP25B like everyone else, so outbound mail still needs a relay.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's one quirk worth knowing about. On many NURO ONU models you can't simply turn the router function off. If you want your own gateway (ours is UniFi), it sits &lt;em&gt;behind&lt;/em&gt; the ONU, and anything inbound has to be forwarded through both boxes. That's double NAT. It works, but it's one more layer to configure and one more place for things to go wrong.&lt;/p&gt;

&lt;p&gt;Two caveats if you're shopping today: NURO isn't available everywhere (especially in apartment buildings already wired for another provider), and Sony Network Communications has been shifting newer NURO signups and ONU replacements onto &lt;strong&gt;MAP-E&lt;/strong&gt; (shared IPv4 with port forwarding disabled) as IPv4 addresses tighten—with no option to switch back. &lt;strong&gt;au Hikari&lt;/strong&gt; (KDDI) is another non-FLET'S dual-stack option in some areas that still assigns a dynamic global IPv4 address, though availability and building wiring vary.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Your Options
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Inbound IPv4 &lt;code&gt;443&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;Evening speed&lt;/th&gt;
&lt;th&gt;Cost / Effort&lt;/th&gt;
&lt;th&gt;Gotchas&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stay on IPoE, accept no inbound&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Nothing is reachable from outside&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Switch back to PPPoE&lt;/strong&gt; (if your ISP still offers it)&lt;/td&gt;
&lt;td&gt;Yes (dynamic IP)&lt;/td&gt;
&lt;td&gt;Can be slow in the evenings&lt;/td&gt;
&lt;td&gt;Router config&lt;/td&gt;
&lt;td&gt;Address changes; needs dynamic DNS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Run PPPoE and IPoE side by side&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Yes, on the PPPoE side&lt;/td&gt;
&lt;td&gt;Fast for browsing&lt;/td&gt;
&lt;td&gt;Router that supports both&lt;/td&gt;
&lt;td&gt;Two WANs to route and secure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Paid fixed-IP option&lt;/strong&gt; (IPv4-over-IPv6 tunnel with a dedicated address)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Monthly fee&lt;/td&gt;
&lt;td&gt;Depends on ISP and VNE support&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;A provider with its own network and global IPv4&lt;/strong&gt; (e.g. legacy dual-stack NURO Hikari or au Hikari)&lt;/td&gt;
&lt;td&gt;Usually yes (not on newer MAP-E NURO lines)&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Change ISP&lt;/td&gt;
&lt;td&gt;Depends on building/area; possible double NAT; newer NURO signups may get MAP-E&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Outbound tunnel or overlay&lt;/strong&gt; (cloud relay or WireGuard mesh)&lt;/td&gt;
&lt;td&gt;Not needed&lt;/td&gt;
&lt;td&gt;Fast&lt;/td&gt;
&lt;td&gt;Small cloud box or overlay service, plus setup&lt;/td&gt;
&lt;td&gt;One more thing to run&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Running PPPoE and IPoE together is a popular trick among Japanese homelabbers. Browsing uses fast IPoE, and inbound ports come in over the PPPoE session with its own IPv4 address. It works, but you're betting on your ISP keeping PPPoE around, and you're still publishing your home IP to the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Why I Keep It Outbound-Only Anyway
&lt;/h2&gt;

&lt;p&gt;So with a perfectly good global IPv4 address on NURO, why not forward &lt;code&gt;443&lt;/code&gt; and be done with it?&lt;/p&gt;

&lt;p&gt;Because I picked the last row of that table instead. The house only ever makes &lt;strong&gt;outbound&lt;/strong&gt; connections, and it helps to split the traffic into two kinds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public visitors&lt;/strong&gt; never come to the house at all. &lt;code&gt;www.home-lab.net&lt;/code&gt; is a static site on S3 and CloudFront.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private access&lt;/strong&gt; from our own phones and laptops away from home goes over an encrypted tunnel that the house dials out to, and ends at Caddy on the Proxmox host.
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
  Visitor["Public Visitor"] --&amp;gt;|"HTTPS"| CF["CloudFront + S3 (Static Site)"]
  Phone["Our Phones and Laptops (Away From Home)"] --&amp;gt;|"WireGuard overlay"| Mesh["Outbound Tunnel or NetBird Mesh"]
  Home["Proxmox Host (Caddy)"] --&amp;gt;|"Outbound only"| Mesh
  Router["Home Router (Inbound: Deny All)"] -.- Home&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;The original &lt;a href="https://www.stuurman.com/blog/2026-11-11-split-horizon-homelab-architecture/" rel="noopener noreferrer"&gt;split-horizon blueprint&lt;/a&gt; did the private half with a small WireGuard relay on Lightsail in Tokyo: the Proxmox host dialed out to it, and our phones met it there. The live homelab now uses &lt;strong&gt;NetBird&lt;/strong&gt;, a WireGuard-based mesh overlay, which I covered in &lt;a href="https://www.stuurman.com/blog/2026-11-19-the-helmsmans-bridge-building-a-unified-homelab-command-deck/" rel="noopener noreferrer"&gt;the Helmsman's Bridge write-up&lt;/a&gt;. Each device dials out to NetBird's coordination service, and it connects them directly when it can or through a relay when it can't. The tools differ, but the principle is the same: nothing at home listens for the internet.&lt;/p&gt;

&lt;p&gt;Here's why that matters to me, roughly in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Our home IP is never published.&lt;/strong&gt; With port forwarding, DNS for our services would point straight at the house. Here, public DNS points at CloudFront, and the private names only resolve for devices at home or on the overlay. Anyone scanning or trying to knock something over finds a CDN, not our family's internet connection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;There are no firewall holes at home.&lt;/strong&gt; Inbound rules on the router stay at "deny everything," on both IPv4 and IPv6. There's no rule to forget to close, and no double-NAT forwarding chain through the NURO ONU to maintain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It doesn't depend on NURO.&lt;/strong&gt; If we move somewhere NURO doesn't reach and end up on a MAP-E or DS-Lite line, nothing about the design changes. As long as the house can make an outbound connection (even over a phone hotspot during an outage), we can still reach our services. Building around a feature most Japanese lines don't have would be building on sand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A dynamic IP stops mattering.&lt;/strong&gt; NURO's address rarely changes, but it can. The tunnel simply reconnects from whatever address we have, and there's no dynamic DNS record to keep in sync.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tunnel can run over IPv6.&lt;/strong&gt; WireGuard happily runs over native IPv6 when both ends have it, which was part of the reason the original Lightsail relay was planned as dual-stack. If we ever land on a MAP-E line, the tunnel never has to compete for that small shared pool of IPv4 ports.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The cost is a little setup and one more piece to keep updated. That's a trade I'm happy to make for a setup that survives moving to a new place, changing ISP, and the occasional stranger on the internet with a port scanner.&lt;/p&gt;

&lt;h2&gt;
  
  
  Design for the Line You Might Have Next
&lt;/h2&gt;

&lt;p&gt;For most people self-hosting in Japan, "zero inbound ports" isn't a choice. Shared IPv4 makes it the default. We happen to be on one of the few lines where it &lt;em&gt;is&lt;/em&gt; a choice, and I made it anyway, because the line we have today isn't necessarily the one we'll have in five years.&lt;/p&gt;

&lt;p&gt;If you're starting a homelab here, find out what your line actually is before you design anything. Check the router status page, run the two &lt;code&gt;curl&lt;/code&gt; commands, and see whether you're on MAP-E, DS-Lite, or a dual-stack line with an address of your own. Then design around the network you have, and ideally the one you might end up with next.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-12-01-port-forwarding-is-weird-in-japan-flets-ipoe-map-e/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-12-01-port-forwarding-is-weird-in-japan-flets-ipoe-map-e/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>networking</category>
      <category>homelab</category>
      <category>infrastructure</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Why "aws s3 sync" Was Re-Uploading My Entire Site on Every Push (And How We Fixed Our CI/CD Pipeline)</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Sat, 28 Nov 2026 07:55:42 +0000</pubDate>
      <link>https://dev.to/edstuurman/why-aws-s3-sync-was-re-uploading-my-entire-site-on-every-push-and-how-we-fixed-our-cicd-4pgk</link>
      <guid>https://dev.to/edstuurman/why-aws-s3-sync-was-re-uploading-my-entire-site-on-every-push-and-how-we-fixed-our-cicd-4pgk</guid>
      <description>&lt;p&gt;When I moved this site off Amplify and onto a globally replicated S3 Multi-Region Access Point (MRAP) behind CloudFront, I thought the CI/CD pipeline was about as simple and done as a static site pipeline gets: build Astro in one stage, run &lt;code&gt;aws s3 sync . s3://my-bucket/ --delete&lt;/code&gt; in the next, invalidate CloudFront, and call it a day.&lt;/p&gt;

&lt;p&gt;And on paper, it worked. Every push to &lt;code&gt;main&lt;/code&gt; built cleanly and showed up live a minute or two later.&lt;/p&gt;

&lt;p&gt;Wait a minute, though: &lt;em&gt;why was a one-line typo fix taking a minute or two to build and deploy, and why was S3 Cross-Region Replication chewing through nearly 60 MB of traffic on every single commit?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once I actually looked under the hood of our GitLab CI pipeline today, I found two classic infrastructure traps hiding in plain sight.&lt;/p&gt;




&lt;h2&gt;
  
  
  Trap #1: Caching &lt;code&gt;node_modules/&lt;/code&gt; When &lt;code&gt;before_script&lt;/code&gt; Runs &lt;code&gt;npm ci&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Like most GitLab CI templates for Node projects, my &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; originally cached &lt;code&gt;node_modules/&lt;/code&gt; between builds and ran &lt;code&gt;npm ci&lt;/code&gt; at the start of the build stage:&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;cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;node_modules/&lt;/span&gt;

&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;build&lt;/span&gt;
  &lt;span class="na"&gt;before_script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm ci&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm run build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Spot the contradiction?&lt;/p&gt;

&lt;p&gt;By design, &lt;strong&gt;&lt;code&gt;npm ci&lt;/code&gt; deletes the entire &lt;code&gt;node_modules/&lt;/code&gt; directory&lt;/strong&gt; before installing a clean slate from &lt;code&gt;package-lock.json&lt;/code&gt;. That means caching &lt;code&gt;node_modules/&lt;/code&gt; in GitLab CI was doing nothing except wasting time zipping and unzipping an archive that &lt;code&gt;npm ci&lt;/code&gt; immediately nuked on line one.&lt;/p&gt;

&lt;p&gt;Worse yet, both Astro’s image optimization cache (&lt;code&gt;node_modules/.astro/assets/&lt;/code&gt;, holding 284 responsive WebP variants of my &lt;a href="https://www.stuurman.com/photography/" rel="noopener noreferrer"&gt;photography&lt;/a&gt; gallery) and our custom Satori + Resvg Open Graph card cache (&lt;code&gt;node_modules/.cache/og-images/&lt;/code&gt;, holding 140 generated 1200×630 PNGs) lived &lt;em&gt;inside&lt;/em&gt; &lt;code&gt;node_modules/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Locally, warm builds finished in &lt;strong&gt;1.6 seconds&lt;/strong&gt; because both caches hit 100%. In CI, &lt;code&gt;npm ci&lt;/code&gt; wiped both caches on every run, forcing the runner to re-encode 284 WebP photos and rasterize 140 Open Graph images from scratch every single time.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fix: Move Build Caches Out of &lt;code&gt;node_modules/&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The fix was to separate the package manager cache from the build artifact cache and move both outside &lt;code&gt;node_modules/&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In &lt;code&gt;astro.config.mjs&lt;/code&gt;, we pointed Astro’s cache directory to &lt;code&gt;./.cache/astro&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;   &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="n"&gt;cacheDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'./.cache/astro'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
     &lt;span class="c1"&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;ol&gt;
&lt;li&gt;In our Open Graph generator (&lt;code&gt;generateOgImage.ts&lt;/code&gt;), we moved the SHA-256 content-addressed PNG cache to &lt;code&gt;./.cache/og-images/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;In &lt;code&gt;.gitlab-ci.yml&lt;/code&gt;, we cached &lt;code&gt;.cache/&lt;/code&gt; and &lt;code&gt;.npm/&lt;/code&gt; keyed on &lt;code&gt;package-lock.json&lt;/code&gt;, and switched &lt;code&gt;npm ci&lt;/code&gt; to pull from the local &lt;code&gt;.npm&lt;/code&gt; tarball cache offline:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;package-lock.json&lt;/span&gt;
  &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.cache/&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.npm/&lt;/span&gt;

&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcr.microsoft.com/playwright:v1.64.1-noble&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;build&lt;/span&gt;
  &lt;span class="na"&gt;before_script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm ci --cache .npm --prefer-offline&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;mkdir dist&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npx playwright install chromium&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm run build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;npm ci&lt;/code&gt; can blow away &lt;code&gt;node_modules/&lt;/code&gt; all it wants—&lt;code&gt;.cache/astro&lt;/code&gt; and &lt;code&gt;.cache/og-images&lt;/code&gt; sit safely outside the blast radius, dropping warm build times from ~60 seconds down to ~1.6 seconds.&lt;/p&gt;




&lt;h2&gt;
  
  
  Trap #2: Why &lt;code&gt;aws s3 sync&lt;/code&gt; Re-Uploads Identical Files in CI
&lt;/h2&gt;

&lt;p&gt;With the build stage sorted, I looked at the &lt;code&gt;deploytos3&lt;/code&gt; stage:&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;deploytos3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploytos3&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;cd ./dist&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;aws s3 sync . s3://example-bucket-primary/ --delete&lt;/span&gt;
    &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;aws cloudfront create-invalidation --distribution-id EXXXXXXXXXXXXX --paths '/*'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There’s a widespread assumption that &lt;code&gt;aws s3 sync&lt;/code&gt; hashes your files and only uploads what changed. &lt;strong&gt;It doesn’t.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By default, &lt;code&gt;aws s3 sync&lt;/code&gt; compares only two things: &lt;strong&gt;file size&lt;/strong&gt; and &lt;strong&gt;last-modified timestamp (&lt;code&gt;mtime&lt;/code&gt;)&lt;/strong&gt;. If a local file has the exact same size as the object in S3 &lt;em&gt;but&lt;/em&gt; its local &lt;code&gt;mtime&lt;/code&gt; is newer than the S3 object’s timestamp, &lt;code&gt;aws s3 sync&lt;/code&gt; assumes the file was modified and uploads it again.&lt;/p&gt;

&lt;p&gt;In a static site CI pipeline, &lt;code&gt;npm run build&lt;/code&gt; generates a brand-new &lt;code&gt;dist/&lt;/code&gt; folder on every run. Every single HTML file, RSS feed, Open Graph PNG, and WebP photo gets a brand-new &lt;code&gt;mtime&lt;/code&gt; of "right now." So &lt;code&gt;aws s3 sync&lt;/code&gt; dutifully re-uploaded all &lt;strong&gt;592 files (58 MB)&lt;/strong&gt; on every push.&lt;/p&gt;

&lt;p&gt;And because my primary Tokyo bucket (&lt;code&gt;ap-northeast-1&lt;/code&gt;) replicates via S3 Cross-Region Replication to secondary buckets across Europe, the US, Asia-Pacific, and South America behind our &lt;a href="https://www.stuurman.com/blog/2025-12-6-aws-mrap-s3-lambda-cloudfront/" rel="noopener noreferrer"&gt;S3 Multi-Region Access Point&lt;/a&gt;, every single redundant &lt;code&gt;PUT&lt;/code&gt; was multiplied across the globe—followed by a blanket &lt;code&gt;/*&lt;/code&gt; CloudFront invalidation that dumped the edge cache for the whole site.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    Build["Astro Build (dist/)&amp;lt;br/&amp;gt;592 files with fresh mtime"] --&amp;gt; Sync["s3-deploy.sh&amp;lt;br/&amp;gt;MD5 vs S3 ETag diff"]
    Sync --&amp;gt;|Unchanged MD5| Skip["Skip Upload (0 PUTs)"]
    Sync --&amp;gt;|Changed / New| Upload["Upload Only Delta&amp;lt;br/&amp;gt;+ Targeted CF Invalidation"]&lt;/code&gt;&lt;/pre&gt;






&lt;h2&gt;
  
  
  Writing an MD5/ETag-Aware Deploy Script (And a Container Gotcha)
&lt;/h2&gt;

&lt;p&gt;To make deploys genuinely incremental without relying on local filesystem timestamps, we wrote a custom &lt;code&gt;s3-deploy.sh&lt;/code&gt; script.&lt;/p&gt;

&lt;p&gt;Instead of trusting &lt;code&gt;mtime&lt;/code&gt;, the script queries S3 once via &lt;code&gt;aws s3api list-objects-v2&lt;/code&gt; to grab the &lt;code&gt;Key&lt;/code&gt; and &lt;code&gt;ETag&lt;/code&gt; (which for non-multipart objects is simply the hex MD5 digest) of every object currently in the bucket, hashes the local files in &lt;code&gt;dist/&lt;/code&gt;, and only uploads files that are new or whose MD5 actually changed.&lt;/p&gt;

&lt;h3&gt;
  
  
  The First Attempt: &lt;code&gt;python3: command not found&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;My first draft used a short inline &lt;code&gt;python3&lt;/code&gt; snippet to parse the JSON response from &lt;code&gt;list-objects-v2&lt;/code&gt; and compute the MD5 diff. It ran great on macOS—and immediately faceplanted in GitLab CI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./scripts/s3-deploy.sh: line 27: python3: command not found
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though AWS CLI v2 is written in Python, the &lt;code&gt;registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest&lt;/code&gt; container ships a self-contained embedded runtime for &lt;code&gt;aws&lt;/code&gt; and strips out a standalone &lt;code&gt;python3&lt;/code&gt; binary (as well as &lt;code&gt;jq&lt;/code&gt;). What &lt;em&gt;is&lt;/em&gt; inside the container? Standard POSIX/GNU coreutils: &lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;find&lt;/code&gt;, &lt;code&gt;md5sum&lt;/code&gt;, &lt;code&gt;sort&lt;/code&gt;, and &lt;code&gt;tr&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;And honestly, when you have &lt;code&gt;aws --query&lt;/code&gt; and &lt;code&gt;awk&lt;/code&gt;, you don't need Python at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Final Zero-Dependency POSIX Script
&lt;/h3&gt;

&lt;p&gt;By asking the AWS CLI to format its output as tab-separated text (&lt;code&gt;--query 'Contents[].[Key, ETag, Size]' --output text&lt;/code&gt;), we can feed the remote inventory and a single batch &lt;code&gt;find ... -exec md5sum {} +&lt;/code&gt; pass directly into &lt;code&gt;awk&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; -euo pipefail

&lt;span class="nv"&gt;BUCKET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${S3_BUCKET:-example-bucket-primary}"&lt;/span&gt;
&lt;span class="nv"&gt;DIST_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${CLOUDFRONT_DISTRIBUTION_ID:-EXXXXXXXXXXXXX}"&lt;/span&gt;
&lt;span class="nv"&gt;DIST_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"${1:-./dist}"&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; ! -d &lt;span class="s2"&gt;"$DIST_DIR"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Error: build output directory '$DIST_DIR' does not exist."&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;2
  &lt;span class="nb"&gt;exit&lt;/span&gt; 1
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"$DIST_DIR"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"==&amp;gt; Fetching remote object inventory from s3://${BUCKET} ..."&lt;/span&gt;
&lt;span class="nv"&gt;REMOTE_TSV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(mktemp)"&lt;/span&gt;
&lt;span class="c"&gt;# Output tab-separated lines: Key \t ETag \t Size&lt;/span&gt;
aws s3api list-objects-v2 \
  --bucket &lt;span class="s2"&gt;"$BUCKET"&lt;/span&gt; \
  --query &lt;span class="s1"&gt;'Contents[].[Key, ETag, Size]'&lt;/span&gt; \
  --output text &lt;span class="o"&gt;|&lt;/span&gt; tr -d &lt;span class="s1"&gt;'"'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$REMOTE_TSV"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"==&amp;gt; Remote inventory complete."&lt;/span&gt;

&lt;span class="nv"&gt;LOCAL_TSV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(mktemp)"&lt;/span&gt;
&lt;span class="c"&gt;# Compute MD5 for all local files in a single batch (Linux md5sum + macOS md5 -r fallback)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; -v md5sum &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt;1&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  find . -type f -exec md5sum &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; + &lt;span class="o"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;'s|  \./|\t|'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$LOCAL_TSV"&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  find . -type f -exec md5 -r &lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt; + &lt;span class="o"&gt;|&lt;/span&gt; sed &lt;span class="s1"&gt;'s| \./|\t|'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$LOCAL_TSV"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="nv"&gt;PLAN_FILE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(mktemp)"&lt;/span&gt;

awk -F&lt;span class="s1"&gt;'\t'&lt;/span&gt; &lt;span class="s1"&gt;'
  NR == FNR {
    if (NF &amp;gt;= 2 &amp;amp;&amp;amp; $1 != "None") {
      remote_etag[$1] = $2
      remote_size[$1] = $3
    }
    next
  }
  {
    md5 = $1
    key = $2
    local_seen[key] = 1
    if (!(key in remote_etag)) {
      print "UPLOAD\t" key
    } else if (remote_etag[key] != md5) {
      # Skip multipart ETag false-positives on immutable _astro/ assets
      if (index(remote_etag[key], "-") &amp;gt; 0 &amp;amp;&amp;amp; index(key, "_astro/") == 1) {
        next
      }
      print "UPLOAD\t" key
    }
  }
  END {
    for (k in remote_etag) {
      if (!(k in local_seen)) {
        print "DELETE\t" k
      }
    }
  }
'&lt;/span&gt; &lt;span class="s2"&gt;"$REMOTE_TSV"&lt;/span&gt; &lt;span class="s2"&gt;"$LOCAL_TSV"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sort -k1,1r -k2,2 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"$PLAN_FILE"&lt;/span&gt;

rm -f &lt;span class="s2"&gt;"$REMOTE_TSV"&lt;/span&gt; &lt;span class="s2"&gt;"$LOCAL_TSV"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once &lt;code&gt;awk&lt;/code&gt; emits the &lt;code&gt;UPLOAD&lt;/code&gt; and &lt;code&gt;DELETE&lt;/code&gt; plan, the second half of the script applies the changes and collects only the mutable URL paths that actually changed for CloudFront:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;UPLOAD_COUNT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
&lt;span class="nv"&gt;DELETE_COUNT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0
&lt;span class="nv"&gt;CHANGED_PATHS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;$'\t'&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; -r action key&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt; -z &lt;span class="s2"&gt;"${action:-}"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;continue&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$action"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"UPLOAD"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nv"&gt;UPLOAD_COUNT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;UPLOAD_COUNT + 1&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$key"&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; _astro/* &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
      aws s3 cp &lt;span class="s2"&gt;"$key"&lt;/span&gt; &lt;span class="s2"&gt;"s3://${BUCKET}/${key}"&lt;/span&gt; \
        --cache-control &lt;span class="s2"&gt;"public, max-age=31536000, immutable"&lt;/span&gt; \
        --only-show-errors
    &lt;span class="k"&gt;else&lt;/span&gt;
      aws s3 cp &lt;span class="s2"&gt;"$key"&lt;/span&gt; &lt;span class="s2"&gt;"s3://${BUCKET}/${key}"&lt;/span&gt; \
        --only-show-errors
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$key"&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; */index.html &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
        CHANGED_PATHS+=&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/${key%index.html}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        CHANGED_PATHS+=&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/${key}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$key"&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"index.html"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
        CHANGED_PATHS+=&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        CHANGED_PATHS+=&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/index.html"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;else&lt;/span&gt;
        CHANGED_PATHS+=&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/${key}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;fi&lt;/span&gt;
    &lt;span class="k"&gt;fi&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"  [uploaded] $key"&lt;/span&gt;
  &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$action"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"DELETE"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="nv"&gt;DELETE_COUNT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;DELETE_COUNT + 1&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    aws s3 rm &lt;span class="s2"&gt;"s3://${BUCKET}/${key}"&lt;/span&gt; --only-show-errors
    CHANGED_PATHS+=&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/${key}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"  [deleted]  $key"&lt;/span&gt;
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="s2"&gt;"$PLAN_FILE"&lt;/span&gt;

rm -f &lt;span class="s2"&gt;"$PLAN_FILE"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"==&amp;gt; Sync summary: ${UPLOAD_COUNT} uploaded, ${DELETE_COUNT} deleted."&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"${#CHANGED_PATHS[@]}"&lt;/span&gt; -eq 0 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"==&amp;gt; No mutable routes changed; skipping CloudFront invalidation."&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"${#CHANGED_PATHS[@]}"&lt;/span&gt; -gt 25 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"==&amp;gt; ${#CHANGED_PATHS[@]} paths changed (&amp;gt;25); invalidating /* on CloudFront (${DIST_ID})..."&lt;/span&gt;
  aws cloudfront create-invalidation --distribution-id &lt;span class="s2"&gt;"$DIST_ID"&lt;/span&gt; --paths &lt;span class="s2"&gt;"/*"&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
  &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"==&amp;gt; Invalidating ${#CHANGED_PATHS[@]} changed path(s) on CloudFront (${DIST_ID})..."&lt;/span&gt;
  aws cloudfront create-invalidation --distribution-id &lt;span class="s2"&gt;"$DIST_ID"&lt;/span&gt; --paths &lt;span class="s2"&gt;"${CHANGED_PATHS[@]}"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Tip&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Standalone CI/CD Action &amp;amp; Component&lt;/strong&gt;: This ETag delta sync and 4-tier caching script is packaged standalone as &lt;a href="https://github.com/edstuurman/s3-cloudfront-etag-deploy" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;s3-cloudfront-etag-deploy&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; and available directly on &lt;a href="https://github.com/marketplace/actions/s3-cloudfront-etag-deploy" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub Marketplace&lt;/strong&gt;&lt;/a&gt; (&lt;code&gt;uses: edstuurman/s3-cloudfront-etag-deploy@v1&lt;/code&gt;) and the &lt;a href="https://gitlab.com/explore/catalog/edstuurman/s3-cloudfront-etag-deploy" rel="noopener noreferrer"&gt;&lt;strong&gt;GitLab CI/CD Catalog&lt;/strong&gt;&lt;/a&gt; (&lt;code&gt;component: gitlab.com/edstuurman/s3-cloudfront-etag-deploy/deploy@1.2.0&lt;/code&gt;).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What This Buys Us
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Zero Redundant S3 Uploads &amp;amp; Replication:&lt;/strong&gt; When I fix a typo in a single blog post, the deploy stage now uploads only the 4–5 files whose MD5 actually changed (the post HTML, the blog index, the RSS/Atom/LLM feeds) instead of pushing all 592 files and 58 MB across every replicated S3 region.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long-Lived Immutable Caching on &lt;code&gt;_astro/*&lt;/code&gt;:&lt;/strong&gt; Content-hashed bundles and WebP photos in &lt;code&gt;_astro/*&lt;/code&gt; now get &lt;code&gt;Cache-Control: public, max-age=31536000, immutable&lt;/code&gt; headers on upload, and never trigger a CloudFront invalidation since their filenames are already content-addressed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Surgical CloudFront Invalidations:&lt;/strong&gt; If fewer than 25 mutable routes changed, we invalidate only those exact paths so every other page stays warm at CloudFront edge locations worldwide (and if a site-wide layout tweak touches more than 25 paths, it falls back to &lt;code&gt;/*&lt;/code&gt; so we stay well inside CloudFront’s free monthly invalidation tier).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Sometimes the best infrastructure improvements aren't adding new services—they're noticing where your defaults are quietly doing 100× more work than necessary.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-01-optimizing-gitlab-ci-s3-deployments/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-01-optimizing-gitlab-ci-s3-deployments/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>cicd</category>
      <category>aws</category>
      <category>infrastructure</category>
      <category>performance</category>
    </item>
    <item>
      <title>Tin Cans, Power Tools, Piano Keys, and Slide Decks: Giving a Preteen Real Tools</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Fri, 27 Nov 2026 12:09:11 +0000</pubDate>
      <link>https://dev.to/edstuurman/tin-cans-power-tools-piano-keys-and-slide-decks-giving-a-preteen-real-tools-316o</link>
      <guid>https://dev.to/edstuurman/tin-cans-power-tools-piano-keys-and-slide-decks-giving-a-preteen-real-tools-316o</guid>
      <description>&lt;p&gt;Most of what I write on this site revolves around cloud routing, homelab servers, Terraform state files, or convincing six Wi-Fi access points to stop yelling over each other.&lt;/p&gt;

&lt;p&gt;Yet one of my favorite networking deployments of the year had &lt;strong&gt;zero IP addresses, zero batteries, zero firmware updates, and a &lt;code&gt;v1.0&lt;/code&gt; bill of materials consisting of two empty tin cans and a spool of fishing line&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of poking a jagged hole in the bottom of the cans with a kitchen nail like we did in the nineties, my preteen and I treated it like a proper shop job: workbench cleared, cans clamped down, cordless drill chucked up, and one focused kid suited up in &lt;strong&gt;proper safety gear&lt;/strong&gt;, handling the drill with the calm, unmistakable pride of someone trusted with real power tools.&lt;/p&gt;

&lt;p&gt;Testing that link across the house (and immediately discovering why fishing line needs a &lt;code&gt;Layer 1&lt;/code&gt; backbone upgrade) got me thinking about how preteens experience technology today, and what happens when you swap sealed touchscreens for real tools with visible seams.&lt;/p&gt;

&lt;h2&gt;
  
  
  Growing Up Surrounded by Sealed Glass Slabs
&lt;/h2&gt;

&lt;p&gt;If you grew up in the 1980s, 1990s, or early 2000s, the technology around you had &lt;strong&gt;seams&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Radios had battery doors and tuning dials. Bicycles had exposed chains that inevitably left grease stripes on your calves. Desktop PCs were beige steel towers held together by thumbscrews; pop the side panel off and you could trace a flat ribbon cable straight from the motherboard to the spinning drive holding your files. Even dialing into the internet played its physical handshake out loud through a speaker so you could &lt;em&gt;hear&lt;/em&gt; two modems negotiating over copper wire.&lt;/p&gt;

&lt;p&gt;Today's preteens are surrounded by &lt;strong&gt;sealed glass slabs&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Phones and tablets are marvels of industrial design, and terrible teachers of how things work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Everything is glued shut behind glass. There are no screws, no visible wires, and no user-serviceable parts.&lt;/li&gt;
&lt;li&gt;Filesystems are hidden behind app grids, networks are invisible, and typing means poking flat pixels with two thumbs.&lt;/li&gt;
&lt;li&gt;When something misbehaves on a tablet, you don't inspect the mechanism to see what slipped. You swipe the app away, reboot it, or wait for an update.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the preteen age, right when curiosity and independence are kicking into high gear, kids don't want watered-down "kid versions" of things. They want to know how the real thing works.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Tools, Real Safety Gear, Zero Patronizing
&lt;/h2&gt;

&lt;p&gt;Adults often fall into an all-or-nothing trap with workshop tools: either steering kids away from anything sharper than safety scissors, or hovering so anxiously that the kid never actually holds the tool.&lt;/p&gt;

&lt;p&gt;Preteens spot fake responsibility from a mile away. Hand them real safety glasses and ear defenders, treat proper safety gear as the normal ritual of a real workshop, and the whole dynamic shifts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ownership kicks in immediately.&lt;/strong&gt; Gearing up properly signals &lt;em&gt;"this isn't pretend; we're using real equipment and you're trusted to run it safely."&lt;/em&gt; You can practically see their posture straighten up at the bench.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Respect replaces mystery.&lt;/strong&gt; A cordless drill stops being an off-limits adult gadget and becomes an understandable machine with clear physics: clamp the workpiece so sheet metal can't catch and spin, check your hand placement, glasses down, squeeze the trigger smoothly, and deburr the sharp edge around the hole before threading the line.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By the time the knots were tied inside both cans, that look of satisfaction came from the quiet confidence of having run the drill cleanly themselves.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging &lt;code&gt;Layer 1&lt;/code&gt; Attenuation (Fishing Line vs. Copper)
&lt;/h2&gt;

&lt;p&gt;The best thing about building a tin-can telephone from whatever is sitting in the drawer is that &lt;strong&gt;physics immediately grades your cable choice&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We strung &lt;code&gt;v1.0&lt;/code&gt; with &lt;strong&gt;nylon fishing line&lt;/strong&gt;, which seemed clever right up until we ran link tests across the room:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Leave the line slack&lt;/strong&gt;: &lt;strong&gt;100% packet loss.&lt;/strong&gt; Dead silence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pull it tight&lt;/strong&gt;: Link up: a voice comes buzzing out of the bottom of the can, &lt;em&gt;barely&lt;/em&gt;, followed by the realization that &lt;strong&gt;fishing line attenuates like crazy&lt;/strong&gt;. Nylon monofilament is literally engineered to stretch like a shock absorber when a fish strikes, which turns out to be terrible when you want crisp acoustic vibrations instead of a microscopic bungee cord eating half your signal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pinch the line mid-span or touch a doorframe&lt;/strong&gt;: Instant drop—you can feel your fingertips damping whatever energy was left.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So naturally, we now have an open &lt;strong&gt;&lt;code&gt;Layer 1&lt;/code&gt; backbone upgrade ticket&lt;/strong&gt;: swapping out the lossy nylon fishing line for &lt;strong&gt;proper thin copper wire&lt;/strong&gt; (or zero-stretch braided line) so the vibrations stop getting absorbed mid-span.&lt;/p&gt;

&lt;p&gt;Ten minutes with two drilled cans and a stretchy fishing line teaches something a lifetime of Wi-Fi bars hides: &lt;strong&gt;communication is physical energy fighting its way down an imperfect medium&lt;/strong&gt;, and sometimes you really do just need better copper.&lt;/p&gt;

&lt;h2&gt;
  
  
  Piano Bench, Typing Games, and a Minecraft Slide Deck
&lt;/h2&gt;

&lt;p&gt;That same principle, giving them the real instrument instead of a simplified toy, has been playing out at the computer desk in ways I didn't even fully anticipate.&lt;/p&gt;

&lt;p&gt;Plenty of kids who grew up thumb-typing on glass reach high school still hunting-and-pecking on laptops. Putting a preteen at a real computer with a proper physical keyboard and mouse unlocks a completely different set of habits.&lt;/p&gt;

&lt;p&gt;Two things happened almost side by side at home recently:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Piano ↔ Touch-Typing Crossover
&lt;/h3&gt;

&lt;p&gt;They started playing &lt;strong&gt;typing games&lt;/strong&gt; on the computer right around the same stretch where their &lt;strong&gt;piano playing has been improving at a staggering rate&lt;/strong&gt;—and watching those two skills cross-pollinate in real time has been wild.&lt;/p&gt;

&lt;p&gt;Physically, touch-typing and playing the piano are cousins: &lt;strong&gt;eyes up on the screen or the sheet music, ten fingers anchored by pure tactile feel, left and right hands firing independently without looking down&lt;/strong&gt;. Watching two-handed finger dexterity on the piano bench accelerate their speed on a computer keyboard (and vice versa) is one of those compounding skill loops a flat glass screen simply cannot teach.&lt;/p&gt;

&lt;h3&gt;
  
  
  Turning Player Into Presenter: The Minecraft Mechanics Deck
&lt;/h3&gt;

&lt;p&gt;With a real keyboard, mouse, and file tree under their fingers, the computer stops being a passive screen for watching &lt;em&gt;other&lt;/em&gt; people talk about games and turns into a studio for making things.&lt;/p&gt;

&lt;p&gt;Recently, they decided to build a &lt;strong&gt;PowerPoint presentation breaking down Minecraft mechanics&lt;/strong&gt;, putting almost the entire slide deck together independently, with only light coaching from the sidelines when they hit a snag.&lt;/p&gt;

&lt;p&gt;Watching that deck come together hit every engineering-parent note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Systems Thinking in Disguise&lt;/strong&gt;: Beneath the blocky graphics, Minecraft is full of state machines, crafting dependencies, mob rules, and cause-and-effect mechanics. Taking a complex mental model and organizing it slide by slide so &lt;em&gt;another person&lt;/em&gt; can understand how it works is, quite literally, half of what senior engineers and program managers do all week.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real Authoring Fluency&lt;/strong&gt;: Naming and saving files, structuring headings, laying out screenshots, tweaking visual hierarchy, and leaning on keyboard shortcuts until the tool gets out of the way of the idea.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Discipline of Sitting on Your Hands&lt;/strong&gt;: For a parent who lives at a keyboard, the hardest part of "gentle coaching" is keeping your hands firmly in your pockets instead of reaching for the mouse to nudge a text box two pixels to the left. Answering only what they ask and letting &lt;em&gt;them&lt;/em&gt; drive every slide is what makes the finished presentation genuinely theirs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Leaving the Seams Visible
&lt;/h2&gt;

&lt;p&gt;Specific software, frameworks, and cloud consoles will look unrecognizable ten years from now. None of the interfaces we use in 2026 are the point.&lt;/p&gt;

&lt;p&gt;What &lt;em&gt;does&lt;/em&gt; carry forward is the muscle memory (literal and mental) of engaging with real tools: clamping metal down safely under a drill bit, figuring out why stretchy fishing line needs a copper upgrade, letting ten fingers fly across piano keys and mechanical switches alike, and structuring what you know into something clear enough to teach someone else.&lt;/p&gt;

&lt;p&gt;Between a proud preteen in safety glasses testing a freshly drilled tin-can link and getting a structured briefing on Minecraft mechanics from a self-made slide deck, no multi-region cloud deployment comes close.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-27-tin-cans-power-tools-and-real-computers/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-27-tin-cans-power-tools-and-real-computers/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>reflection</category>
      <category>hardware</category>
      <category>networking</category>
      <category>engineering</category>
    </item>
    <item>
      <title>Replacing a Synology NAS With DIY Open Source—And When Not To</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Wed, 25 Nov 2026 00:09:26 +0000</pubDate>
      <link>https://dev.to/edstuurman/replacing-a-synology-nas-with-diy-open-source-and-when-not-to-3adn</link>
      <guid>https://dev.to/edstuurman/replacing-a-synology-nas-with-diy-open-source-and-when-not-to-3adn</guid>
      <description>&lt;p&gt;I have never owned a Synology. Not because I think they are bad—quite the opposite. I skipped the turnkey NAS on purpose, for two plain reasons: I wanted control over the whole software stack, and I wanted more performance per yen than a marked-up appliance box can give.&lt;/p&gt;

&lt;p&gt;And yet, when a friend or relative asks me how to get their photos and backups off a cloud subscription, I tell them to buy a Synology. Right from the start. No detour through Proxmox, no pitch for self-hosting.&lt;/p&gt;

&lt;p&gt;Both of those things are true at the same time, and this post is about why.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Question Everyone Keeps Asking
&lt;/h2&gt;

&lt;p&gt;This week the &lt;a href="https://blog.adafruit.com/2026/11/18/can-you-replace-a-synology-nas-with-open-source-projects/" rel="noopener noreferrer"&gt;Adafruit Blog asked whether you can replace a Synology NAS with open source projects&lt;/a&gt;, pointing to SpaceRex's breakdown (covered by Julian Horsey at Geeky Gadgets) of rebuilding Synology DiskStation Manager (DSM) out of open-source parts.&lt;/p&gt;

&lt;p&gt;The short version of his map:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Core NAS OS&lt;/strong&gt;: &lt;code&gt;TrueNAS Community Edition&lt;/code&gt; (formerly &lt;code&gt;TrueNAS SCALE&lt;/code&gt;) or &lt;code&gt;OpenMediaVault&lt;/code&gt; stand in for DSM itself—capable, but without DSM's polish or its simple handling of users and permissions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File sync&lt;/strong&gt;: &lt;code&gt;Nextcloud&lt;/code&gt; stands in for Synology Drive and Synology Office.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Photos&lt;/strong&gt;: &lt;code&gt;Immich&lt;/code&gt; stands in for Synology Photos. It is fast and handles modern phone formats like HEIC well, but it is a standalone app rather than part of one integrated system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud sync&lt;/strong&gt;: &lt;code&gt;rclone&lt;/code&gt; stands in for Cloud Sync, with far more providers but a command line instead of a friendly panel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cameras&lt;/strong&gt;: &lt;code&gt;motionEye&lt;/code&gt; or &lt;code&gt;Frigate&lt;/code&gt; stand in for Surveillance Station.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then come the two stubborn gaps where open source still trails. The first is license-free, whole-machine backups of every PC and laptop in the house, which Synology ships as &lt;code&gt;Active Backup for Business&lt;/code&gt;. The second is effortless, application-consistent versioned backups of the NAS and its apps, which &lt;code&gt;Hyper Backup&lt;/code&gt; makes almost boring.&lt;/p&gt;

&lt;p&gt;That list matches my own experience closely. Every individual piece has an excellent open-source answer. The hard part is everything &lt;em&gt;between&lt;/em&gt; the pieces.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Why I Skipped the Box Anyway
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Control Over the Software Stack
&lt;/h3&gt;

&lt;p&gt;A turnkey NAS is a vendor's opinion about how your home server should work. That opinion is usually a good one, but it is still theirs: their app center, their update cadence, their list of approved drives, their idea of what a container should be allowed to do.&lt;/p&gt;

&lt;p&gt;I wanted to pick every layer myself. Proxmox VE as the hypervisor. Unprivileged Linux containers for each service. &lt;code&gt;Authelia&lt;/code&gt; in front of everything for sign-in, &lt;code&gt;Caddy&lt;/code&gt; as the front door, and &lt;code&gt;NetBird&lt;/code&gt; for reaching home from the train. &lt;code&gt;Immich&lt;/code&gt; for photos, &lt;code&gt;Seafile&lt;/code&gt; for files, &lt;code&gt;Stalwart&lt;/code&gt; for mail. None of those choices depend on a vendor's UI deciding to support them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance Per Yen
&lt;/h3&gt;

&lt;p&gt;The second reason is simpler arithmetic. A NAS appliance prices in the enclosure, the software, and the support. Commodity or used server hardware running Proxmox gives far more CPU cores, RAM, and NVMe headroom for the same money, and that headroom matters once photo indexing, local search, and lightweight embedding or AI services share the same machine.&lt;/p&gt;

&lt;p&gt;The catch is the electricity meter. In Japan, idle watts are not an abstraction; they show up on the bill every month. Raw horsepower is only a bargain if it sleeps quietly most of the day, which is a lesson I wrote about in &lt;a href="https://www.stuurman.com/blog/2026-11-08-the-sunk-cost-of-homelab-sprawl-knowing-when-to-liquidate-silicon/" rel="noopener noreferrer"&gt;the sunk cost of homelab sprawl&lt;/a&gt;. More silicon per yen is the goal; more silicon humming at idle is not.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. What a DIY Replacement Actually Takes
&lt;/h2&gt;

&lt;p&gt;Here is the honest part: my stack is still being built.&lt;/p&gt;

&lt;p&gt;The containers run. The individual apps are good. But a pile of good apps is not a product. Each one had its own login flow, its own interface, and its own idea of what a phone screen looks like. That is why I ended up building &lt;a href="https://www.stuurman.com/blog/2026-11-19-the-helmsmans-bridge-building-a-unified-homelab-command-deck/" rel="noopener noreferrer"&gt;The Bridge&lt;/a&gt;—a single front door that pulls mail, photos, files, and calendars into one calm interface. In other words, I am slowly hand-writing the glue code that Synology already ships in DSM.&lt;/p&gt;

&lt;p&gt;And getting Docker containers to start was never the real test. The real test is sitting across the dinner table.&lt;/p&gt;

&lt;p&gt;I hope my wife ends up using it too. Feature parity on paper doesn't mean much if the apps feel clunky, or if she has any reason to doubt our family photos will still be there next year. When photo backups run quietly in the background and nobody has to think about which container handles what, it becomes a real home system. Until then, it's just my hobby.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criteria&lt;/th&gt;
&lt;th&gt;Turnkey NAS (Synology DSM)&lt;/th&gt;
&lt;th&gt;DIY Open-Source Stack&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance per yen&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Modest CPU and RAM for the price; you pay for the enclosure and software&lt;/td&gt;
&lt;td&gt;Far more cores, RAM, and NVMe per yen on commodity hardware—if idle power is watched&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Software control&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vendor app center, vendor update schedule, approved-drive lists&lt;/td&gt;
&lt;td&gt;Every layer chosen by you: hypervisor, containers, auth, apps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Integrated backups &amp;amp; UX&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Hyper Backup&lt;/code&gt; and &lt;code&gt;Active Backup for Business&lt;/code&gt; in one consistent UI&lt;/td&gt;
&lt;td&gt;Excellent pieces, but you assemble backups and a unified front end yourself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Household adoption bar&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Polished mobile apps that family members can use on day one&lt;/td&gt;
&lt;td&gt;Only passes once it feels as simple and trustworthy as the box&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Maintenance burden&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vendor owns updates, glue code, and the support forum&lt;/td&gt;
&lt;td&gt;You own every update, every breakage, and every 2FA reset&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  4. Why I Still Tell Friends to Buy the Synology
&lt;/h2&gt;

&lt;p&gt;When a neighbor asks how to stop paying for cloud photo storage, they are not asking for a hobby. They are asking for a place where their photos are safe, their laptops get backed up, and nothing needs attention on a weekend.&lt;/p&gt;

&lt;p&gt;So I tell them to buy a turnkey NAS, a Synology or something like it, from the get-go. I do not open with self-hosting and then fall back to the box once they look tired.&lt;/p&gt;

&lt;p&gt;The hardware markup is not wasted money. It pays someone else to own the glue code, the unified interface, the backup tooling, and the long tail of maintenance. Those are exactly the parts that take me the longest, and exactly the parts SpaceRex flags as the gaps open source has not closed. For most households, that markup is the best money they will spend on the whole setup.&lt;/p&gt;

&lt;p&gt;DIY makes sense when the building &lt;em&gt;is&lt;/em&gt; the point—when someone genuinely enjoys owning every layer and accepts that they are now the support desk for their family.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
  Start["Want photos and backups off cloud subscriptions?"] --&amp;gt; Q1{"Do you enjoy building and maintaining servers?"}
  Q1 --&amp;gt;|"No"| Buy["Buy a turnkey NAS (Synology or similar)"]
  Q1 --&amp;gt;|"Yes"| Q2{"Do you need whole-PC backups and easy snapshots today?"}
  Q2 --&amp;gt;|"Yes"| Buy
  Q2 --&amp;gt;|"No"| Q3{"Will you be the family support desk?"}
  Q3 --&amp;gt;|"No"| Buy
  Q3 --&amp;gt;|"Yes"| DIY["Build a DIY stack (Proxmox, Immich, Seafile)"]
  DIY --&amp;gt; Test{"Does the household actually use it?"}
  Test --&amp;gt;|"Not yet"| Iterate["Keep polishing, or keep the cloud backup running"]
  Test --&amp;gt;|"Yes"| Home["It is now a home system, not a hobby"]
  Iterate --&amp;gt; Test&lt;/code&gt;&lt;/pre&gt;






&lt;h2&gt;
  
  
  5. The Quiet Takeaway
&lt;/h2&gt;

&lt;p&gt;Can you replace a Synology with open source? Piece by piece, mostly yes. As a whole, the honest answer is "eventually, with a lot of glue, and only if the people around you agree to use it."&lt;/p&gt;

&lt;p&gt;I chose the long road because I wanted the control and the headroom, and because building it is part of the fun. But I do not mistake that for advice. For almost everyone who asks, the right first step is still the box on the shelf that just works.&lt;/p&gt;

&lt;p&gt;Mine will be finished the day my wife backs up her phone without asking me how.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-24-replacing-synology-nas-with-diy-open-source/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-24-replacing-synology-nas-with-diy-open-source/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>selfhosting</category>
      <category>architecture</category>
      <category>hardware</category>
    </item>
    <item>
      <title>Part 2 (Optional) — Provisioning the Multi-Region AWS Stack with Terraform (GitLab CI, GitHub Actions &amp; Local CLI)</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Tue, 24 Nov 2026 12:35:34 +0000</pubDate>
      <link>https://dev.to/edstuurman/part-2-optional-provisioning-the-multi-region-aws-stack-with-terraform-gitlab-ci-github-2bjd</link>
      <guid>https://dev.to/edstuurman/part-2-optional-provisioning-the-multi-region-aws-stack-with-terraform-gitlab-ci-github-2bjd</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note&lt;/p&gt;
&lt;p&gt;
This is &lt;strong&gt;Part 2 (Optional)&lt;/strong&gt; of a three-part setup and deployment guide for &lt;strong&gt;The Navigator&lt;/strong&gt; (&lt;a href="https://github.com/edstuurman/the-navigator" rel="noopener noreferrer"&gt;&lt;strong&gt;GitHub&lt;/strong&gt;&lt;/a&gt; · &lt;a href="https://gitlab.com/src9061948/the-navigator" rel="noopener noreferrer"&gt;&lt;strong&gt;GitLab&lt;/strong&gt;&lt;/a&gt; · &lt;a href="https://the-navigator-sage.vercel.app/" rel="noopener noreferrer"&gt;&lt;strong&gt;Live Demo&lt;/strong&gt;&lt;/a&gt;):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.stuurman.com/blog/2026-11-03-part-1-customizing-this-astro-theme/" rel="noopener noreferrer"&gt;&lt;strong&gt;Part 1 — Customizing This Astro Theme&lt;/strong&gt;&lt;/a&gt;: Local setup, identity &amp;amp; theme configuration, and content authoring.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part 2 (Optional — You are here)&lt;/strong&gt;: Provisioning the multi-region AWS S3 MRAP + CloudFront SigV4a stack with Terraform.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.stuurman.com/blog/2026-11-03-part-3-ci-cd-pipelines-dry-run-mode-and-static-hosting/" rel="noopener noreferrer"&gt;&lt;strong&gt;Part 3 — Automated CI/CD Pipelines, Starter Dry-Run Mode &amp;amp; Deploying to Any Static Host&lt;/strong&gt;&lt;/a&gt;: Zero-config deployment to Vercel/Netlify/Cloudflare Pages, dual GitHub Actions &amp;amp; GitLab CI dry-run pipelines, and two-tier S3/CloudFront delta sync.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;[!IMPORTANT]&lt;br&gt;
&lt;strong&gt;⏱️ Automated Provisioning — Expect ~20–30 Minutes for First-Time Greenfield Creation&lt;/strong&gt;:&lt;br&gt;
While the entire infrastructure stack is automated via Terraform, provisioning from zero for the first time typically takes &lt;strong&gt;20 to 30 minutes&lt;/strong&gt; end-to-end inside AWS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ACM TLS Certificate DNS Validation (&lt;code&gt;us-east-1&lt;/code&gt;)&lt;/strong&gt;: ~2–5 minutes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;S3 Multi-Region Access Point (&lt;code&gt;aws_s3control_multi_region_access_point&lt;/code&gt;)&lt;/strong&gt;: &lt;strong&gt;~10–20 minutes&lt;/strong&gt; (AWS provisions global anycast routing tables and cross-region control plane endpoints behind the scenes)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudFront Global Edge Distribution + MRAP Policy Attachment&lt;/strong&gt;: ~5–10 minutes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Grab a coffee during your initial &lt;code&gt;terraform apply&lt;/code&gt;—subsequent runs and site deployments (&lt;code&gt;scripts/s3-deploy.sh&lt;/code&gt;) complete in &lt;strong&gt;~10–15 seconds&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In late 2025, I wrote two posts about hosting this site across multiple AWS regions using an S3 Multi-Region Access Point (MRAP) behind CloudFront (&lt;a href="https://www.stuurman.com/blog/2025-12-6-aws-mrap-s3-lambda-cloudfront/" rel="noopener noreferrer"&gt;manual setup&lt;/a&gt; and &lt;a href="https://www.stuurman.com/blog/2025-12-18-terraform-aws-mrap-s3/" rel="noopener noreferrer"&gt;initial Terraform configuration&lt;/a&gt;). Back then, connecting CloudFront to an S3 MRAP required deploying a custom Python &lt;code&gt;Lambda@Edge&lt;/code&gt; function in &lt;code&gt;us-east-1&lt;/code&gt; just to re-sign origin requests with &lt;code&gt;SigV4a&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Fast-forward to today, and the infrastructure inside this repository's &lt;code&gt;terraform/&lt;/code&gt; directory is dramatically cleaner, faster, and cheaper to operate. Four major platform improvements allowed us to delete hundreds of lines of boilerplate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Native CloudFront SigV4a Origin Access Control (OAC)&lt;/strong&gt;: CloudFront now supports &lt;code&gt;signing_protocol = "sigv4a"&lt;/code&gt; natively on S3 Multi-Region Access Point origins. &lt;code&gt;Lambda@Edge&lt;/code&gt;—along with its cold starts, IAM execution roles, and packaging scripts—is completely gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sub-Millisecond CloudFront Function at &lt;code&gt;viewer-request&lt;/code&gt;&lt;/strong&gt;: A lightweight CloudFront Function handles both naked-to-&lt;code&gt;www&lt;/code&gt; &lt;code&gt;301&lt;/code&gt; redirects (&lt;code&gt;example.com&lt;/code&gt; → &lt;code&gt;https://www.example.com&lt;/code&gt;) and static directory index rewrites (&lt;code&gt;/about/&lt;/code&gt; → &lt;code&gt;/about/index.html&lt;/code&gt;) right at the edge before requests ever touch the origin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managed Security Response Headers (&lt;code&gt;Managed-SecurityHeadersPolicy&lt;/code&gt;)&lt;/strong&gt;: Attaches AWS's managed security headers policy (&lt;code&gt;Strict-Transport-Security&lt;/code&gt;, &lt;code&gt;X-Content-Type-Options: nosniff&lt;/code&gt;, &lt;code&gt;X-Frame-Options: SAMEORIGIN&lt;/code&gt;, &lt;code&gt;Referrer-Policy&lt;/code&gt;, and &lt;code&gt;X-XSS-Protection&lt;/code&gt;) directly at the CloudFront edge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terraform &lt;code&gt;&amp;gt;= 1.10&lt;/code&gt; Native S3 Locking + AWS Provider &lt;code&gt;~&amp;gt; 6.0&lt;/code&gt; Per-Resource Region&lt;/strong&gt;: Remote state locking uses native S3 &lt;code&gt;.tflock&lt;/code&gt; lockfiles (&lt;code&gt;use_lockfile = true&lt;/code&gt;, no DynamoDB table required), and multi-region S3 buckets use the AWS Provider 6.0 per-resource &lt;code&gt;region&lt;/code&gt; attribute instead of dozens of duplicated provider aliases.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is the complete end-to-end guide to provisioning this stack for your own domain—via &lt;strong&gt;GitLab CI/CD&lt;/strong&gt;, &lt;strong&gt;GitHub Actions&lt;/strong&gt;, or your &lt;strong&gt;Local CLI&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Standalone Terraform Registry Module&lt;/strong&gt;: Prefer to consume this multi-region AWS stack directly as a reusable Terraform module without copying &lt;code&gt;terraform/&lt;/code&gt; files? It is published on the Terraform Registry as &lt;a href="https://registry.terraform.io/modules/edstuurman/mrap-static-site/aws/latest" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;edstuurman/mrap-static-site/aws&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/edstuurman/terraform-aws-mrap-static-site" rel="noopener noreferrer"&gt;GitHub source&lt;/a&gt;):&lt;/p&gt;


&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;module&lt;/span&gt; &lt;span class="s2"&gt;"mrap_static_site"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;source&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"edstuurman/mrap-static-site/aws"&lt;/span&gt;
  &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 1.0"&lt;/span&gt;

  &lt;span class="n"&gt;environment_domain&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"example.com"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Multi-Region Request &amp;amp; Replication Topology
&lt;/h2&gt;

&lt;p&gt;When deployed, your static site is replicated across your chosen AWS regions and served globally from the nearest healthy S3 bucket behind CloudFront:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    Visitor["Visitor Browser"] --&amp;gt; R53["Route 53 Public Hosted Zone&amp;lt;br/&amp;gt;(A &amp;amp; AAAA Alias Records)"]
    R53 --&amp;gt; CF["CloudFront Global Edge Network&amp;lt;br/&amp;gt;+ ACM TLS Certificate (us-east-1)"]

    subgraph Edge["CloudFront Edge Layer"]
        CFF["CloudFront Function (viewer-request)&amp;lt;br/&amp;gt;1. 301 Redirect apex → www&amp;lt;br/&amp;gt;2. Rewrite /path/ → /path/index.html"]
        OAC["Native Origin Access Control (OAC)&amp;lt;br/&amp;gt;signing_protocol = sigv4a"]
    end

    CF --&amp;gt; CFF --&amp;gt; OAC
    OAC --&amp;gt; MRAP["S3 Multi-Region Access Point (MRAP)&amp;lt;br/&amp;gt;Global Anycast Endpoint"]

    subgraph Storage["Multi-Region Private S3 Buckets (SSE-S3 + Versioning)"]
        direction TB
        B1["Primary Bucket (ap-northeast-1)&amp;lt;br/&amp;gt;is_main = true (CI/CD Upload Target)"]
        B2["Replica Bucket #1 (eu-west-1)"]
        B3["Replica Bucket #2 (us-east-1)"]

        B1 --&amp;gt;|"Cross-Region Replication (CRR)"| B2
        B1 --&amp;gt;|"Cross-Region Replication (CRR)"| B3
    end

    MRAP --&amp;gt;|"Lowest-Latency Geo-Routing &amp;amp; Failover"| Storage&lt;/code&gt;&lt;/pre&gt;






&lt;h2&gt;
  
  
  Choose Your Deployment Path
&lt;/h2&gt;

&lt;p&gt;You can provision and manage this Terraform stack using whichever workflow fits your setup:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Path&lt;/th&gt;
&lt;th&gt;Best For&lt;/th&gt;
&lt;th&gt;How It Runs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Option A — GitLab CI/CD&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Teams &amp;amp; individuals hosting their repo on &lt;strong&gt;GitLab&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Built-in &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; manual jobs (&lt;code&gt;terraform:bootstrap&lt;/code&gt; → &lt;code&gt;terraform:plan&lt;/code&gt; → &lt;code&gt;terraform:apply&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Option B — GitHub Actions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Teams &amp;amp; individuals hosting their repo on &lt;strong&gt;GitHub&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;One-time &lt;code&gt;terraform/bootstrap&lt;/code&gt; initialization + &lt;code&gt;.github/workflows/deploy.yml&lt;/code&gt; automated builds &amp;amp; S3 deploys&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Option C — Local CLI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Engineers who prefer running Terraform &amp;amp; deployments directly from their workstation&lt;/td&gt;
&lt;td&gt;Local &lt;code&gt;terraform init &amp;amp;&amp;amp; terraform apply&lt;/code&gt; + &lt;code&gt;bash ./scripts/s3-deploy.sh ./dist&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before running &lt;code&gt;terraform:bootstrap&lt;/code&gt; or &lt;code&gt;terraform:apply&lt;/code&gt;, make sure you have the following in place:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;An Active AWS Account&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Standard AWS account with default regions enabled. &lt;em&gt;(Note: CloudFront OAC for S3 Multi-Region Access Points supports all 17 default-enabled AWS regions; opt-in regions are not supported by AWS for MRAP OAC.)&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Registered Domain Hosted on Amazon Route 53&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Your root domain (e.g. &lt;code&gt;example.com&lt;/code&gt;) must already exist as a &lt;strong&gt;Public Hosted Zone&lt;/strong&gt; in Route 53 (whether registered directly through Route 53 or an external registrar).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify Nameservers (&lt;code&gt;NS&lt;/code&gt;) First&lt;/strong&gt;: If your domain was registered outside AWS, ensure its &lt;code&gt;NS&lt;/code&gt; records at your registrar already point to the four Route 53 nameservers listed in your Hosted Zone. During &lt;code&gt;terraform apply&lt;/code&gt;, &lt;code&gt;aws_acm_certificate_validation&lt;/code&gt; waits for public DNS validation of the ACM TLS certificate (&lt;code&gt;example.com&lt;/code&gt; and &lt;code&gt;*.example.com&lt;/code&gt; in &lt;code&gt;us-east-1&lt;/code&gt;); if your domain's nameservers don't delegate to Route 53 yet, certificate validation will wait until they do.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AWS IAM Credentials (&lt;code&gt;AWS_ACCESS_KEY_ID&lt;/code&gt; &amp;amp; &lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt;)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;An IAM User or CI/CD role with permissions to provision and manage:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;S3 &amp;amp; S3 Control&lt;/strong&gt;: Regional buckets, versioning, encryption, lifecycle rules, replication, and Multi-Region Access Points (&lt;code&gt;s3:*&lt;/code&gt;, &lt;code&gt;s3control:*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CloudFront&lt;/strong&gt;: Distributions, SigV4a Origin Access Control (OAC), and CloudFront Functions (&lt;code&gt;cloudfront:*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ACM (&lt;code&gt;us-east-1&lt;/code&gt;)&lt;/strong&gt;: Public SSL/TLS certificate creation and DNS validation (&lt;code&gt;acm:*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route 53&lt;/strong&gt;: Hosted Zone lookup plus ACM validation &lt;code&gt;CNAME&lt;/code&gt; and &lt;code&gt;A&lt;/code&gt; (IPv4) / &lt;code&gt;AAAA&lt;/code&gt; (IPv6) Alias records (&lt;code&gt;route53:*&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IAM&lt;/strong&gt;: Creating and attaching the least-privilege S3 Cross-Region Replication role (&lt;code&gt;iam:CreateRole&lt;/code&gt;, &lt;code&gt;iam:CreatePolicy&lt;/code&gt;, &lt;code&gt;iam:AttachRolePolicy&lt;/code&gt;, &lt;code&gt;iam:PassRole&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your Site Domain Configured in &lt;code&gt;src/site.config.ts&lt;/code&gt; (&lt;a href="https://www.stuurman.com/blog/2026-11-03-part-1-customizing-this-astro-theme/" rel="noopener noreferrer"&gt;Part 1&lt;/a&gt;)&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Ensure &lt;code&gt;site.url&lt;/code&gt; and &lt;code&gt;site.domain&lt;/code&gt; in &lt;code&gt;src/site.config.ts&lt;/code&gt; match your Route 53 domain so build-time canonical links, sitemaps, feeds, and Open Graph cards match your live infrastructure.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 1: Select Your Active Regions &amp;amp; Domain (&lt;code&gt;terraform/variables.tf&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;terraform/variables.tf&lt;/code&gt; and inspect &lt;code&gt;variable "buckets"&lt;/code&gt;. By default, all &lt;strong&gt;17 default-enabled AWS regions&lt;/strong&gt; supported by S3 MRAP + CloudFront OAC are pre-listed so you can simply comment out (&lt;code&gt;#&lt;/code&gt;) the regions you don't need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"buckets"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"List of regional S3 buckets behind the Multi-Region Access Point (MRAP)."&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
    &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&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;default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="c1"&gt;# --- Primary Region (Deploy Target) ---&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ap-northeast-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;# Asia Pacific (Tokyo)&lt;/span&gt;

    &lt;span class="c1"&gt;# --- Europe ---&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"eu-north-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Europe (Stockholm)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"eu-west-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Europe (Ireland)&lt;/span&gt;

    &lt;span class="c1"&gt;# --- Americas ---&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# US East (N. Virginia)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-west-2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# US West (Oregon)&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Important&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Choose Your Regions Before First Apply&lt;/strong&gt;: In AWS, S3 Multi-Region Access Point bucket membership is immutable after creation. Select the regions you want in &lt;code&gt;terraform/variables.tf&lt;/code&gt; before running your initial &lt;code&gt;terraform apply&lt;/code&gt;. Exactly one bucket must have &lt;code&gt;is_main = true&lt;/code&gt;—this is the primary bucket where your CI/CD pipeline uploads build artifacts, which S3 Cross-Region Replication then fans out to all replica regions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Setting &lt;code&gt;environment_domain&lt;/code&gt; (Naked Root Domain)
&lt;/h3&gt;

&lt;p&gt;Whether you pass &lt;code&gt;environment_domain&lt;/code&gt; via &lt;code&gt;terraform/terraform.tfvars&lt;/code&gt; (&lt;code&gt;environment_domain = "example.com"&lt;/code&gt;) or CI/CD variables (&lt;code&gt;TF_VAR_environment_domain = example.com&lt;/code&gt;), &lt;strong&gt;always set it to your naked root domain without &lt;code&gt;https://&lt;/code&gt; or &lt;code&gt;www.&lt;/code&gt;&lt;/strong&gt; (for example, &lt;code&gt;example.com&lt;/code&gt; or &lt;code&gt;yourdomain.com&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;From that single value, Terraform automatically derives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your S3 state bucket name (&lt;code&gt;example-com-tfstate&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Your regional S3 bucket names (&lt;code&gt;example-com-ap-northeast-1&lt;/code&gt;, &lt;code&gt;example-com-eu-west-1&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;Your ACM wildcard TLS certificate (&lt;code&gt;example.com&lt;/code&gt; and &lt;code&gt;*.example.com&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Your canonical &lt;code&gt;https://www.example.com&lt;/code&gt; primary URL and &lt;code&gt;301&lt;/code&gt; edge redirect from &lt;code&gt;https://example.com&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 2A: Provision via GitLab CI/CD (Option A)
&lt;/h2&gt;

&lt;p&gt;The repository root &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; runs on two independent tracks so normal content commits never block on manual infrastructure jobs:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
    subgraph Track1["Track 1: Infrastructure (Manual / On terraform/* Changes)"]
        TB["terraform:bootstrap&amp;lt;br/&amp;gt;(One-time S3 state bucket)"] --&amp;gt; TP["terraform:plan&amp;lt;br/&amp;gt;(Saves tfplan artifact)"] --&amp;gt; TA["terraform:apply&amp;lt;br/&amp;gt;(Provisions AWS stack)"]
    end

    subgraph Track2["Track 2: Site Build &amp;amp; Deploy (Every Push to main)"]
        BLD["build&amp;lt;br/&amp;gt;(Astro build + warm .cache)"] --&amp;gt; DEP["deploytos3&amp;lt;br/&amp;gt;(MD5/ETag delta sync + CF invalidation)"]
    end&lt;/code&gt;&lt;/pre&gt;



&lt;h3&gt;
  
  
  1. Add Initial Bootstrap &amp;amp; Provisioning Variables in GitLab
&lt;/h3&gt;

&lt;p&gt;On a brand-new setup, your S3 buckets and CloudFront distribution do not exist yet—so you cannot set &lt;code&gt;S3_BUCKET&lt;/code&gt; or &lt;code&gt;CLOUDFRONT_DISTRIBUTION_ID&lt;/code&gt; upfront. Start by opening &lt;strong&gt;Settings → CI/CD → Variables&lt;/strong&gt; in your GitLab project and adding only the credentials and domain needed to bootstrap remote state and run Terraform:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variable Key&lt;/th&gt;
&lt;th&gt;Required?&lt;/th&gt;
&lt;th&gt;Example / Default&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AWS_ACCESS_KEY_ID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Required&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;AKIA...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;AWS IAM Access Key ID for Terraform &amp;amp; S3 deploys (Protected, Masked)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Required&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;wJalrXUtnFEMI/...&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;AWS IAM Secret Access Key (Protected, Masked)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TF_VAR_environment_domain&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Required&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;example.com&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Naked root domain in Route 53 (no &lt;code&gt;https://&lt;/code&gt; or &lt;code&gt;www.&lt;/code&gt;); auto-derives &lt;code&gt;&amp;lt;domain-slug&amp;gt;-tfstate&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AWS_DEFAULT_REGION&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Optional&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ap-northeast-1&lt;/code&gt; &lt;em&gt;(default)&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;Default AWS CLI region and fallback region for the &lt;code&gt;&amp;lt;domain-slug&amp;gt;-tfstate&lt;/code&gt; bucket&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TF_VAR_environment_domain_slug&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Optional&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;example-com&lt;/code&gt; &lt;em&gt;(dots → hyphens)&lt;/em&gt;
&lt;/td&gt;
&lt;td&gt;Custom prefix override for state bucket and main stack resource names&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;TF_STATE_BUCKET&lt;/code&gt; / &lt;code&gt;TF_STATE_REGION&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Optional&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;&amp;lt;domain-slug&amp;gt;-tfstate&lt;/code&gt; / &lt;code&gt;AWS_DEFAULT_REGION&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Explicit overrides if you want the Terraform state bucket named or hosted separately&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  2. Bootstrap Remote State (&lt;code&gt;terraform:bootstrap&lt;/code&gt; — One-Time Only)
&lt;/h3&gt;

&lt;p&gt;In GitLab &lt;strong&gt;Build → Pipelines&lt;/strong&gt; on &lt;code&gt;main&lt;/code&gt;, click the play button (&lt;strong&gt;▶&lt;/strong&gt;) on &lt;strong&gt;&lt;code&gt;terraform:bootstrap&lt;/code&gt;&lt;/strong&gt;. This creates the dedicated, versioned, SSE-S3 encrypted, TLS-enforced &lt;code&gt;&amp;lt;domain-slug&amp;gt;-tfstate&lt;/code&gt; bucket (which also stores native Terraform &lt;code&gt;&amp;gt;= 1.10&lt;/code&gt; &lt;code&gt;.tflock&lt;/code&gt; lockfiles).&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Plan &amp;amp; Apply the Multi-Region Stack (&lt;code&gt;terraform:plan&lt;/code&gt; → &lt;code&gt;terraform:apply&lt;/code&gt;)
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Trigger &lt;strong&gt;&lt;code&gt;terraform:plan&lt;/code&gt;&lt;/strong&gt; (or push a change to &lt;code&gt;terraform/variables.tf&lt;/code&gt;). Terraform initializes against your newly bootstrapped &lt;code&gt;&amp;lt;domain-slug&amp;gt;-tfstate&lt;/code&gt; bucket, validates the configuration across your selected regions in &lt;code&gt;var.buckets&lt;/code&gt;, and saves the &lt;code&gt;tfplan&lt;/code&gt; artifact.&lt;/li&gt;
&lt;li&gt;Review the planned resources in the job log, then click play (&lt;strong&gt;▶&lt;/strong&gt;) on &lt;strong&gt;&lt;code&gt;terraform:apply&lt;/code&gt;&lt;/strong&gt; to provision the regional S3 buckets, cross-region replication IAM &amp;amp; rules, S3 Multi-Region Access Point, &lt;code&gt;us-east-1&lt;/code&gt; ACM certificate, CloudFront distribution, and Route 53 &lt;code&gt;A&lt;/code&gt;/&lt;code&gt;AAAA&lt;/code&gt; records &lt;em&gt;(allow ~20–30 minutes on the first greenfield run)&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;At the end of the &lt;strong&gt;&lt;code&gt;terraform:apply&lt;/code&gt;&lt;/strong&gt; job log, Terraform prints your newly created resource identifiers:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Outputs:

   active_bucket_regions      = [ "ap-northeast-1", "eu-north-1", "eu-west-1", "us-east-1", "us-west-2" ]
   cloudfront_distribution_id = "E1A2B3C4D5E6F7"
   primary_upload_bucket      = "example-com-ap-northeast-1"
   primary_upload_region      = "ap-northeast-1"
   site_urls                  = [ "https://www.example.com", "https://example.com" ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Add Deployment Target Variables &amp;amp; Run &lt;code&gt;deploytos3&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Return to &lt;strong&gt;Settings → CI/CD → Variables&lt;/strong&gt; in GitLab and add the two post-provisioning variables from the &lt;code&gt;terraform:apply&lt;/code&gt; output:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variable Key&lt;/th&gt;
&lt;th&gt;Value Source (&lt;code&gt;terraform:apply&lt;/code&gt; output)&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;S3_BUCKET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;primary_upload_bucket&lt;/code&gt; (e.g. &lt;code&gt;example-com-ap-northeast-1&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Primary S3 bucket where &lt;code&gt;scripts/s3-deploy.sh&lt;/code&gt; uploads &lt;code&gt;./dist&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CLOUDFRONT_DISTRIBUTION_ID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;cloudfront_distribution_id&lt;/code&gt; (e.g. &lt;code&gt;E1A2B3C4D5E6F7&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;CloudFront distribution invalidated after S3 delta sync&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Click retry/play (&lt;strong&gt;▶&lt;/strong&gt;) on &lt;strong&gt;&lt;code&gt;deploytos3&lt;/code&gt;&lt;/strong&gt; in your pipeline (or push a commit to &lt;code&gt;main&lt;/code&gt;) to sync &lt;code&gt;./dist&lt;/code&gt; to your primary S3 bucket and issue a targeted CloudFront cache invalidation.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2B: Provision via GitHub Actions (Option B)
&lt;/h2&gt;

&lt;p&gt;If you host your repository on &lt;strong&gt;GitHub&lt;/strong&gt;, the included &lt;code&gt;.github/workflows/deploy.yml&lt;/code&gt; workflow handles automated Astro builds, S3 delta deployments, and Terraform validation.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Provision the Initial AWS Stack
&lt;/h3&gt;

&lt;p&gt;Run the one-time Terraform bootstrap and initial apply from your terminal (or a GitHub Codespace) using your AWS credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Create the dedicated S3 state bucket (one-time bootstrap)&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; terraform/bootstrap
terraform init
terraform apply -var=&lt;span class="s2"&gt;"environment_domain=example.com"&lt;/span&gt;

&lt;span class="c"&gt;# 2. Initialize and apply the main multi-region stack (~20-30 mins first run)&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
cp terraform.tfvars.example terraform.tfvars
&lt;span class="c"&gt;# Edit terraform.tfvars to set: environment_domain = "example.com"&lt;/span&gt;

terraform init \
  -backend-config=&lt;span class="s2"&gt;"bucket=example-com-tfstate"&lt;/span&gt; \
  -backend-config=&lt;span class="s2"&gt;"region=ap-northeast-1"&lt;/span&gt;

terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Configure GitHub Actions Secrets &amp;amp; Variables
&lt;/h3&gt;

&lt;p&gt;Open your GitHub repository &lt;strong&gt;Settings → Secrets and variables → Actions&lt;/strong&gt; and add:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository Secrets&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;AWS_ACCESS_KEY_ID&lt;/code&gt;: Your AWS IAM Access Key ID&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS_SECRET_ACCESS_KEY&lt;/code&gt;: Your AWS IAM Secret Access Key&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Repository Variables&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;TF_VAR_environment_domain&lt;/code&gt;: &lt;code&gt;example.com&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS_DEFAULT_REGION&lt;/code&gt;: &lt;code&gt;ap-northeast-1&lt;/code&gt; (or your primary upload bucket region)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;S3_BUCKET&lt;/code&gt;: Value of &lt;code&gt;terraform output -raw primary_upload_bucket&lt;/code&gt; (e.g. &lt;code&gt;example-com-ap-northeast-1&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CLOUDFRONT_DISTRIBUTION_ID&lt;/code&gt;: Value of &lt;code&gt;terraform output -raw cloudfront_distribution_id&lt;/code&gt; (e.g. &lt;code&gt;E1A2B3C4D5E6F7&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once &lt;code&gt;S3_BUCKET&lt;/code&gt; is set in GitHub Actions Variables, &lt;code&gt;.github/workflows/deploy.yml&lt;/code&gt; automatically switches out of &lt;strong&gt;Starter Template Dry-Run Mode&lt;/strong&gt; and builds + deploys your site on every push to &lt;code&gt;main&lt;/code&gt;!&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2C: Provision via Local CLI (Option C)
&lt;/h2&gt;

&lt;p&gt;If you prefer provisioning and deploying directly from your workstation terminal without CI/CD:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Create the dedicated S3 state bucket (one-time bootstrap)&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; terraform/bootstrap
terraform init
terraform apply -var=&lt;span class="s2"&gt;"environment_domain=example.com"&lt;/span&gt;

&lt;span class="c"&gt;# 2. Initialize and apply the main multi-region stack (~20-30 mins first run)&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ..
cp terraform.tfvars.example terraform.tfvars
&lt;span class="c"&gt;# Edit terraform.tfvars to set: environment_domain = "example.com"&lt;/span&gt;

terraform init \
  -backend-config=&lt;span class="s2"&gt;"bucket=example-com-tfstate"&lt;/span&gt; \
  -backend-config=&lt;span class="s2"&gt;"region=ap-northeast-1"&lt;/span&gt;

terraform apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once &lt;code&gt;terraform apply&lt;/code&gt; finishes, build and deploy &lt;code&gt;./dist&lt;/code&gt; directly from your machine at any time using &lt;code&gt;scripts/s3-deploy.sh&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build

&lt;span class="nv"&gt;S3_BUCKET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(terraform -chdir=terraform output -raw primary_upload_bucket)"&lt;/span&gt; \
&lt;span class="nv"&gt;CLOUDFRONT_DISTRIBUTION_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"$(terraform -chdir=terraform output -raw cloudfront_distribution_id)"&lt;/span&gt; \
bash ./scripts/s3-deploy.sh ./dist
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Under the Hood: Key Terraform Resources
&lt;/h2&gt;

&lt;p&gt;If you are curious how the pieces fit together inside &lt;code&gt;terraform/&lt;/code&gt;, here are the core building blocks:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Native SigV4a Origin Access Control &amp;amp; Managed Security Headers (&lt;code&gt;terraform/cloudfront.tf&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Instead of routing origin requests through a &lt;code&gt;Lambda@Edge&lt;/code&gt; signer, &lt;code&gt;aws_cloudfront_origin_access_control&lt;/code&gt; now speaks &lt;code&gt;sigv4a&lt;/code&gt; directly to the MRAP endpoint. Note one critical CloudFront detail: because an MRAP hostname ends in &lt;code&gt;.accesspoint.s3-global.amazonaws.com&lt;/code&gt; rather than &lt;code&gt;.s3.&amp;lt;region&amp;gt;.amazonaws.com&lt;/code&gt;, the distribution's &lt;code&gt;origin&lt;/code&gt; block &lt;strong&gt;must&lt;/strong&gt; include &lt;code&gt;custom_origin_config&lt;/code&gt; alongside &lt;code&gt;origin_access_control_id&lt;/code&gt; (omitting &lt;code&gt;custom_origin_config&lt;/code&gt; causes Terraform to send &lt;code&gt;S3OriginConfig&lt;/code&gt;, which CloudFront rejects with &lt;code&gt;The parameter Origin DomainName does not refer to a valid S3 bucket&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_cloudfront_origin_access_control"&lt;/span&gt; &lt;span class="s2"&gt;"mrap_oac"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;                              &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${local.domain_slug}-mrap-oac"&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt;                       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Native SigV4a Origin Access Control for S3 Multi-Region Access Point"&lt;/span&gt;
  &lt;span class="n"&gt;origin_access_control_origin_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"s3"&lt;/span&gt;
  &lt;span class="n"&gt;signing_behavior&lt;/span&gt;                  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"always"&lt;/span&gt;
  &lt;span class="n"&gt;signing_protocol&lt;/span&gt;                  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sigv4a"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Inside aws_cloudfront_distribution.mrap_distribution:&lt;/span&gt;
&lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;domain_name&lt;/span&gt;              &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_s3control_multi_region_access_point&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domain_name&lt;/span&gt;
  &lt;span class="n"&gt;origin_id&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"mrap_origin_id"&lt;/span&gt;
  &lt;span class="n"&gt;origin_access_control_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_cloudfront_origin_access_control&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrap_oac&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;

  &lt;span class="n"&gt;custom_origin_config&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;http_port&lt;/span&gt;              &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;
    &lt;span class="n"&gt;https_port&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt;
    &lt;span class="n"&gt;origin_protocol_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https-only"&lt;/span&gt;
    &lt;span class="n"&gt;origin_ssl_protocols&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"TLSv1.2"&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;Both each regional S3 bucket policy and the Multi-Region Access Point policy lock down &lt;code&gt;s3:GetObject&lt;/code&gt; strictly to &lt;code&gt;cloudfront.amazonaws.com&lt;/code&gt; scoped to your &lt;code&gt;AWS:SourceArn&lt;/code&gt; CloudFront distribution ARN. In addition, &lt;code&gt;default_cache_behavior&lt;/code&gt; attaches AWS's &lt;code&gt;Managed-SecurityHeadersPolicy&lt;/code&gt; (&lt;code&gt;67f7725c-6f97-4210-82d7-5512b31e9d03&lt;/code&gt;) so every response includes &lt;code&gt;Strict-Transport-Security&lt;/code&gt;, &lt;code&gt;X-Content-Type-Options: nosniff&lt;/code&gt;, &lt;code&gt;X-Frame-Options: SAMEORIGIN&lt;/code&gt;, and &lt;code&gt;Referrer-Policy&lt;/code&gt; headers automatically.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Apex Redirect &amp;amp; Directory Index Rewriting (&lt;code&gt;terraform/cloudfront.tf&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Because an S3 Multi-Region Access Point uses the S3 REST API endpoint rather than the legacy S3 Website endpoint, requests for &lt;code&gt;/about/&lt;/code&gt; do not automatically resolve to &lt;code&gt;/about/index.html&lt;/code&gt; on the S3 side. Our &lt;code&gt;viewer-request&lt;/code&gt; CloudFront Function handles both canonical host redirection and directory index resolution at the edge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&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;request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&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;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&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;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;host&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="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 1. Canonical redirect: naked domain -&amp;gt; www&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'example.com'&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="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;statusCode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;301&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;statusDescription&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Moved Permanently'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&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="s1"&gt;'https://www.example.com'&lt;/span&gt; &lt;span class="o"&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;uri&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="c1"&gt;// 2. Static directory index rewrite&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;uri&lt;/span&gt; &lt;span class="o"&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;uri&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&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;uri&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s1"&gt;'index.html'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&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;uri&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&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;uri&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s1"&gt;'/index.html'&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;request&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Next Up: Automated CI/CD Dry-Run Workflows, Static Hosts &amp;amp; Two-Tier Edge Caching
&lt;/h2&gt;

&lt;p&gt;Now that you know how the optional multi-region AWS stack is provisioned, continue to &lt;a href="https://www.stuurman.com/blog/2026-11-03-part-3-ci-cd-pipelines-dry-run-mode-and-static-hosting/" rel="noopener noreferrer"&gt;&lt;strong&gt;Part 3 — Automated CI/CD Pipelines, Starter Dry-Run Mode &amp;amp; Deploying to Any Static Host&lt;/strong&gt;&lt;/a&gt; for a deep-dive into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploying &lt;code&gt;./dist/&lt;/code&gt; to zero-config platforms (&lt;strong&gt;Vercel, Netlify, Cloudflare Pages&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;How the dual &lt;strong&gt;GitLab CI (&lt;code&gt;.gitlab-ci.yml&lt;/code&gt;)&lt;/strong&gt; and &lt;strong&gt;GitHub Actions (&lt;code&gt;.github/workflows/deploy.yml&lt;/code&gt;)&lt;/strong&gt; pipelines run in &lt;strong&gt;Starter Template Dry-Run Mode&lt;/strong&gt; out of the box&lt;/li&gt;
&lt;li&gt;How &lt;code&gt;scripts/s3-deploy.sh&lt;/code&gt; uses &lt;strong&gt;4-tier split Edge/Browser &lt;code&gt;Cache-Control&lt;/code&gt; headers&lt;/strong&gt; and &lt;strong&gt;MD5-vs-ETag delta sync&lt;/strong&gt; to keep CloudFront cache hit ratios near 100% while updating live pages in seconds.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-03-part-2-provisioning-aws-mrap-cloudfront-terraform-gitlab-ci/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-03-part-2-provisioning-aws-mrap-cloudfront-terraform-gitlab-ci/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>terraform</category>
      <category>cicd</category>
      <category>infrastructure</category>
    </item>
    <item>
      <title>Using Terraform (HCL) to design, deploy, and manage repeatable multi-region AWS infrastructure.</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Tue, 24 Nov 2026 12:35:34 +0000</pubDate>
      <link>https://dev.to/edstuurman/using-terraform-hcl-to-design-deploy-and-manage-repeatable-multi-region-aws-infrastructure-53mo</link>
      <guid>https://dev.to/edstuurman/using-terraform-hcl-to-design-deploy-and-manage-repeatable-multi-region-aws-infrastructure-53mo</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Warning&lt;/p&gt;
&lt;p&gt;
This article is functional but out of date. &lt;br&gt;
AWS MRAP behind CloudFront no longer requires a Lambda@Edge function for signing requests. See the updated guide: &lt;a href="https://www.stuurman.com/blog/2026-11-03-part-2-provisioning-aws-mrap-cloudfront-terraform-gitlab-ci/" rel="noopener noreferrer"&gt;&lt;strong&gt;Part 2 — Provisioning &amp;amp; Deploying the Multi-Region AWS Stack with Terraform and GitLab CI/CD&lt;/strong&gt;&lt;/a&gt;, or use the standalone Terraform Registry module: &lt;a href="https://registry.terraform.io/modules/edstuurman/mrap-static-site/aws/latest" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;edstuurman/mrap-static-site/aws&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’ve been experimenting with Terraform for some time now. Once you understand what HCL can and cannot do, it becomes a genuinely enjoyable and worthwhile exercise.&lt;/p&gt;

&lt;p&gt;For this project, I chose to store the Terraform state remotely in an S3 bucket, using S3 based locking as well. This aligns with Terraform best practices and ensures safe state management.&lt;/p&gt;

&lt;p&gt;Before getting started, there are a few prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update the list of regions in &lt;code&gt;variables.tf&lt;/code&gt; to add or remove deployment targets.

&lt;ul&gt;
&lt;li&gt;The first entry is treated as the primary (master) region, from which files are replicated.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Set the domain name and domain slug.

&lt;ul&gt;
&lt;li&gt;The domain must already exist as a hosted zone in Route 53.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Provide your AWS &lt;code&gt;account_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Create and configure your own &lt;code&gt;backend.tf&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;In my case, I use an S3 bucket with state locking enabled, as recommended for Terraform state management.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"buckets"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;
    &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;optional&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;number&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;default&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;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ap-northeast-1"&lt;/span&gt;
      &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&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;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"eu-north-1"&lt;/span&gt;
      &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"eu-west-1"&lt;/span&gt;
      &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&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;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-west-2"&lt;/span&gt;
      &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&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;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
      &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&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;region&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ap-south-1"&lt;/span&gt;
      &lt;span class="n"&gt;is_main&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&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;variable&lt;/span&gt; &lt;span class="s2"&gt;"environment_domain"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
  &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"example.com"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"environment_domain_slug"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
  &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"example-com"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"account_id"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
  &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"111111111111"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you may have noticed, the regions defined in variables.tf differ from those used in this &lt;a href="https://www.stuurman.com/blog/2025-12-6-aws-mrap-s3-lambda-cloudfront/" rel="noopener noreferrer"&gt;website’s current hosting setup&lt;/a&gt;. The intent was to experiment with AWS directory buckets in pursuit of even lower latency. Unfortunately, from what I’ve been able to determine, directory buckets are not compatible with multi region access points (MRAP) and are not available in every AWS region. As a result, classic S3 buckets will have to do.&lt;/p&gt;

&lt;p&gt;At this point, I’ll let the HCL do the talking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="n"&gt;locals&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;all_buckets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket"&lt;/span&gt; &lt;span class="s2"&gt;"s3_buckets"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all_buckets&lt;/span&gt;

  &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${each.value.region}"&lt;/span&gt;
  &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;each&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="n"&gt;region&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Enable versioning for the buckets&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_versioning"&lt;/span&gt; &lt;span class="s2"&gt;"s3_versioning"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all_buckets&lt;/span&gt;
  &lt;span class="n"&gt;depends_on&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_s3_bucket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${each.value.region}"&lt;/span&gt;
  &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;each&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="n"&gt;region&lt;/span&gt;

  &lt;span class="n"&gt;versioning_configuration&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enabled"&lt;/span&gt; &lt;span class="c1"&gt;# Valid values: "Enabled", "Suspended"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# IAM Role for Replication&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_role"&lt;/span&gt; &lt;span class="s2"&gt;"replication_role"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-s3-replication-role"&lt;/span&gt;

  &lt;span class="n"&gt;assume_role_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;
    &lt;span class="nc"&gt;Statement&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="nc"&gt;Effect&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
      &lt;span class="nc"&gt;Principal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"s3.amazonaws.com"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="nc"&gt;Action&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sts:AssumeRole"&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="c1"&gt;# IAM Policy for Replication&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_policy"&lt;/span&gt; &lt;span class="s2"&gt;"replication_policy"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${each.value.region}-s3-replication-policy"&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allows S3 replication between main and secondary buckets"&lt;/span&gt;
  &lt;span class="n"&gt;depends_on&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_iam_role&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replication_role&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;
    &lt;span class="nc"&gt;Statement&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="nc"&gt;Effect&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
        &lt;span class="nc"&gt;Action&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"s3:*"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="nc"&gt;Resource&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="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Attach Policy to Role&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_role_policy_attachment"&lt;/span&gt; &lt;span class="s2"&gt;"replication_policy_attach"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;depends_on&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_s3_bucket_versioning&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s3_versioning&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;role&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-s3-replication-role"&lt;/span&gt;
  &lt;span class="n"&gt;policy_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::${var.account_id}:policy/${var.environment_domain_slug}-${each.value.region}-s3-replication-policy"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# S3 Replication Configuration&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_replication_configuration"&lt;/span&gt; &lt;span class="s2"&gt;"replication"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;bucket&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${lookup(var.buckets[0], "&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="s2"&gt;")}"&lt;/span&gt;
  &lt;span class="n"&gt;role&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::${var.account_id}:role/${var.environment_domain_slug}-s3-replication-role"&lt;/span&gt;
  &lt;span class="n"&gt;region&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lookup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"region"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;depends_on&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_s3_bucket_versioning&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s3_versioning&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;dynamic&lt;/span&gt; &lt;span class="s2"&gt;"rule"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;for_each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buckets&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;s3_buckets&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;s3_buckets&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;is_main&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;id&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${rule.value.region}"&lt;/span&gt;
      &lt;span class="n"&gt;status&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enabled"&lt;/span&gt;
      &lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rule&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="n"&gt;priority&lt;/span&gt;

      &lt;span class="n"&gt;filter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;prefix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="c1"&gt;# Replicate all objects&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="n"&gt;destination&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;bucket&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:s3:::${var.environment_domain_slug}-${rule.value.region}"&lt;/span&gt;
        &lt;span class="n"&gt;storage_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"STANDARD"&lt;/span&gt;

        &lt;span class="n"&gt;replication_time&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enabled"&lt;/span&gt;
          &lt;span class="n"&gt;time&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;metrics&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="n"&gt;event_threshold&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enabled"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;

      &lt;span class="n"&gt;delete_marker_replication&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enabled"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# S3 SSE-S3 encryption&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3_bucket_server_side_encryption_configuration"&lt;/span&gt; &lt;span class="s2"&gt;"encrypt_all_buckets"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all_buckets&lt;/span&gt;

  &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${each.value.region}"&lt;/span&gt;
  &lt;span class="n"&gt;region&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;each&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="n"&gt;region&lt;/span&gt;

  &lt;span class="n"&gt;rule&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;apply_server_side_encryption_by_default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;sse_algorithm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AES256"&lt;/span&gt; &lt;span class="c1"&gt;# This specifies SSE-S3&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;bucket_key_enabled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Create the Multi-Region Access Point (MRAP)&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3control_multi_region_access_point"&lt;/span&gt; &lt;span class="s2"&gt;"mrap"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;# MRAPs are global resources and do not require a specific region provider&lt;/span&gt;
  &lt;span class="n"&gt;details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-mrap"&lt;/span&gt;

    &lt;span class="c1"&gt;# Configure the regions associated with the MRAP&lt;/span&gt;
    &lt;span class="n"&gt;dynamic&lt;/span&gt; &lt;span class="s2"&gt;"region"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;for_each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;all_buckets&lt;/span&gt;
      &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;bucket&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-${region.value.region}"&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;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_s3control_multi_region_access_point_policy"&lt;/span&gt; &lt;span class="s2"&gt;"mrap"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-mrap"&lt;/span&gt;
    &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="s2"&gt;"Version"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"Statement"&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="s2"&gt;"Sid"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"AllowMultiRegionAccessPointRead"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"Effect"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"Principal"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"AWS"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"${var.account_id}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"Service"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"cloudfront.amazonaws.com"&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="s2"&gt;"Action"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"s3:GetObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"s3:ListBucket"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"Resource"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s2"&gt;"arn:aws:s3::${var.account_id}:accesspoint/${aws_s3control_multi_region_access_point.mrap.alias}/object/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"arn:aws:s3::${var.account_id}:accesspoint/${aws_s3control_multi_region_access_point.mrap.alias}"&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;span class="c1"&gt;# SSL Certificate and validation&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_acm_certificate"&lt;/span&gt; &lt;span class="s2"&gt;"cert"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;region&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
  &lt;span class="n"&gt;domain_name&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"*.${var.environment_domain}"&lt;/span&gt;
  &lt;span class="n"&gt;validation_method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"DNS"&lt;/span&gt;

  &lt;span class="n"&gt;lifecycle&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;create_before_destroy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_zone"&lt;/span&gt; &lt;span class="s2"&gt;"dns_zone"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environment_domain&lt;/span&gt;
  &lt;span class="n"&gt;private_zone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_record"&lt;/span&gt; &lt;span class="s2"&gt;"dns_records"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;dvo&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;aws_acm_certificate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domain_validation_options&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dvo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domain_name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;name&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dvo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resource_record_name&lt;/span&gt;
      &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dvo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resource_record_value&lt;/span&gt;
      &lt;span class="k"&gt;type&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dvo&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resource_record_type&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;allow_overwrite&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;each&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="n"&gt;name&lt;/span&gt;
  &lt;span class="n"&gt;records&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;each&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="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="n"&gt;ttl&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;each&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="k"&gt;type&lt;/span&gt;
  &lt;span class="n"&gt;zone_id&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aws_route53_zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dns_zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zone_id&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_acm_certificate_validation"&lt;/span&gt; &lt;span class="s2"&gt;"validated_cert"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;certificate_arn&lt;/span&gt;         &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_acm_certificate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;validation_record_fqdns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;aws_route53_record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dns_records&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fqdn&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# CloudFront&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_cloudfront_distribution"&lt;/span&gt; &lt;span class="s2"&gt;"mrap_distribution"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;custom_origin_config&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;http_port&lt;/span&gt;              &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"80"&lt;/span&gt;
      &lt;span class="n"&gt;https_port&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"443"&lt;/span&gt;
      &lt;span class="n"&gt;origin_protocol_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https-only"&lt;/span&gt;
      &lt;span class="n"&gt;origin_read_timeout&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"30"&lt;/span&gt;
      &lt;span class="n"&gt;origin_ssl_protocols&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"TLSv1.2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"TLSv1.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"TLSv1"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;domain_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_s3control_multi_region_access_point&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domain_name&lt;/span&gt;
    &lt;span class="n"&gt;origin_id&lt;/span&gt;   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"mrap_origin_id"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;enabled&lt;/span&gt;             &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="n"&gt;is_ipv6_enabled&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="n"&gt;default_root_object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"index.html"&lt;/span&gt;

  &lt;span class="n"&gt;aliases&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"www.${var.environment_domain}"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="n"&gt;default_cache_behavior&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;allowed_methods&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"DELETE"&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="s2"&gt;"HEAD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"OPTIONS"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"PATCH"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"PUT"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;cached_methods&lt;/span&gt;   &lt;span class="o"&gt;=&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="s2"&gt;"HEAD"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;target_origin_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"mrap_origin_id"&lt;/span&gt;

    &lt;span class="n"&gt;lambda_function_association&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"origin-request"&lt;/span&gt;
      &lt;span class="n"&gt;lambda_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${aws_lambda_function.edge_lambda.arn}:${aws_lambda_function.edge_lambda.version}"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;forwarded_values&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;query_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;

      &lt;span class="n"&gt;cookies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;forward&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"none"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;viewer_protocol_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"allow-all"&lt;/span&gt;
    &lt;span class="n"&gt;min_ttl&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;default_ttl&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;
    &lt;span class="n"&gt;max_ttl&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;86400&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;# Cache behavior with precedence 0&lt;/span&gt;
  &lt;span class="n"&gt;ordered_cache_behavior&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;path_pattern&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"/*"&lt;/span&gt;
    &lt;span class="n"&gt;allowed_methods&lt;/span&gt;  &lt;span class="o"&gt;=&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="s2"&gt;"HEAD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"OPTIONS"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;cached_methods&lt;/span&gt;   &lt;span class="o"&gt;=&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="s2"&gt;"HEAD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"OPTIONS"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;target_origin_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"mrap_origin_id"&lt;/span&gt;

    &lt;span class="n"&gt;lambda_function_association&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;event_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"origin-request"&lt;/span&gt;
      &lt;span class="n"&gt;lambda_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${aws_lambda_function.edge_lambda.arn}:${aws_lambda_function.edge_lambda.version}"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;forwarded_values&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;query_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
      &lt;span class="n"&gt;headers&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Origin"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

      &lt;span class="n"&gt;cookies&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;forward&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"none"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;min_ttl&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;default_ttl&lt;/span&gt;            &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;86400&lt;/span&gt;
    &lt;span class="n"&gt;max_ttl&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;31536000&lt;/span&gt;
    &lt;span class="n"&gt;compress&lt;/span&gt;               &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="n"&gt;viewer_protocol_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"redirect-to-https"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;price_class&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"PriceClass_200"&lt;/span&gt;

  &lt;span class="n"&gt;restrictions&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;geo_restriction&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;restriction_type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"none"&lt;/span&gt;
      &lt;span class="n"&gt;locations&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;tags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Environment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"production"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="n"&gt;viewer_certificate&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;acm_certificate_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_acm_certificate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
    &lt;span class="n"&gt;ssl_support_method&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sni-only"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Create Route53 records for the CloudFront distribution aliases&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_zone"&lt;/span&gt; &lt;span class="s2"&gt;"site_dns_zone"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environment_domain&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_route53_record"&lt;/span&gt; &lt;span class="s2"&gt;"cloudfront"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;for_each&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_cloudfront_distribution&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrap_distribution&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aliases&lt;/span&gt;
  &lt;span class="n"&gt;zone_id&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;aws_route53_zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;site_dns_zone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zone_id&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;each&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;
  &lt;span class="k"&gt;type&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"A"&lt;/span&gt;

  &lt;span class="n"&gt;alias&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;                   &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_cloudfront_distribution&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrap_distribution&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;domain_name&lt;/span&gt;
    &lt;span class="n"&gt;zone_id&lt;/span&gt;                &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_cloudfront_distribution&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mrap_distribution&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hosted_zone_id&lt;/span&gt;
    &lt;span class="n"&gt;evaluate_target_health&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Lambda @Edge settings&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lambda_function"&lt;/span&gt; &lt;span class="s2"&gt;"edge_lambda"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;provider&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws&lt;/span&gt; &lt;span class="c1"&gt;# deploy to us-east-1&lt;/span&gt;
  &lt;span class="n"&gt;region&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"us-east-1"&lt;/span&gt;
  &lt;span class="n"&gt;function_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-lambda"&lt;/span&gt;

  &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"./mrap-to-cdn-proxy-us-east-1.zip"&lt;/span&gt;
  &lt;span class="c1"&gt;#source_code_hash = data.archive_file.lambda_zip.output_base64sha256&lt;/span&gt;

  &lt;span class="n"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"index.handler"&lt;/span&gt;
  &lt;span class="n"&gt;runtime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"nodejs24.x"&lt;/span&gt;
  &lt;span class="n"&gt;role&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_iam_role&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lambda_exec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;publish&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="c1"&gt;# Must publish&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_role"&lt;/span&gt; &lt;span class="s2"&gt;"lambda_exec"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-lambda"&lt;/span&gt;

  &lt;span class="n"&gt;assume_role_policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;
    &lt;span class="nc"&gt;Statement&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="nc"&gt;Action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;
        &lt;span class="nc"&gt;Effect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
        &lt;span class="nc"&gt;Principal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nc"&gt;Service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"lambda.amazonaws.com"&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="nc"&gt;Action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;
        &lt;span class="nc"&gt;Effect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
        &lt;span class="nc"&gt;Principal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nc"&gt;Service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"edgelambda.amazonaws.com"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_lambda_permission"&lt;/span&gt; &lt;span class="s2"&gt;"allow_cloudfront"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;provider&lt;/span&gt;      &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws&lt;/span&gt;
  &lt;span class="n"&gt;statement_id&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"AllowExecutionFromCloudFront"&lt;/span&gt;
  &lt;span class="n"&gt;action&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"lambda:InvokeFunction"&lt;/span&gt;
  &lt;span class="n"&gt;function_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;aws_lambda_function&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;edge_lambda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;arn&lt;/span&gt;
  &lt;span class="n"&gt;principal&lt;/span&gt;     &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"edgelambda.amazonaws.com"&lt;/span&gt;
  &lt;span class="n"&gt;source_arn&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:cloudfront::${var.account_id}:distribution/${aws_cloudfront_distribution.mrap_distribution.id}"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# IAM Policy for Lambda&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_policy"&lt;/span&gt; &lt;span class="s2"&gt;"lambda_policy"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-lambda"&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allows @ edge execution"&lt;/span&gt;

  &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;jsonencode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"Version"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2012-10-17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"Statement"&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="s2"&gt;"Sid"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"VisualEditor0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Effect"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Action"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="s2"&gt;"iam:PassRole"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"lambda:DisableReplication"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"lambda:GetFunction"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"cloudfront:ListDistributionsByLambdaFunction"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"lambda:DeleteFunction"&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Resource"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"*"&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"Action"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="s2"&gt;"logs:CreateLogGroup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"logs:CreateLogStream"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"logs:PutLogEvents"&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Effect"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Resource"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:logs:*:*:*"&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="s2"&gt;"Action"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="s2"&gt;"s3:GetObject"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"s3:ListBucket"&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Effect"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"Resource"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="s2"&gt;"*"&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Attach Policy to lambda Role&lt;/span&gt;
&lt;span class="n"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_role_policy_attachment"&lt;/span&gt; &lt;span class="s2"&gt;"lambda_policy_attach"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;role&lt;/span&gt;       &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"${var.environment_domain_slug}-lambda"&lt;/span&gt;
  &lt;span class="n"&gt;depends_on&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;aws_iam_role&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;lambda_exec&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="n"&gt;policy_arn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"arn:aws:iam::${var.account_id}:policy/${var.environment_domain_slug}-lambda"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are a few areas I’d still like to improve. Chief among them are the IAM permissions used for S3 replication, which are currently more permissive than I’m comfortable with. I’ll need to spend some time digging further into the documentation to tighten these down to the minimum required scope.&lt;/p&gt;

&lt;p&gt;That said, the process itself was genuinely enjoyable. Figuring things out as I went reinforced just how powerful Terraform can be, especially once you realize that resource blocks can be dynamic and that for_each expressions can thus be nested. At that point, the configuration becomes significantly less verbose and far less repetitive.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2025-12-18-terraform-aws-mrap-s3/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2025-12-18-terraform-aws-mrap-s3/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>infrastructure</category>
      <category>terraform</category>
    </item>
    <item>
      <title>Running a Mail Server Is Cool. Until SPF, DKIM, DMARC, and blocklists remind you what it really costs.</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Sun, 22 Nov 2026 12:10:48 +0000</pubDate>
      <link>https://dev.to/edstuurman/running-a-mail-server-is-cool-until-spf-dkim-dmarc-and-blocklists-remind-you-what-it-really-4h86</link>
      <guid>https://dev.to/edstuurman/running-a-mail-server-is-cool-until-spf-dkim-dmarc-and-blocklists-remind-you-what-it-really-4h86</guid>
      <description>&lt;p&gt;I want to back up my opinion with some context. Well over a decade ago, I fondly remember setting up Exim4 mail servers (MTA) and sending hundreds of thousands of transactional emails daily. Since then, I’ve spent several years working full-time with email systems and infrastructure. Even with that experience, I still consider myself a rookie. In both cases, one thing was clear: setting up the infrastructure is a fun and rewarding exercise, but deliverability and inbox placement are a grind.&lt;/p&gt;

&lt;p&gt;You’re constantly just one noisy neighbor away from having part of your system blacklisted, and every receiving email platform enforces its own set of rules and policies. On top of that, many people treat the “mark as spam” button like an unsubscribe feature, just as one example. I could list every way running an email platform drains the fun out of what was once an enjoyable infrastructure project, but that would be a tome in itself.&lt;/p&gt;

&lt;p&gt;The point is, whether you’re self hosting email for a single user or managing millions of inboxes, ensuring that every message actually arrives at its destination is a 24/7 job. I don’t know anyone who would call this a hobby.&lt;/p&gt;

&lt;p&gt;And this is why I use an email provider like &lt;a href="https://www.fastmail.com/" rel="noopener noreferrer"&gt;FastMail&lt;/a&gt;. Their onboarding is smooth and straightforward, requiring only a few DNS records to get SPF, DKIM, and DMARC fully validated. They provide reliable email infrastructure and handle all the maintenance and support, making email virtually hassle free. All of this and much more comes at a modest, reasonable sum.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Email deliverability is complex because it’s governed by evolving algorithms, authentication protocols, reputation systems, and provider specific rules. A service like &lt;a href="https://www.fastmail.com/" rel="noopener noreferrer"&gt;FastMail&lt;/a&gt; can simplify all of this by offering dedicated infrastructure, automated best practices, monitoring, and support designed to maximize inbox placement—which is why even when I later mapped out a &lt;a href="https://www.stuurman.com/blog/2026-11-09-zero-port-homelab-mail-ses-s3-stalwart/" rel="noopener noreferrer"&gt;zero-port homelab mail architecture around Stalwart&lt;/a&gt;, outbound mail still relays through Amazon SES's warmed IP pools, right as I was &lt;a href="https://www.stuurman.com/blog/2026-10-31-stepping-back-digging-in-and-stepping-forward/" rel="noopener noreferrer"&gt;stepping back into production messaging infrastructure&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2025-11-26-email-deliverability/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2025-11-26-email-deliverability/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>email</category>
      <category>infrastructure</category>
      <category>opinion</category>
    </item>
    <item>
      <title>I Also Fell Down the Rabbit Hole: Building a Fully Automated Astro Blog Pipeline with VSCode, GitLab, Amplify and CloudFront.</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Sun, 22 Nov 2026 12:10:47 +0000</pubDate>
      <link>https://dev.to/edstuurman/i-also-fell-down-the-rabbit-hole-building-a-fully-automated-astro-blog-pipeline-with-vscode-2jlb</link>
      <guid>https://dev.to/edstuurman/i-also-fell-down-the-rabbit-hole-building-a-fully-automated-astro-blog-pipeline-with-vscode-2jlb</guid>
      <description>&lt;p&gt;I’ll be honest: I’m new to this whole blogging thing, but if there’s one universal truth about tech blogs, it’s that the first post is always about the stack behind it. So here’s mine. Don’t worry, I’ll spare you a 20-page deep dive. If I didn’t, this post would quickly devolve into a copy-and-paste marathon from half a dozen documentation pages, and nobody wants that.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;VScode&lt;/li&gt;
&lt;li&gt;Astro js + tailwind css&lt;/li&gt;
&lt;li&gt;GitLab&lt;/li&gt;
&lt;li&gt;AWS Amplify&lt;/li&gt;
&lt;li&gt;AWS CloudFront&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VSCode is my preferred IDE. It’s simple to use, free, and has a massive library of add-ons. Since this is my first Astro project, I’m especially grateful for the extension that provides proper syntax and semantic highlighting. &lt;/p&gt;

&lt;p&gt;I ended up choosing Astro after comparing it to static site generators (SSG) I’ve used in the past, like Jekyll, Hugo, and Ghost. Astro is the shiny new kid on the block and brings some interesting features right out of the box, including static, hybrid, and server-side page rendering (SSR). If that piques your curiosity, I encourage you to check out their documentation or spin up an install yourself.&lt;/p&gt;

&lt;p&gt;VSCode and Git work hand in hand. After setting up a private repository for this project, pushing changes is as simple as running a few commands in the terminal. I haven’t felt the need for extra extensions like GitLab Workflow but who knows, maybe future me will appreciate the convenience. I chose GitLab because I’m already familiar with self-hosted instances, so it felt like the natural fit for this project.&lt;/p&gt;

&lt;p&gt;Enter AWS Amplify. Honestly, Amazon could hardly have made deploying apps any easier. Amplify can trigger a pull from your Git repository using a simple webhook whenever a branch is merged or a new commit gets pushed. Add a bit of YAML, and you’ve got a fully automated build process. From there, it’s almost absurdly straightforward: write a new post or tweak a file, push it, and let the magic cloud machinery handle the rest.&lt;/p&gt;

&lt;p&gt;Lastly, with just a few extra clicks, a domain already managed in Route 53 can be automatically configured to front the Amplify app through AWS CloudFront. If you’re using a third-party DNS provider, you’ll probably have to add the required records manually. As a nice bonus, CloudFront also generates and configures an SSL certificate during the setup process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This is the high-level overview without diving too deep into the specifics. Those details are all well documented in their respective corners of the internet. Building this site from almost scratch and automating its deployment turned out to be a genuinely fun exercise, and a great way to explore a new stack end to end—one that later evolved through an &lt;a href="https://www.stuurman.com/blog/2026-10-27-converting-to-ai-assisted-engineering/" rel="noopener noreferrer"&gt;Astro 7 and Tailwind v4 overhaul&lt;/a&gt;, a &lt;a href="https://www.stuurman.com/blog/2026-11-01-optimizing-gitlab-ci-s3-deployments/" rel="noopener noreferrer"&gt;faster GitLab CI to S3 MRAP deployment pipeline&lt;/a&gt;, and eventually into &lt;a href="https://www.stuurman.com/blog/2026-11-03-part-1-customizing-this-astro-theme/" rel="noopener noreferrer"&gt;a modular open-source Astro theme&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tip&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Standalone Astro / Unified Plugins&lt;/strong&gt;: As this stack matured, three zero-dependency Markdown plugins were extracted into standalone packages: &lt;a href="https://www.npmjs.com/package/rehype-mermaid-a11y" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;rehype-mermaid-a11y&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/edstuurman/rehype-mermaid-a11y" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;), &lt;a href="https://www.npmjs.com/package/rehype-tech-tooltips" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;rehype-tech-tooltips&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/edstuurman/rehype-tech-tooltips" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;), and &lt;a href="https://www.npmjs.com/package/remark-youtube-facade" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;remark-youtube-facade&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; (&lt;a href="https://github.com/edstuurman/remark-youtube-facade" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2025-11-25-building-an-astro-site/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2025-11-25-building-an-astro-site/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>astrojs</category>
      <category>aws</category>
      <category>infrastructure</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>The Helmsman's Bridge: Building a Unified Homelab Command Deck</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Fri, 20 Nov 2026 12:13:19 +0000</pubDate>
      <link>https://dev.to/edstuurman/the-helmsmans-bridge-building-a-unified-homelab-command-deck-1910</link>
      <guid>https://dev.to/edstuurman/the-helmsmans-bridge-building-a-unified-homelab-command-deck-1910</guid>
      <description>&lt;p&gt;The Dutch word &lt;em&gt;stuurman&lt;/em&gt; translates to helmsman, steersman, or ship's mate—the person at the wheel keeping a vessel pointed toward open water while the engineers below deck tend the engine room.&lt;/p&gt;

&lt;p&gt;When I first sketched out an internal portal for &lt;code&gt;home-lab.net&lt;/code&gt;, I called it &lt;strong&gt;Cockpit&lt;/strong&gt;. That early name is still baked into the database filename (&lt;code&gt;cockpit.db&lt;/code&gt;) and a few service labels under the hood. At the time, it felt like the obvious choice. Every homelab operator eventually pictures a row of glowing status tiles on a dark screen.&lt;/p&gt;

&lt;p&gt;Somewhere around day three of wiring ten live apps together, the word stopped fitting. An airplane cockpit is a cramped cluster of dials bolted inches from your knees for flying in thin air. A ship's &lt;strong&gt;Bridge&lt;/strong&gt; is open, quiet, and looking out across the horizon while the real machinery—Proxmox VE, ZFS pools, 10G fiber links, and Linux containers—hums along two decks below behind a closed closet door. You do not want to live in the engine room with a wrench. You just want one calm helm where you can read your mail, check a photo, or glance at the day's schedule without fighting ten separate browser tabs.&lt;/p&gt;

&lt;p&gt;So &lt;strong&gt;Cockpit&lt;/strong&gt; became &lt;strong&gt;The Bridge&lt;/strong&gt;—and over six busy days in November, it grew into a unified desktop and mobile home for ten self-hosted apps and eleven settings panels.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe9e4a0j5ppzlhpc2mtx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe9e4a0j5ppzlhpc2mtx1.png" alt="Bridge Home and Quick Dock showing desktop and mobile viewports with Wikimedia Commons Picture of the Day wallpaper, unified search bar, and notification bell" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Ten Good Backends, One Bad Daily Routine
&lt;/h2&gt;

&lt;p&gt;When you self-host best-of-breed open-source software instead of renting an all-in-one cloud suite, the underlying tools are genuinely great:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stalwart&lt;/strong&gt; runs mail, spam filtering, and Sieve rules inside a single fast Rust binary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Immich&lt;/strong&gt; indexes family photos on ZFS with local visual search.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seafile&lt;/strong&gt; handles block-level file syncing and encrypted vaults.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monica&lt;/strong&gt;, &lt;strong&gt;Radicale&lt;/strong&gt;, &lt;strong&gt;Memos&lt;/strong&gt;, &lt;strong&gt;Kimai&lt;/strong&gt;, &lt;strong&gt;SearXNG&lt;/strong&gt;, and &lt;strong&gt;LiteLLM + Ollama + Qdrant&lt;/strong&gt; each solve one focused problem cleanly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You get full ownership of your disks, backups, and data. What nobody mentions on a Docker Compose README is how messy that setup feels three weeks later—especially when you pull out your phone on a commuter train in the Kanagawa / Greater Tokyo area.&lt;/p&gt;

&lt;p&gt;What you actually end up with is a &lt;strong&gt;tab graveyard&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ten mismatched interfaces&lt;/strong&gt;: A dark-slate mail admin panel next to a bright-white PHP timesheet app, a Material photo timeline, and a decade-old contact manager, each with its own layout quirks and keyboard shortcuts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ten separate auth clocks&lt;/strong&gt;: Even behind single sign-on, different apps handle mobile redirects differently, drop deep-links after login, or expect personal tokens pasted into random forms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hostile phone screens&lt;/strong&gt;: Most self-hosted tools are built on big monitors and barely tested on a &lt;code&gt;390px&lt;/code&gt; phone. Open a multi-column inbox, filter bar, or preview modal on mobile and buttons quietly vanish off the edge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No shared alert feed&lt;/strong&gt;: Nothing tells you in one place that a calendar invite overlaps your afternoon, a contact reminder fired in Monica, or a Kimai timer has been ticking for four hours.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser-side LAN mess&lt;/strong&gt;: Letting a static browser app talk directly to ten internal services drags you into CORS headers, mixed-content headaches, and API tokens sitting inside browser storage.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The backend tools were doing their job. Living across ten disconnected bookmarks was the broken part.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. One Front Door in Astro SSR
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://www.stuurman.com/blog/2026-11-11-split-horizon-homelab-architecture/" rel="noopener noreferrer"&gt;our split-horizon homelab plan&lt;/a&gt;, &lt;code&gt;home-lab.net&lt;/code&gt; serves a lightweight static site on CloudFront and S3 to the public internet, while resolving to our Proxmox host at home whenever a device sits on the LAN or connects remotely over &lt;strong&gt;NetBird&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For the private Bridge, I wanted that exact same fast, calm feel without shipping a heavy JavaScript framework to the browser. There is no React, Vue, or Svelte runtime anywhere in the client bundle. Instead, the Bridge runs as a &lt;strong&gt;server-rendered Astro 7 app&lt;/strong&gt; on &lt;strong&gt;Node v25&lt;/strong&gt; with Tailwind CSS v4:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Server-rendered templates&lt;/strong&gt; build every page on demand with the signed-in user's real data already attached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client-side view transitions&lt;/strong&gt; keep jumps between Mail, Calendar, Photos, and Settings crisp without losing theme state or tearing down the shell.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Small vanilla TypeScript modules&lt;/strong&gt; handle menus, keyboard shortcuts, inline modals, and optimistic updates with almost zero browser overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Inside Proxmox, the Bridge sits in its own unprivileged Linux container behind &lt;strong&gt;Caddy&lt;/strong&gt; and &lt;strong&gt;Authelia&lt;/strong&gt; (backed by &lt;strong&gt;LLDAP&lt;/strong&gt;). Nothing on the internet ever touches it directly. Every request stops at Caddy first, where Authelia checks your passkey or hardware token, attaches verified identity headers, and adds a shared proxy secret so a stray container on the LAN cannot spoof another username by hitting the Bridge directly.&lt;/p&gt;

&lt;p&gt;Before any page or API route runs, server middleware validates that proxy secret, pulls the user's display name, mail aliases, and groups from LLDAP, and loads their saved service keys into request memory.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
  Browser["Desktop or Phone Browser\nLAN or NetBird Mesh"] --&amp;gt;|"HTTPS *.home-lab.net"| Caddy["Caddy Reverse Proxy\nTLS and Forward Auth"]
  Caddy --&amp;gt;|"Check session"| Authelia["Authelia SSO\nPasskeys and 2FA"]
  Authelia --&amp;gt;|"Groups and aliases"| LLDAP["LLDAP Directory\nUsers and Mail Aliases"]

  Caddy --&amp;gt;|"Verified identity headers"| Bridge["Astro SSR Bridge\nNode v25 Container"]
  Bridge &amp;lt;--&amp;gt;|"Encrypted vault"| SQLite[("Built-in SQLite\ncockpit.db")]

  Bridge --&amp;gt; SearXNG["SearXNG"]
  Bridge --&amp;gt; AI["LiteLLM, Ollama and Qdrant"]
  Bridge --&amp;gt; Stalwart["Stalwart Mail"]
  Bridge --&amp;gt; Calendar["Keeper.sh and Radicale"]
  Bridge --&amp;gt; Immich["Immich Photos"]
  Bridge --&amp;gt; Seafile["Seafile Drive"]
  Bridge --&amp;gt; Monica["Monica PRM"]
  Bridge --&amp;gt; Memos["Memos"]
  Bridge --&amp;gt; Kimai["Kimai Time"]&lt;/code&gt;&lt;/pre&gt;






&lt;h2&gt;
  
  
  3. One SQLite File Instead of Another Database Server
&lt;/h2&gt;

&lt;p&gt;When you build a server-side wrapper around ten apps, the reflexive enterprise habit is spinning up a fresh PostgreSQL cluster and a Redis cache just to store UI preferences, chat histories, and API keys. In a lab where we actively trimmed idle rack draw by &lt;a href="https://www.stuurman.com/blog/2026-11-08-the-sunk-cost-of-homelab-sprawl-knowing-when-to-liquidate-silicon/" rel="noopener noreferrer"&gt;retiring redundant servers&lt;/a&gt;, running two more database daemons on our home solar battery just for the front door made no sense. The engine-room apps already manage Postgres and MariaDB inside their own containers.&lt;/p&gt;

&lt;p&gt;Because &lt;strong&gt;Node v25&lt;/strong&gt; ships &lt;code&gt;node:sqlite&lt;/code&gt; built straight into the runtime, one local SQLite file in write-ahead logging mode handles everything with zero native C++ addon builds and zero extra background processes. It backs up cleanly alongside the rest of the container with a single snapshot command.&lt;/p&gt;

&lt;p&gt;That file holds each person's settings, custom &lt;code&gt;256×256&lt;/code&gt; avatar, SSH keys, mail filter rules, notification states, AI chat threads, external mail/calendar accounts, and personal service tokens. Every sensitive payload—IMAP passwords, OAuth2 refresh tokens, and backend API keys—is sealed on disk using &lt;strong&gt;AES-256-GCM&lt;/strong&gt; encryption derived from a server-side secret key before it ever hits SQLite.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
  Req["Signed-In User Request"] --&amp;gt; Vault{"1. Personal SQLite Vault\nEncrypted per user"}
  Vault --&amp;gt;|"Found"| Decrypt["Decrypt in Server Memory"]
  Vault --&amp;gt;|"Not set"| EnvMap{"2. Per-User Config Map"}
  EnvMap --&amp;gt;|"Found"| Ready["Use Personal Credentials"]
  EnvMap --&amp;gt;|"Not set"| Dir{"3. LLDAP User Attributes"}
  Dir --&amp;gt;|"Found"| Ready
  Dir --&amp;gt;|"Not set"| Strict{"Strict Multi-User Mode?"}
  Strict --&amp;gt;|"Yes"| None["Stay Unconfigured\nNever share across users"]
  Strict --&amp;gt;|"No"| Global["4. Global Lab Fallback"]
  Decrypt --&amp;gt; Ready&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Two strict boundaries keep household accounts cleanly separated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Per-user scoping everywhere&lt;/strong&gt;: Every SQL read, update, and deletion filters strictly by the signed-in user's normalized identity key, and strict multi-user mode disables shared fallback tokens completely. Even document vector lookups in Qdrant stamp and filter chunks by user key so one person's indexed PDFs never leak into another person's AI answers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No secrets in the browser&lt;/strong&gt;: &lt;code&gt;node:sqlite&lt;/code&gt; and &lt;code&gt;node:crypto&lt;/code&gt; stay strictly on the server. When you open &lt;code&gt;/settings&lt;/code&gt;, the browser only learns whether a service key is configured, where it came from, and its last four masked characters—never the raw token itself.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Real Mail and Calendars Without Open Ports
&lt;/h2&gt;

&lt;p&gt;Making a start page look tidy is the easy part. Making real email and calendar protocols work smoothly behind a residential fiber line takes more patience.&lt;/p&gt;

&lt;p&gt;Our homelab sits behind a &lt;strong&gt;NURO Hikari&lt;/strong&gt; optical router (double NAT) with zero inbound ports forwarded from the internet, paired with a &lt;strong&gt;NetBird&lt;/strong&gt; mesh overlay so phones and laptops reach &lt;code&gt;*.home-lab.net&lt;/code&gt; transparently on the road. Self-hosted services run happily behind that curtain—until you try linking external &lt;strong&gt;Google or cloud mail accounts&lt;/strong&gt; into the unified inbox using modern OAuth2 instead of legacy app passwords.&lt;/p&gt;

&lt;p&gt;External OAuth providers reject private &lt;code&gt;.home-lab.net&lt;/code&gt; callback URLs, and split-horizon DNS means the host header your browser sends can change depending on whether you are on the couch or over cellular data. So the Bridge resolves its public callback origin from explicit server configuration (or verified proxy headers), pairs every sign-in attempt with a &lt;strong&gt;PKCE&lt;/strong&gt; challenge and an &lt;strong&gt;HMAC-signed &lt;code&gt;HttpOnly&lt;/code&gt; state cookie&lt;/strong&gt;, and checks the returned state, cookie, signature, and signed-in user in constant time before saving anything. If a testing-mode Google token silently expires after seven days, the account flags itself for a one-click reconnect right inside Settings without losing your folder rules.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fthvmt8kt3hyioss8xbu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fthvmt8kt3hyioss8xbu5.png" alt="Unified Webmail workspace showing desktop 3-pane thread view, inline meeting invite conflict detection, and mobile inbox view" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Combining &lt;strong&gt;Stalwart&lt;/strong&gt; (speaking JMAP with automatic IMAP/SMTP fallback), standard IMAP servers, and cloud REST mailboxes behind one URL scheme also tripped a classic routing quirk: cloud message IDs love &lt;code&gt;+&lt;/code&gt;, &lt;code&gt;/&lt;/code&gt;, and &lt;code&gt;=&lt;/code&gt; characters that break URL path parameters. Wrapping every external folder, message, and attachment identifier in a URL-safe base64 envelope keeps links uniform across every provider.&lt;/p&gt;

&lt;p&gt;Calendars follow the same unified path across &lt;strong&gt;Keeper.sh&lt;/strong&gt;, local &lt;strong&gt;Radicale&lt;/strong&gt; (CalDAV), read-only Webcal feeds, and Google or external cloud accounts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Incoming &lt;code&gt;.ics&lt;/code&gt; invites inside Webmail are parsed on the server and checked automatically against your schedule for that exact window, showing an inline conflict warning and a &lt;strong&gt;Find Free Slot&lt;/strong&gt; button right above the RSVP bar.&lt;/li&gt;
&lt;li&gt;Clicking &lt;strong&gt;Accept&lt;/strong&gt;, &lt;strong&gt;Tentative&lt;/strong&gt;, or &lt;strong&gt;Decline&lt;/strong&gt;—or editing or cancelling a meeting in &lt;code&gt;/calendar/&lt;/code&gt;—builds a clean &lt;code&gt;.ics&lt;/code&gt; invite or cancellation and dispatches it through Stalwart without blocking your calendar update if mail delivery takes an extra second.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhrx04nu6fc506lcllo7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhrx04nu6fc506lcllo7l.png" alt="Calendar and Scheduling workspace showing weekly schedule grid, Keeper.sh and Radicale CalDAV feeds, and mobile timeline" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Ten Workspaces and One Settings Page
&lt;/h2&gt;

&lt;p&gt;Every daily workflow inside &lt;code&gt;home-lab.net&lt;/code&gt; now shares one header, one theme toggle, and one keyboard navigation model instead of ten unrelated bookmarks:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Route&lt;/th&gt;
&lt;th&gt;Workspace&lt;/th&gt;
&lt;th&gt;What It Wraps &amp;amp; Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Home&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Daily Wikimedia Commons Picture of the Day wallpaper, &lt;code&gt;!bang&lt;/code&gt; launcher, and 7-app notification bell&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/search/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;SearXNG&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Private metasearch across web, images, news, and docs with zero tracking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/ai/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Ask AI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;LiteLLM and local Ollama chat with Qdrant/Paperless document search, file uploads, and saved threads&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/mail/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Webmail&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Stalwart inbox alongside external IMAP and cloud accounts, Sieve rules, rich signatures, and Monica autocomplete&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/calendar/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Calendar&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Combined schedule across Keeper.sh, Radicale CalDAV, and cloud feeds with conflict checks and &lt;code&gt;.ics&lt;/code&gt; invites&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/photos/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Photos&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fast Immich timeline and masonry grid, smart search, and drag-and-drop uploads through the server proxy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/files/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Files&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Seafile library browser, encrypted vault unlocking, Markdown previewer, and ZFS pool usage readouts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/people/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;People&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Monica relationship manager for notes, family links, preferences, gifts, and keep-in-touch reminders&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/memos/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Memos&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Quick Markdown micro-notes with &lt;code&gt;#tag&lt;/code&gt; filters, pinned checklists, and auto-save&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/time/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Time Tracking&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Kimai live stopwatch, daily and weekly targets, billable tracking, and timesheet logs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  One Notification Feed Across Seven Apps
&lt;/h3&gt;

&lt;p&gt;Instead of opening seven tabs over morning coffee just to see what changed, the Bridge polls seven adapters in parallel—&lt;strong&gt;Mail&lt;/strong&gt;, &lt;strong&gt;Calendar&lt;/strong&gt;, &lt;strong&gt;Time&lt;/strong&gt;, &lt;strong&gt;People&lt;/strong&gt;, &lt;strong&gt;Files&lt;/strong&gt;, &lt;strong&gt;Memos&lt;/strong&gt;, and &lt;strong&gt;Photos&lt;/strong&gt;—with tight per-source timeouts so a restarting container never stalls the rest of the page. Read flags, dismissals, and per-app mute toggles all save per user in SQLite.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg7530h0f3a6r8b6lgfuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg7530h0f3a6r8b6lgfuv.png" alt="Monica People PRM workspace showing contact profile, stay-in-touch cadence, reciprocal relations, and categorized preferences" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Eleven Settings Tabs Under One Roof
&lt;/h3&gt;

&lt;p&gt;Configuration lives in &lt;code&gt;/settings&lt;/code&gt; behind a split back button that always remembers which app sent you there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ten personal tabs&lt;/strong&gt; cover Security &amp;amp; 2FA (Authelia status, hardware passkeys, active sessions, custom avatar uploads, and SSH keys synced to GitLab), Search, AI models and prompt presets, Mail accounts/Sieve/signatures, Photos, Calendar feeds, Files, People/CardDAV, Memos, and Time Tracking billing rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One admin-only tab&lt;/strong&gt; (shown strictly to directory admins) provisions or removes accounts across &lt;strong&gt;LLDAP&lt;/strong&gt;, &lt;strong&gt;Immich&lt;/strong&gt;, &lt;strong&gt;Stalwart&lt;/strong&gt;, and &lt;strong&gt;Keeper.sh&lt;/strong&gt; in one step while minting per-user &lt;strong&gt;LiteLLM&lt;/strong&gt; virtual keys with monthly spending limits—or auto-provisions missing service accounts quietly on first login.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh4ikjgjr0aqfuxpfimrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh4ikjgjr0aqfuxpfimrq.png" alt="Security and Authelia 2FA settings panel showing identity profile, SSH keys, and enrolled hardware passkeys" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Fixing What Breaks on a Phone Screen
&lt;/h2&gt;

&lt;p&gt;Anyone can make a homelab UI look sharp in a &lt;code&gt;1366×860&lt;/code&gt; desktop screenshot. The real test is whether you can archive three emails, check a schedule clash, and stop a timer one-handed on a &lt;code&gt;390×844&lt;/code&gt; phone screen without zooming or losing buttons off the side.&lt;/p&gt;

&lt;p&gt;Instead of saving responsive CSS for the last hour, we wired &lt;strong&gt;headless Chrome over the DevTools Protocol&lt;/strong&gt; into our verification pass, snapping paired desktop (&lt;code&gt;1366×860&lt;/code&gt;) and mobile (&lt;code&gt;390×844&lt;/code&gt;) views of every app and settings tab. Looking at real &lt;code&gt;390px&lt;/code&gt; renders caught four layout bugs that static code review almost always misses:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Growing reply boxes pushing &lt;code&gt;Send&lt;/code&gt; offscreen&lt;/strong&gt;: In Webmail's quick reply and signature editor, an auto-expanding rich-text box inside a fixed viewport shoved the &lt;strong&gt;Send Reply&lt;/strong&gt; button straight below the fold as soon as you typed four lines. Capping the editor height with internal scrolling kept the compose bar pinned under your thumb.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter pills blowing out page width&lt;/strong&gt;: Category chips in People, Kimai, and Search wrapped into awkward multi-line stacks or pushed the entire page wider than &lt;code&gt;390px&lt;/code&gt; until constrained inside clean horizontal scroll rails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Colliding modal toolbars&lt;/strong&gt;: File and attachment preview modals stacked &lt;strong&gt;Download&lt;/strong&gt;, &lt;strong&gt;Share&lt;/strong&gt;, and &lt;strong&gt;Close&lt;/strong&gt; buttons on top of long filenames at narrow widths until re-laid out with proper wrapping and breathing room.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notifications swallowing the mobile menu&lt;/strong&gt;: Dumping seven apps' worth of alerts straight into a slide-down phone drawer buried the app switcher below the fold. Keeping a single preview alert at the top and tucking per-app mute toggles inside a collapsible drawer restored instant one-tap navigation.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  7. Six Days from Sketch to Daily Driver
&lt;/h2&gt;

&lt;p&gt;Looking back at the git history shows how much velocity changes when you pair systems fundamentals with fast feedback:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;270 commits&lt;/strong&gt; landed in &lt;strong&gt;6 days&lt;/strong&gt; (&lt;code&gt;2026-11-13&lt;/code&gt; to &lt;code&gt;2026-11-18&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;368 source files&lt;/strong&gt; covering server adapters, Astro templates, client scripts, and shared contracts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;20 test suites running 236 passing tests&lt;/strong&gt; in a couple of seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fast edits only stay safe if you know immediately when a refactor breaks an adapter three layers down. Waiting half a minute for Astro and Vite to compile on every backend tweak kills flow, so our test runner uses Node v25's native TypeScript support with minimal Astro stubs and an in-memory SQLite database. Mail routing, calendar invite parsing, AES-256-GCM encryption, and notification aggregation all verify in seconds.&lt;/p&gt;

&lt;p&gt;Just like when I &lt;a href="https://www.stuurman.com/blog/2026-10-27-converting-to-ai-assisted-engineering/" rel="noopener noreferrer"&gt;switched stuurman.com to AI-assisted engineering&lt;/a&gt;, the real trick wasn't dumping one giant prompt into a chat box. It was separating the blueprint cleanly—locking down types and SQL boundaries first, splitting parallel work across independent modules, and checking every change with fast unit tests and real headless Chrome screenshots.&lt;/p&gt;




&lt;h2&gt;
  
  
  8. The Full 21-Screen Bridge Gallery
&lt;/h2&gt;

&lt;p&gt;Here is the complete visual tour across all &lt;strong&gt;10 workspaces&lt;/strong&gt; and &lt;strong&gt;11 settings panels&lt;/strong&gt;, captured straight from the live Astro SSR Bridge across &lt;code&gt;1366×860&lt;/code&gt; desktop and &lt;code&gt;390×844&lt;/code&gt; mobile viewports:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe9e4a0j5ppzlhpc2mtx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe9e4a0j5ppzlhpc2mtx1.png" alt="01. Bridge Home &amp;amp; Quick Dock — Wikimedia POTD wallpaper, centered launcher &amp;amp; 7-app notification bell" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;01. Bridge Home &amp;amp; Quick Dock — Wikimedia POTD wallpaper, centered launcher &amp;amp; 7-app notification bell&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6945twc5kv9kylbu30wp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6945twc5kv9kylbu30wp.png" alt="02. SearXNG Meta-Search — Privacy-preserving search proxy with category filters and !bangs" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;02. SearXNG Meta-Search — Privacy-preserving search proxy with category filters and !bangs&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0plh2jj58y5lp751wm17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0plh2jj58y5lp751wm17.png" alt="03. Ask AI Gateway — LiteLLM + local Ollama router with model switcher, Qdrant RAG &amp;amp; saved chat threads" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;03. Ask AI Gateway — LiteLLM + local Ollama router with model switcher, Qdrant RAG &amp;amp; saved chat threads&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fthvmt8kt3hyioss8xbu5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fthvmt8kt3hyioss8xbu5.png" alt="04. Unified Webmail — Stalwart JMAP/IMAP primary + external OAuth2 accounts, inline conflict alerts &amp;amp; quick reply" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;04. Unified Webmail — Stalwart JMAP/IMAP primary + external OAuth2 accounts, inline conflict alerts &amp;amp; quick reply&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhrx04nu6fc506lcllo7l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhrx04nu6fc506lcllo7l.png" alt="05. Calendar &amp;amp; Scheduling — Keeper.sh + Radicale CalDAV + cloud OAuth2 sync &amp;amp; .ics invite dispatch" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;05. Calendar &amp;amp; Scheduling — Keeper.sh + Radicale CalDAV + cloud OAuth2 sync &amp;amp; .ics invite dispatch&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F86ivryqq5th9cmqcchl4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F86ivryqq5th9cmqcchl4.png" alt="06. Immich Photos — Private server proxy with virtualized timeline, continuous masonry &amp;amp; CLIP smart search" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;06. Immich Photos — Private server proxy with virtualized timeline, continuous masonry &amp;amp; CLIP smart search&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb90v4eaghnj4l0y67gso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb90v4eaghnj4l0y67gso.png" alt="07. Seafile Drive &amp;amp; Vault — Encrypted libraries, folder browsing, Markdown previewer &amp;amp; ZFS NVMe telemetry" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;07. Seafile Drive &amp;amp; Vault — Encrypted libraries, folder browsing, Markdown previewer &amp;amp; ZFS NVMe telemetry&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg7530h0f3a6r8b6lgfuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg7530h0f3a6r8b6lgfuv.png" alt="08. Monica People PRM — Contacts, reciprocal family/mentor links, preferences &amp;amp; stay-in-touch cadences" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;08. Monica People PRM — Contacts, reciprocal family/mentor links, preferences &amp;amp; stay-in-touch cadences&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fers22w8t3wk8sml3bd1s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fers22w8t3wk8sml3bd1s.png" alt="09. Memos Knowledge Stream — Markdown micro-notes, #tag filtering, pinned checklists &amp;amp; JSON export" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;09. Memos Knowledge Stream — Markdown micro-notes, #tag filtering, pinned checklists &amp;amp; JSON export&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsa1secuz6ljv5ialper6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsa1secuz6ljv5ialper6.png" alt="10. Kimai Time Tracking — Live project stopwatch, weekly billable targets &amp;amp; timesheet records" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;10. Kimai Time Tracking — Live project stopwatch, weekly billable targets &amp;amp; timesheet records&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh4ikjgjr0aqfuxpfimrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fh4ikjgjr0aqfuxpfimrq.png" alt="11. Settings: Security &amp;amp; Authelia 2FA — Profile details, GitLab-synced SSH keys &amp;amp; WebAuthn passkeys" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;11. Settings: Security &amp;amp; Authelia 2FA — Profile details, GitLab-synced SSH keys &amp;amp; WebAuthn passkeys&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0pbn1jhif1mpf6p573im.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0pbn1jhif1mpf6p573im.png" alt="12. Settings: Search Engine — Default SearXNG engine, SafeSearch level &amp;amp; custom !bang shortcuts" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;12. Settings: Search Engine — Default SearXNG engine, SafeSearch level &amp;amp; custom !bang shortcuts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcwybj6pirxqb5uupeuwz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcwybj6pirxqb5uupeuwz.png" alt="13. Settings: AI Assistant &amp;amp; Models — LiteLLM quota, default inference model, temperature &amp;amp; prompt presets" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;13. Settings: AI Assistant &amp;amp; Models — LiteLLM quota, default inference model, temperature &amp;amp; prompt presets&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F42mjwbqzpe6d5dy5zjo7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F42mjwbqzpe6d5dy5zjo7.png" alt="14. Settings: Mail Accounts &amp;amp; Signatures — External IMAP/OAuth2 accounts, Sieve rules &amp;amp; rich signatures" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;14. Settings: Mail Accounts &amp;amp; Signatures — External IMAP/OAuth2 accounts, Sieve rules &amp;amp; rich signatures&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ngvrkr2snxtocnbe2ft.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ngvrkr2snxtocnbe2ft.png" alt="15. Settings: Photos &amp;amp; Wallpaper — Immich server telemetry, ZFS storage quota &amp;amp; ML transcoding toggles" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;15. Settings: Photos &amp;amp; Wallpaper — Immich server telemetry, ZFS storage quota &amp;amp; ML transcoding toggles&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb88n7tot58jor8rrqdbm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb88n7tot58jor8rrqdbm.png" alt="16. Settings: Calendar Feeds &amp;amp; Sync — Connected CalDAV/Webcal/OAuth2 feeds, week start &amp;amp; conflict alerts" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;16. Settings: Calendar Feeds &amp;amp; Sync — Connected CalDAV/Webcal/OAuth2 feeds, week start &amp;amp; conflict alerts&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fedq4evg9c8wu57fxg13r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fedq4evg9c8wu57fxg13r.png" alt="17. Settings: Files &amp;amp; Seafile Storage — ZFS NVMe dataset breakdown, sort order &amp;amp; encrypted library vaults" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;17. Settings: Files &amp;amp; Seafile Storage — ZFS NVMe dataset breakdown, sort order &amp;amp; encrypted library vaults&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fppts89k7zud0fqud35vo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fppts89k7zud0fqud35vo.png" alt="18. Settings: People &amp;amp; CardDAV — External CardDAV sync sources &amp;amp; relationship reminder intervals" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;18. Settings: People &amp;amp; CardDAV — External CardDAV sync sources &amp;amp; relationship reminder intervals&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnb02nuv8t3t4k8t2ams8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnb02nuv8t3t4k8t2ams8.png" alt="19. Settings: Memos Preferences — Default note visibility, auto-save cadence &amp;amp; JSON backup export" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;19. Settings: Memos Preferences — Default note visibility, auto-save cadence &amp;amp; JSON backup export&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0i8dwq392ghfjlzu7pan.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0i8dwq392ghfjlzu7pan.png" alt="20. Settings: Time Tracking — Hourly rate, JPY billing currency, rounding rules &amp;amp; project codes" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;20. Settings: Time Tracking — Hourly rate, JPY billing currency, rounding rules &amp;amp; project codes&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqik9pnxmbtdq7bxi4omi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqik9pnxmbtdq7bxi4omi.png" alt="21. Settings: Admin &amp;amp; Infrastructure Control — Multi-service user provisioning &amp;amp; LiteLLM model keys" width="800" height="490"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;21. Settings: Admin &amp;amp; Infrastructure Control — Multi-service user provisioning &amp;amp; LiteLLM model keys&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing: A Helm Worth Using
&lt;/h2&gt;

&lt;p&gt;The point of building &lt;strong&gt;The Bridge&lt;/strong&gt; wasn't to hang another decorative dashboard on a spare monitor. A homelab only earns its keep—and its overnight watts on a residential solar battery—when the tools running on it feel calm and natural to reach, whether you are sitting at a desk or standing on a train platform with one thumb free.&lt;/p&gt;

&lt;p&gt;Down in the engine room, Proxmox, ZFS, Stalwart, Immich, and NetBird keep turning quietly out of sight. Up on the bridge, everything finally answers to one wheel.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-19-the-helmsmans-bridge-building-a-unified-homelab-command-deck/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-19-the-helmsmans-bridge-building-a-unified-homelab-command-deck/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>architecture</category>
      <category>engineering</category>
      <category>security</category>
    </item>
    <item>
      <title>Hybrid Drives Are Back Because NAND Got Expensive (And Why Black-Box Tiering Still Scares Storage Engineers)</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Fri, 20 Nov 2026 12:13:12 +0000</pubDate>
      <link>https://dev.to/edstuurman/hybrid-drives-are-back-because-nand-got-expensive-and-why-black-box-tiering-still-scares-storage-29nh</link>
      <guid>https://dev.to/edstuurman/hybrid-drives-are-back-because-nand-got-expensive-and-why-black-box-tiering-still-scares-storage-29nh</guid>
      <description>&lt;p&gt;Whenever flash prices climb high enough, hardware vendors reach back into the shelf and dust off the hybrid drive.&lt;/p&gt;

&lt;p&gt;In late 2026, the storage market walked straight back into that economic squeeze. Hyperscale AI training and inference clusters—soaking up vast pools of high-capacity enterprise flash for key-value caches and retrieval stores while locking down enterprise HDD production capacity quarters in advance—pushed both NAND and spinning platters sharply upward at the exact same time.&lt;/p&gt;

&lt;p&gt;Right on schedule, in November 2026, Seagate announced the &lt;strong&gt;FireCuda Forge&lt;/strong&gt;: an external desktop unit over USB4 pairing an 8 TB (\$699.99) or 20 TB (\$899.99) mechanical HDD with an empty internal M.2 2280 NVMe slot (bring your own SSD, up to 1 TB recognized for caching), powered by an external 12V brick and trimmed with programmable RGB lighting. Inside the enclosure sits Seagate's &lt;strong&gt;Alkemi&lt;/strong&gt; engine—an onboard FPGA running an embedded Linux environment that watches access patterns and dynamically migrates hot blocks between the NVMe stick and the spinning platter behind a single unified volume, rated up to 2,500 MB/s read and 2,000 MB/s write.&lt;/p&gt;

&lt;p&gt;The pitch is always seductive: &lt;em&gt;SSD speed at HDD cost.&lt;/em&gt; Put a single terabyte of fast flash in front of twenty terabytes of cheap spinning metal, hide the boundary behind a smart controller, and let an algorithm sort out what stays hot.&lt;/p&gt;

&lt;p&gt;Most storage engineers who have spent real hours staring at dead pools or frozen clusters feel a quiet knot in their stomach when that pitch comes back around. &lt;strong&gt;Black-box tiering does not give you flash speed on a platter budget. It multiplies your failure domains while stripping away your visibility into where your bytes actually live.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Anatomy of Black-Box Tiering
&lt;/h2&gt;

&lt;p&gt;The industry has run this experiment before, and the failure mechanics have not changed just because the cable switched from SATA to USB4.&lt;/p&gt;

&lt;h3&gt;
  
  
  Apple's 2012 Fusion Drive: One Logical Volume, Two Independent Failures
&lt;/h3&gt;

&lt;p&gt;Anyone who serviced Late 2012 iMacs or Mac minis remembers the &lt;strong&gt;Fusion Drive&lt;/strong&gt;. Apple bolted a proprietary 128 GB PCIe flash blade alongside a 1 TB or 3 TB 3.5-inch SATA spinning disk and welded them together in software—originally via &lt;strong&gt;Core Storage&lt;/strong&gt;, and later automatically converted into a synthesized &lt;strong&gt;APFS&lt;/strong&gt; container on macOS Mojave and newer.&lt;/p&gt;

&lt;p&gt;To the user sitting in front of the screen, macOS showed one tidy logical drive (&lt;code&gt;Macintosh HD&lt;/code&gt;). Frequently touched OS binaries and recent work quietly migrated onto the flash blade while cold photo libraries settled onto magnetic platters.&lt;/p&gt;

&lt;p&gt;The availability math underneath was brutal. Combining two separate physical storage devices into a single non-redundant logical volume does not average their reliability—it multiplies their failure probabilities together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the mechanical drive seized a bearing, developed bad sectors, or dropped off the SATA bus, &lt;strong&gt;the healthy SSD could not mount a complete filesystem&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If the flash blade hit wear limits or controller lockup, &lt;strong&gt;the healthy HDD was left holding orphaned extents&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because filesystem catalog trees and block allocation maps spanned both physical stores, pulling the surviving SSD out of a dead Fusion iMac and plugging it into a second Mac over an adapter left you staring at broken pointers, unmountable synthesized containers, and zero-byte directory ghosts. Losing either physical drive destroyed the logical volume image. One bad platter took down twice as much hardware worth of trust—all disguised behind a single drive icon on the desktop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Heatmaps Know Frequency, Not Meaning
&lt;/h3&gt;

&lt;p&gt;Even when a tiering system adds redundancy behind the curtain—or uses flash strictly as a transparent cache in front of a mechanical disk—block-level tiering still suffers from a fundamental blind spot: &lt;strong&gt;a heatmap has zero semantic awareness.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An onboard FPGA or storage filter driver tracks access frequency and recency across uniform block chunks (often 2 MB allocation units or raw logical block addresses). To that controller, every hot 4 KiB write looks identical:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It cannot tell a database write-ahead log (&lt;code&gt;WAL&lt;/code&gt;) that demands strict ordered persistence apart from an OS swap file thrashing under memory pressure.&lt;/li&gt;
&lt;li&gt;It cannot tell an active virtual machine boot index apart from a 90 GB sequential video export that bursts straight through the 1 TB flash boundary, fills every clean erase block, and forces frantic background eviction storms onto a 7,200 RPM platter right when a latency-sensitive random read arrives.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sitting behind an opaque USB4 bridge or kernel filter also blurs physical media boundaries for the host operating system. &lt;code&gt;SMART&lt;/code&gt; telemetry, &lt;code&gt;TRIM&lt;/code&gt; / deallocate boundaries, and strict &lt;code&gt;fsync&lt;/code&gt; or Force Unit Access (&lt;code&gt;FUA&lt;/code&gt;) flush semantics belong to the firmware inside the box rather than the filesystem on the host. When latency spikes or power drops mid-migration, you are debugging a black box whose internal queues you cannot inspect.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. The War Story: When a Two-Rack Cluster Froze Its Own Brain
&lt;/h2&gt;

&lt;p&gt;You do not even need a consumer USB enclosure to fall into the trap of hidden shared storage tiers. Sometimes an enterprise architecture puts you right in the middle of one—even when everyone involved built the cluster cleanly on paper.&lt;/p&gt;

&lt;p&gt;Years ago, I was pulled into an ugly production escalation involving a two-rack enterprise storage virtualization cluster built on &lt;strong&gt;DataCore SANsymphony&lt;/strong&gt; running on &lt;strong&gt;Windows Server&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Topology and the Ghost Freeze
&lt;/h3&gt;

&lt;p&gt;The setup was straightforward enterprise redundancy: two independent racks, each housing a Windows Server storage node running SANsymphony directly in the kernel executive stack. DataCore does not sit in user space like an ordinary application; it injects tightly coupled file-system filter drivers, SCSI port/miniport drivers, and intermediate block drivers straight into the Windows I/O path. Every host write arriving over the SAN fabric was intercepted in kernel space, pushed toward local Tier 1 SSD write cache and storage pools, and mirrored synchronously across the inter-rack link to the partner node before acknowledging completion back to the hypervisors.&lt;/p&gt;

&lt;p&gt;Under steady daytime workloads, the cluster behaved smoothly.&lt;/p&gt;

&lt;p&gt;Under heavy write bursts—overnight backup windows, storage migrations, or batch database loads—a node would suddenly freeze solid. Not crawl, not throw disk errors: &lt;strong&gt;freeze&lt;/strong&gt;. Management sessions locked, Windows stopped responding, cluster heartbeats missed their deadlines, and the partner node across the aisle declared its peer dead, triggering violent failover cascades and split-brain witness arbitration across both racks.&lt;/p&gt;

&lt;p&gt;Ten minutes later, after a forced reset or once the storm passed, every hardware diagnostic came back spotless. Zero ECC memory errors, clean optical links, healthy SMART counters on every drive.&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding the Shared Bus Behind &lt;code&gt;C:\&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Early assumptions pointed at network jitter on the synchronous mirror links or a race condition in the cluster witness timer. Tracing the physical storage topology inside each node told a very different story.&lt;/p&gt;

&lt;p&gt;Whoever originally racked and imaged the servers had followed a completely sensible instinct: &lt;strong&gt;install the Windows Server operating system (&lt;code&gt;C:\&lt;/code&gt;) on the fastest storage tier in the chassis—the enterprise SSDs.&lt;/strong&gt; On paper, putting the OS on flash makes every boot faster and keeps the controller responsive.&lt;/p&gt;

&lt;p&gt;What nobody noticed on the build sheet was the PCIe backplane wiring underneath. Those SSDs holding &lt;code&gt;C:\&lt;/code&gt; sat behind the &lt;strong&gt;exact same SAS/SATA HBA controller channels and shared hardware queue depth&lt;/strong&gt; as DataCore's Tier 1 flash write cache and synchronous mirror targets.&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
  subgraph Before["1. Shared-Bus Contention (Why the Cluster Froze)"]
    direction TB
    WinBefore["Windows Server Kernel (OS Disk C:)"] --&amp;gt;|"Event logs, pagefile, heartbeat timers"| SharedHBA["Shared SAS/SATA HBA (Queue Depth 100% Saturated)"]
    DCBefore["DataCore SANsymphony Kernel Drivers"] --&amp;gt;|"Heavy write bursts + synchronous mirror flush"| SharedHBA
    SharedHBA --&amp;gt; SSDPool["Tier 1 SSD Tier (Holding OS C: and Storage Cache)"]
    SharedHBA -.-&amp;gt;|"OS IRPs starve behind write storm"| Freeze["Node Locks Up (Missed Heartbeats, Rack Failover Cascade)"]
  end

  subgraph After["2. Isolated Failure Domains (The Fix)"]
    direction TB
    WinAfter["Windows Server Kernel (OS Disk C:)"] --&amp;gt;|"Dedicated low-queue OS path"| SataChan["Separate SATA Controller Channel"]
    SataChan --&amp;gt; SataOS["Dedicated Slower SATA OS Mirror"]
    DCAfter["DataCore SANsymphony Kernel Drivers"] --&amp;gt;|"Full queue depth stays dedicated to data plane"| MainHBA["Dedicated Storage HBAs (100% Write Burst Tolerance)"]
    MainHBA --&amp;gt; DataTier["Tier 1 Flash Cache + Storage Pools"]
  end&lt;/code&gt;&lt;/pre&gt;



&lt;h3&gt;
  
  
  How the Control Plane Choked on Its Own Data Plane
&lt;/h3&gt;

&lt;p&gt;Once you trace the I/O path through the Windows kernel, the freeze stops looking mysterious and turns into pure physics:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A heavy write burst hits the virtual disks from upstream hypervisors.&lt;/li&gt;
&lt;li&gt;DataCore's kernel filter and miniport drivers immediately ramp up to handle the surge, mirroring blocks across the rack interconnect and flushing Tier 1 cache writes onto the local flash arrays.&lt;/li&gt;
&lt;li&gt;Because those drivers operate at maximum kernel priority, they drive the HBA's hardware queue depth straight to &lt;strong&gt;100% saturation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Meanwhile, Windows Server still needs to touch &lt;code&gt;C:\&lt;/code&gt;. It writes Windows Event Log entries, touches the pagefile, updates registry hives, and runs routine system housekeeping that blocks on disk completion.&lt;/li&gt;
&lt;li&gt;Because &lt;code&gt;C:\&lt;/code&gt; shares the exact same HBA channels and hardware queue behind DataCore's torrent of storage writes, &lt;strong&gt;every OS disk request gets stuck at the back of the data plane's saturated queue&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Windows kernel threads stalled waiting on storage I/O request packets (&lt;code&gt;IRPs&lt;/code&gt;) that could not clear the overloaded HBA. DataCore's own cluster heartbeat timers stalled right alongside the Windows kernel that hosted them. From the outside rack, the node looked dead. In reality, &lt;strong&gt;the control plane had suffocated waiting on its own data plane.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Ironic Craftsman Fix
&lt;/h3&gt;

&lt;p&gt;Fixing a million-dollar enterprise cluster freeze did not require faster NVMe arrays, custom registry timeouts, or exotic firmware patches.&lt;/p&gt;

&lt;p&gt;It required moving &lt;code&gt;C:\&lt;/code&gt; &lt;strong&gt;off&lt;/strong&gt; the fast SSD tier and onto a pair of "slower" SATA drives wired to a &lt;strong&gt;completely separate controller channel&lt;/strong&gt;, physically isolated from the main storage HBAs.&lt;/p&gt;

&lt;p&gt;Once Windows Server finishes booting, its kernel, drivers, and system binaries are already resident in RAM. The OS boot volume does not need 100,000 benchmark IOPS. What it needs during an emergency is &lt;strong&gt;guaranteed, uncontested queue depth&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;C:\&lt;/code&gt; isolated onto its own boring SATA bus, DataCore could hammer the primary storage HBAs to 100% saturation all night long during brutal write storms. The Windows kernel never waited behind a single data-plane write, heartbeats stayed steady to the millisecond, and the cluster never suffered another mysterious freeze.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Alternative: Explicit Semantic Topologies in OpenZFS
&lt;/h2&gt;

&lt;p&gt;That lesson—keeping control metadata, failure boundaries, and bulk capacity strictly separated—is why I run &lt;strong&gt;OpenZFS&lt;/strong&gt; directly on my Proxmox host at home today (&lt;a href="https://www.stuurman.com/blog/2026-11-11-split-horizon-homelab-architecture/" rel="noopener noreferrer"&gt;as part of my single-host lab core&lt;/a&gt;) instead of trusting any automated tiering black box.&lt;/p&gt;

&lt;p&gt;OpenZFS refuses to guess which blocks matter using opaque access counters. Instead, it separates storage devices by &lt;strong&gt;explicit semantic role and failure domain&lt;/strong&gt;, making every trade-off visible right inside &lt;code&gt;zpool status&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;ZFS Vdev Role&lt;/th&gt;
&lt;th&gt;Semantic Job&lt;/th&gt;
&lt;th&gt;If This Physical Drive Dies&lt;/th&gt;
&lt;th&gt;Required Redundancy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Data vdev&lt;/strong&gt; (&lt;code&gt;mirror&lt;/code&gt; / &lt;code&gt;raidz&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Holds authoritative file blocks &amp;amp; bulk capacity&lt;/td&gt;
&lt;td&gt;Covered up to parity/mirror tolerance; pool degrades if 1 fails&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;mirror&lt;/code&gt; or &lt;code&gt;raidz2&lt;/code&gt; based on rebuild risk&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;L2ARC&lt;/strong&gt; (&lt;code&gt;cache&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Ephemeral secondary read cache extending RAM ARC&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Zero data loss.&lt;/strong&gt; Clean blocks only; ZFS drops it and reads from pool&lt;/td&gt;
&lt;td&gt;None required (single NVMe is safe)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;SLOG&lt;/strong&gt; (&lt;code&gt;log&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Bounded sequential log for synchronous writes (ZIL)&lt;/td&gt;
&lt;td&gt;Risk limited to uncommitted in-flight sync writes during dual failure (power cut + drive death)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Mirrored&lt;/strong&gt; high-endurance PLP flash for production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;special&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;special&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Stores pool-wide metadata trees &amp;amp; optional small blocks&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Catastrophic total pool loss&lt;/strong&gt; (holds authoritative directory &amp;amp; block pointers)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Mirrored&lt;/strong&gt; (&lt;code&gt;&amp;gt;=&lt;/code&gt; data vdev fault tolerance)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Look closely at the difference between black-box caching and those three specialized OpenZFS roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;L2ARC stays strictly ephemeral.&lt;/strong&gt; It only caches clean blocks already committed to your main data vdevs. If that NVMe controller dies in the middle of the night—or if you physically pull the drive out of the slot—zero data is lost and the pool never blinks. And because L2ARC burns system RAM to maintain its buffer headers, you only attach one after checking actual ARC hit statistics rather than assuming more flash automatically equals faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SLOG is a safety log, not a generic write cache.&lt;/strong&gt; It only buffers synchronous write intents (&lt;code&gt;fsync&lt;/code&gt;, &lt;code&gt;O_SYNC&lt;/code&gt;, sync NFS exports, VM database journals) until the main pool commits the next transaction group. During normal operation, ZFS never reads from a SLOG—it is read strictly during crash recovery after an unclean shutdown. Because a power loss paired with a dead single-stick consumer SSD would break synchronous write guarantees, you put SLOG on power-loss-protected (PLP) enterprise flash and mirror it for real workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;special&lt;/code&gt; metadata vdevs isolate tree lookups explicitly.&lt;/strong&gt; Pinning dnodes, indirect blocks, directory entries, and small files (below &lt;code&gt;special_small_blocks&lt;/code&gt;) onto fast mirrored NVMe makes &lt;code&gt;find&lt;/code&gt;, &lt;code&gt;zfs list&lt;/code&gt;, and photo-library crawls feel instantaneous while multi-gigabyte media streams straight onto cheaper spinning platters. Crucially, OpenZFS never hides the blast radius: because the &lt;code&gt;special&lt;/code&gt; vdev holds authoritative pool metadata, losing it destroys the entire pool, so ZFS expects you to mirror it with equal or greater redundancy than your main storage vdevs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Deterministic Crash Consistency Without Magic Controllers
&lt;/h3&gt;

&lt;p&gt;Compare how a black-box hybrid box handles sudden power loss—juggling dirty tier-migration state tables across volatile FPGA buffers and two dissimilar drives—against how OpenZFS anchors every transaction on disk.&lt;/p&gt;

&lt;p&gt;Every ZFS top-level vdev reserves &lt;strong&gt;four identical 256 KiB vdev labels&lt;/strong&gt;: two copies at the start of the drive and two at the end. Inside each 256 KiB label sits pool configuration data alongside a &lt;strong&gt;128 KiB circular &lt;code&gt;uberblock&lt;/code&gt; ring (&lt;code&gt;VDEV_UBERBLOCK_RING&lt;/code&gt;)&lt;/strong&gt; padded and aligned to the device's physical sector exponent (&lt;code&gt;ashift&lt;/code&gt;, such as &lt;code&gt;ashift=12&lt;/code&gt; for 4 KiB / 4,096-byte sectors):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;256 KiB OpenZFS Vdev Label (x4 copies per vdev: 2 at head, 2 at tail)
├── 8 KiB    vl_pad1       (EFI / VTOC boot padding)
├── 8 KiB    vl_pad2       (Reserved alignment padding)
├── 112 KiB  vl_vdev_phys  (Pool config nvlist: name, GUID, vdev tree)
└── 128 KiB  vl_uberblock  (VDEV_UBERBLOCK_RING aligned to 2^ashift)
      ├── Slot 0: struct uberblock { ub_magic: 0x00bab10c, ub_txg: 4102, ub_rootbp: ... }
      ├── Slot 1: struct uberblock { ub_magic: 0x00bab10c, ub_txg: 4103, ub_rootbp: ... }
      ├── Slot 2: struct uberblock { ub_magic: 0x00bab10c, ub_txg: 4104, ub_rootbp: ... }  &amp;lt;-- Active
      └── Slot 3: (Next transaction group writes here; never overwrites Slot 2 in place)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of mutating pointers in place—which is how non-Copy-on-Write volumes split down the middle when power cuts halfway through a block write—OpenZFS writes new data blocks and Merkle tree nodes to free space first, then appends a new &lt;code&gt;struct uberblock&lt;/code&gt; carrying the magic header (&lt;code&gt;0x00bab10c&lt;/code&gt;), incremented transaction group (&lt;code&gt;ub_txg&lt;/code&gt;), and root pointer (&lt;code&gt;ub_rootbp&lt;/code&gt;) to the &lt;strong&gt;next slot in the ring&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why &lt;code&gt;ashift&lt;/code&gt; Alignment Protects the Ring&lt;/strong&gt;: When a drive reports 4 KiB physical sectors (&lt;code&gt;ashift=12&lt;/code&gt;), each slot in the 128 KiB &lt;code&gt;VDEV_UBERBLOCK_RING&lt;/code&gt; is aligned to a clean 4 KiB sector boundary. Writing slot &lt;code&gt;N&lt;/code&gt; can never tear or partially corrupt slot &lt;code&gt;N-1&lt;/code&gt; at the physical flash or magnetic sector layer.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If power vanishes mid-flush while writing &lt;code&gt;ub_txg = 4105&lt;/code&gt;, slot &lt;code&gt;4104&lt;/code&gt; remains untouched and cryptographically checksummed from top to bottom. On reboot, &lt;code&gt;zpool import&lt;/code&gt; walks the rings across every member disk, drops any half-written slot that fails validation, and snaps cleanly back to the highest intact transaction group. There are no hidden migration queues to reconcile and no orphaned block maps split across a USB4 bridge.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Boring Topologies Outlast Clever Boxes
&lt;/h2&gt;

&lt;p&gt;Whenever NAND and HDD supply tighten up, marketing teams inevitably reach back for hybrid shortcuts: bolt an M.2 slot onto a spinning drive enclosure, wrap an opaque FPGA around it, add RGB trim, and print 2,500 MB/s on the retail box.&lt;/p&gt;

&lt;p&gt;And in a five-minute benchmark where your entire test file sits snugly inside the 1 TB flash window, the bar chart looks magical.&lt;/p&gt;

&lt;p&gt;Real storage engineering is not measured by best-case benchmark bars. It is measured by &lt;strong&gt;blast radiuses&lt;/strong&gt; and &lt;strong&gt;known failure domains&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Put your OS boot disk on its own quiet, uncontested controller channel so a storage write storm can never freeze your control plane.&lt;/li&gt;
&lt;li&gt;Put your bulk cold files on explicit spinning mirrors or RAID-Z where mechanical platters make economic sense.&lt;/li&gt;
&lt;li&gt;Put your directory metadata and hot databases on explicit, mirrored flash vdevs where you know—down to the chassis bay and serial number—which physical drive holds which piece of your tree.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Storage reliability never comes from hiding two dissimilar disks inside a smarter black box. It comes from boring, transparent topologies that behave predictably at 3:00 AM when a drive finally gives up.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-20-hybrid-drives-datacore-and-storage-failure-domains/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-20-hybrid-drives-datacore-and-storage-failure-domains/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>storage</category>
      <category>hardware</category>
      <category>systems</category>
      <category>homelab</category>
    </item>
    <item>
      <title>Six Access Points Is Too Many (On Default Settings): Planning Seven VLANs Without Losing My Mind</title>
      <dc:creator>Ed Stuurman</dc:creator>
      <pubDate>Wed, 18 Nov 2026 00:13:03 +0000</pubDate>
      <link>https://dev.to/edstuurman/six-access-points-is-too-many-on-default-settings-planning-seven-vlans-without-losing-my-mind-206j</link>
      <guid>https://dev.to/edstuurman/six-access-points-is-too-many-on-default-settings-planning-seven-vlans-without-losing-my-mind-206j</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Blueprint Status (Planned Network Rollout)&lt;/strong&gt;: Like my recent &lt;a href="https://www.stuurman.com/blog/2026-11-09-zero-port-homelab-mail-ses-s3-stalwart/" rel="noopener noreferrer"&gt;mail&lt;/a&gt; and &lt;a href="https://www.stuurman.com/blog/2026-11-09-zero-port-homelab-analytics-umami-lambda-s3/" rel="noopener noreferrer"&gt;analytics&lt;/a&gt; write-ups, this is the &lt;strong&gt;planned VLAN and Wi-Fi design&lt;/strong&gt; for our house as I finish consolidating onto a unified UniFi core and a single Proxmox VE host—written down &lt;em&gt;before&lt;/em&gt; I inevitably lock myself out of a switch port at 11:30 p.m.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Normal homeowners set up Wi-Fi in about four minutes. They plug in whatever beige plastic router the fiber installer handed them, leave the network named &lt;code&gt;isp-router-8842&lt;/code&gt;, tape an eighteen-character password to the side of the fridge, and go on to live happy, well-adjusted lives.&lt;/p&gt;

&lt;p&gt;I, on the other hand, have &lt;strong&gt;six UniFi U6 In-Wall access points&lt;/strong&gt;, a UDM Pro gateway, a Proxmox server, two people working remotely whose respective corporate environments have no business knowing the other exists, a slowly growing collection of smart-home gadgets that want to phone home to mysterious cloud buckets every twelve seconds, and a strong desire to never share a Layer 2 broadcast domain with a robot vacuum.&lt;/p&gt;

&lt;p&gt;Here is how I'm planning the VLANs, switch ports, and radio layout so everything stays fast, isolated, and invisible.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Six Access Points Is Too Many (Until You Turn Half of Them Off)
&lt;/h2&gt;

&lt;p&gt;Admitting you have &lt;strong&gt;six&lt;/strong&gt; access points in a single house sounds completely unhinged until you picture how they're mounted.&lt;/p&gt;

&lt;p&gt;Instead of bolting glowing flying saucers to the middle of every ceiling, our house uses six &lt;strong&gt;UniFi U6 In-Wall (&lt;code&gt;U6-IW&lt;/code&gt;)&lt;/strong&gt; units mounted &lt;strong&gt;high up on the walls&lt;/strong&gt;—blending in like clean white wall plates while clearing every desk, monitor, and sofa in the room.&lt;/p&gt;

&lt;p&gt;Because high-wall mounting gives the antennas unobstructed line-of-sight, the catch is what happens if you plug six of them in and leave the radio settings on &lt;strong&gt;Auto&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In consumer and prosumer Wi-Fi gear, "Auto Transmit Power" is almost universally polite phrasing for &lt;em&gt;"scream at the maximum legal regulatory limit."&lt;/em&gt; Putting six full-power, unobstructed access points inside one home is like putting six tour guides with megaphones in the same living room, it's noisy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Sticky Phone Problem&lt;/strong&gt;: You walk upstairs, your phone still hears the living-room AP faintly through the floor, and it stubbornly clings to that terrible signal like a toddler holding onto a doorframe—while ignoring the fresh access point two meters away.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;2.4 GHz&lt;/code&gt; Traffic Jam&lt;/strong&gt;: The &lt;code&gt;2.4 GHz&lt;/code&gt; band punches straight through walls and only has &lt;strong&gt;three&lt;/strong&gt; non-overlapping channels (&lt;code&gt;1&lt;/code&gt;, &lt;code&gt;6&lt;/code&gt;, and &lt;code&gt;11&lt;/code&gt;). Turn &lt;code&gt;2.4 GHz&lt;/code&gt; on across six APs and you guarantee your own hardware will spend all day arguing with itself.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The planned fix is delightfully counterintuitive:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Turn &lt;code&gt;2.4 GHz&lt;/code&gt; completely OFF on three of the six APs.&lt;/strong&gt; Only three spaced-out units get &lt;code&gt;2.4 GHz&lt;/code&gt; enabled—pinned manually to Channels &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;6&lt;/code&gt;, and &lt;code&gt;11&lt;/code&gt; on Low power. The other three radios take a permanent vacation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dial &lt;code&gt;5 GHz&lt;/code&gt; down to Low power for room-sized micro-cells.&lt;/strong&gt; With clear high-wall line-of-sight, dropping &lt;code&gt;5 GHz&lt;/code&gt; transmit power to Low across all six units gives every room its own clean bubble on a dedicated non-overlapping channel, so phones and laptops roam crisply the moment you walk down the hall.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The Seven-VLAN Floorplan
&lt;/h2&gt;

&lt;p&gt;To keep firewall logs readable at a glance without doing mental subnet math, every VLAN gets a matching third octet (&lt;code&gt;VLAN 20&lt;/code&gt; = &lt;code&gt;10.0.20.0/24&lt;/code&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;VLAN&lt;/th&gt;
&lt;th&gt;Zone&lt;/th&gt;
&lt;th&gt;Subnet&lt;/th&gt;
&lt;th&gt;DNS Server&lt;/th&gt;
&lt;th&gt;Client Isolation&lt;/th&gt;
&lt;th&gt;Who Lives Here&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Mgmt / Infra&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.1.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Local Unbound&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;td&gt;UniFi gateway, switches, the 6 &lt;code&gt;U6-IW&lt;/code&gt;s, UPS, and Proxmox host UI. &lt;strong&gt;Zero Wi-Fi.&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Home&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.10.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Local Unbound&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;td&gt;Personal laptops, phones, wired desktop PCs, Sonos, Apple TV, printer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Homelab&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.20.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Local Unbound&lt;/td&gt;
&lt;td&gt;Off&lt;/td&gt;
&lt;td&gt;Proxmox LXCs &amp;amp; VMs: Caddy (&lt;code&gt;*.home-lab.net&lt;/code&gt;), Immich, Stalwart mail, GitLab, Home Assistant.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;31&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Work 1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.31.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.1.1.1&lt;/code&gt; / &lt;code&gt;9.9.9.9&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Remote worker #1 (quarantined internet-only).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Work 2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.32.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.1.1.1&lt;/code&gt; / &lt;code&gt;9.9.9.9&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Remote worker #2 (quarantined internet-only).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;IoT&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.40.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.1.1.1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Off*&lt;/td&gt;
&lt;td&gt;Smart TV panels, plugs, sensors, robot vacuums, appliances.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;90&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Guest&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;10.0.90.0/24&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.1.1.1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Friends &amp;amp; family visiting—with a welcome portal.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;*Left off on IoT only where local Matter/HomeKit bridges expect peer-to-peer discovery.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Putting Work Laptops in "Coffee-Shop Jail" (&lt;code&gt;VLAN 31&lt;/code&gt; &amp;amp; &lt;code&gt;VLAN 32&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;When two people work remotely from home for different employers, their respective company laptops come pre-installed with corporate endpoint agents whose entire job description is being nosy—passively cataloguing local subnets, gateway MACs, neighbor tables, and DNS replies.&lt;/p&gt;

&lt;p&gt;Putting &lt;code&gt;Work 1&lt;/code&gt; and &lt;code&gt;Work 2&lt;/code&gt; on their own separate, isolated VLANs with &lt;strong&gt;Client Device Isolation&lt;/strong&gt; turned on—and handing them plain public DNS (&lt;code&gt;1.1.1.1&lt;/code&gt;) instead of my local split-horizon &lt;strong&gt;Unbound&lt;/strong&gt; server—gives both machines the exact network experience of sitting in a Starbucks across town from each other:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fast, reliable internet with zero visibility into our personal machines, home servers, or each other's work equipment.&lt;/li&gt;
&lt;li&gt;Typing &lt;code&gt;home-lab.net&lt;/code&gt; on either work laptop resolves innocently to the &lt;strong&gt;public AWS CloudFront static site&lt;/strong&gt;, never leaking internal &lt;code&gt;10.0.20.x&lt;/code&gt; homelab addresses into corporate VPN telemetry.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Shutting Off the Ceiling-Height Ports (Until Camera Day)
&lt;/h3&gt;

&lt;p&gt;Each &lt;code&gt;U6-IW&lt;/code&gt; has a 4-port Ethernet switch built into its bottom edge—including &lt;strong&gt;&lt;code&gt;PoE&lt;/code&gt; passthrough on Port 1&lt;/strong&gt;. When your APs are mounted high up on the wall, you obviously aren't plugging desktop PCs into them unless you want Ethernet cords dangling down the drywall like spiderwebs, &lt;em&gt;but&lt;/em&gt; having PoE-capable switch ports already sitting near ceiling height is a huge ace up the sleeve for future PoE cameras:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Default All 24 Bottom Ports to &lt;code&gt;Disabled&lt;/code&gt; Now, Enable &lt;code&gt;Port 1&lt;/code&gt; Only Where Needed&lt;/strong&gt;: Using a shared &lt;code&gt;Disabled&lt;/code&gt; Ethernet Port Profile in UniFi shuts off Ports 1–4 across all six &lt;code&gt;U6-IW&lt;/code&gt;s today (while regular low-wall jacks get &lt;code&gt;VLAN 10&lt;/code&gt;, &lt;code&gt;31&lt;/code&gt;, or &lt;code&gt;32&lt;/code&gt; directly on the central switch). Whenever a camera goes up near an AP later, flipping &lt;strong&gt;only &lt;code&gt;Port 1&lt;/code&gt;&lt;/strong&gt; back on—powered via upstream &lt;code&gt;PoE+&lt;/code&gt; (&lt;code&gt;802.3at&lt;/code&gt;) and locked to a zero-internet &lt;strong&gt;&lt;code&gt;Cameras&lt;/code&gt; / &lt;code&gt;IoT-No-WAN&lt;/code&gt; VLAN&lt;/strong&gt;—powers and isolates the camera over a short patch run without pulling a single new cable back to the rack.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart TVs in &lt;code&gt;IoT&lt;/code&gt;, Sonos on &lt;code&gt;Home&lt;/code&gt;&lt;/strong&gt;: Smart TV panels (whose built-in OSes love phoning home with ad telemetry) belong on &lt;code&gt;VLAN 40 (IoT)&lt;/code&gt;. &lt;strong&gt;Sonos speakers and Apple TV&lt;/strong&gt;, on the other hand, stay on &lt;strong&gt;&lt;code&gt;VLAN 10 (Home)&lt;/code&gt;&lt;/strong&gt;—because Sonos's legacy &lt;code&gt;SSDP&lt;/code&gt; discovery opens reverse connections on random high ports back to your phone, and life is far too short to spend Saturday night debugging multicast relays when someone just wants to play music in the kitchen. &lt;em&gt;(Meanwhile, Proxmox sits safely walled off on &lt;code&gt;VLAN 20&lt;/code&gt;).&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Dodging "SSID Bloat" While Still Spoiling Guests
&lt;/h2&gt;

&lt;p&gt;When people discover VLANs, the classic mistake is creating &lt;strong&gt;one Wi-Fi network name per VLAN&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The problem is Wi-Fi physics: every distinct SSID on a radio has to broadcast management "beacon" frames roughly ten times a second at the slowest legacy data rates. Broadcast six SSIDs across six access points and a surprising share of your airtime goes to access points clearing their throats to announce their own names—while turning everyone's phone Wi-Fi menu into a discovering Wi-Fi in an airport experience.&lt;/p&gt;

&lt;p&gt;By combining band-splitting with UniFi's &lt;strong&gt;Private Pre-Shared Keys (PPSK)&lt;/strong&gt;—where a single Wi-Fi network name drops devices onto different VLANs depending on which password they type—&lt;strong&gt;no radio ever broadcasts more than three SSIDs&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart LR
  subgraph FiveGHz["5 GHz Radios (All 6 U6-IWs — Low/Med Power)"]
    S1["SSID 1: Home (WPA3)"] --&amp;gt; V10["VLAN 10: Home"]
    S2["SSID 2: Work (WPA2 PPSK)"] --&amp;gt;|Password A| V31["VLAN 31: Work 1"]
    S2 --&amp;gt;|Password B| V32["VLAN 32: Work 2"]
    S3["SSID 3: Guest (Hotspot Portal)"] --&amp;gt; V90["VLAN 90: Guest"]
  end

  subgraph TwoFourGHz["2.4 GHz Radios (Only 3 U6-IWs — Ch 1, 6, 11)"]
    S4["SSID 4: IoT (WPA2, PMF Off)"] --&amp;gt; V40["VLAN 40: IoT"]
  end&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Each SSID has a very specific personality:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Home&lt;/code&gt; (&lt;code&gt;5 GHz&lt;/code&gt; · WPA3)&lt;/strong&gt;: Fast modern Wi-Fi for phones and laptops—and listed as the trusted SSID in my &lt;a href="https://www.alwaysroute.com" rel="noopener noreferrer"&gt;&lt;strong&gt;AlwaysRoute&lt;/strong&gt;&lt;/a&gt; WireGuard On-Demand profile so my phone automatically drops its VPN tunnel the moment I walk through the front door.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Work&lt;/code&gt; (&lt;code&gt;5 GHz&lt;/code&gt; · WPA2 PPSK)&lt;/strong&gt;: One SSID, two passwords, two completely air-gapped VLANs—and no captive portal to confuse always-on corporate VPN clients.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Guest&lt;/code&gt; (&lt;code&gt;5 GHz&lt;/code&gt; · UniFi Hotspot Portal)&lt;/strong&gt;: Since UniFi's gateway includes a built-in captive portal, visitors get a clean dark-mode welcome screen (and a polite per-client speed cap so a cousin's phone backing up 40 GB of vacation videos doesn't torpedo a call).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;IoT&lt;/code&gt; (&lt;code&gt;2.4 GHz&lt;/code&gt; only · WPA2, PMF Off, Fast Roaming Off)&lt;/strong&gt;: Because a smart plug from 2021 has the TCP/IP stack of a Pop-Tart and suffers a nervous breakdown the moment it sees WPA3 or &lt;code&gt;5 GHz&lt;/code&gt; band steering.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Teaching Home Assistant to Talk to Toasters (Safely)
&lt;/h2&gt;

&lt;p&gt;Isolating VLANs is easy; letting &lt;em&gt;just enough&lt;/em&gt; traffic cross the border without turning your firewall rules into spaghetti is the tricky part. Two patterns keep the rule list tiny:&lt;/p&gt;

&lt;h3&gt;
  
  
  One-Way Doors Between &lt;code&gt;Home&lt;/code&gt; and &lt;code&gt;Homelab&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Devices on &lt;strong&gt;&lt;code&gt;VLAN 10 (Home)&lt;/code&gt;&lt;/strong&gt; can initiate connections into &lt;strong&gt;&lt;code&gt;VLAN 20 (Homelab)&lt;/code&gt;&lt;/strong&gt; on &lt;strong&gt;DNS (&lt;code&gt;:53&lt;/code&gt;)&lt;/strong&gt; for local &lt;code&gt;*.home-lab.net&lt;/code&gt; resolution and &lt;strong&gt;HTTPS (&lt;code&gt;:443&lt;/code&gt;)&lt;/strong&gt; for Caddy (which fronts everything behind Authelia passkey login). Return packets flow back via standard &lt;code&gt;Established / Related&lt;/code&gt; state—but &lt;strong&gt;&lt;code&gt;Homelab&lt;/code&gt; cannot initiate new connections into &lt;code&gt;Home&lt;/code&gt;&lt;/strong&gt;. Even if a test container in the lab went sideways, personal laptops and phones sit behind a one-way mirror.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Two-Legged Proxmox Trick for Home Assistant &amp;amp; IoT
&lt;/h3&gt;

&lt;p&gt;Smart-home protocols (HomeKit, Matter, Chromecast, ESPHome) love shouting across Layer 2 multicast (&lt;code&gt;mDNS&lt;/code&gt;) to say &lt;em&gt;"Hello, I am a lightbulb!"&lt;/em&gt;—traffic that routers intentionally refuse to forward across VLANs unless you enable mDNS reflectors that leak noisy broadcasts everywhere.&lt;/p&gt;

&lt;p&gt;Because &lt;strong&gt;Home Assistant&lt;/strong&gt; will run as a VM on Proxmox's VLAN-aware bridge (&lt;code&gt;vmbr0&lt;/code&gt;), there is a much cleaner shortcut than fighting multicast routing: &lt;strong&gt;give the Home Assistant VM two virtual network cards&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;net0&lt;/code&gt; on &lt;code&gt;VLAN 20 (Homelab)&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(with the default gateway)&lt;/em&gt;: Serves the web UI cleanly behind Caddy and Authelia.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;net1&lt;/code&gt; on &lt;code&gt;VLAN 40 (IoT)&lt;/code&gt;&lt;/strong&gt; &lt;em&gt;(no gateway)&lt;/em&gt;: Sits directly on the IoT wire at Layer 2 so Home Assistant hears every bulb, plug, and sensor natively—while those IoT devices still have &lt;strong&gt;zero routed path&lt;/strong&gt; into &lt;code&gt;Homelab&lt;/code&gt; or &lt;code&gt;Home&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Pair that with an &lt;strong&gt;&lt;code&gt;IoT-No-WAN&lt;/code&gt;&lt;/strong&gt; firewall group that blocks internet access for chatty local sensors and cameras once they're paired, and the toaster stays strictly in the kitchen where it belongs.&lt;/p&gt;

&lt;p&gt;One honest caveat: the two-legged VM makes &lt;strong&gt;Home Assistant itself&lt;/strong&gt; the only bridge between the IoT wire and the lab. That's the point—but it also means Home Assistant gets patched promptly and doesn't run anything it doesn't need.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. Rollout Gameplan
&lt;/h2&gt;

&lt;p&gt;Changing VLANs on a live house network while people are using the internet is an extreme sport, so the rollout order matters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;Step 1 — Carve Out VLANs &amp;amp; Trunk Proxmox First&lt;/strong&gt;: Enable VLAN-awareness on Proxmox &lt;code&gt;vmbr0&lt;/code&gt; and verify management reachability on &lt;code&gt;VLAN 1&lt;/code&gt; with a fallback switch port hardcoded to &lt;code&gt;VLAN 10&lt;/code&gt; (the anti-lockout safety rope).&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Step 2 — Bring Up &lt;code&gt;Work&lt;/code&gt; (PPSK) &amp;amp; &lt;code&gt;Guest&lt;/code&gt; (Hotspot)&lt;/strong&gt;: Test corporate VPN behavior on &lt;code&gt;VLAN 31&lt;/code&gt; / &lt;code&gt;VLAN 32&lt;/code&gt; and style the Guest welcome portal.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Step 3 — Tune the Six &lt;code&gt;U6-IW&lt;/code&gt; Radios&lt;/strong&gt;: Disable &lt;code&gt;2.4 GHz&lt;/code&gt; on three units, pin &lt;code&gt;Ch 1 / 6 / 11&lt;/code&gt; on the remaining three, and step &lt;code&gt;5 GHz&lt;/code&gt; power down per room while walking the house with WiFiman.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Step 4 — Lock the Firewall Zones Last&lt;/strong&gt;: Flip the default inter-VLAN drop rules from &lt;em&gt;Log&lt;/em&gt; to &lt;em&gt;Drop&lt;/em&gt; only after confirming AirDrop, printing, Caddy HTTPS, and WireGuard On-Demand handoffs all behave cleanly.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://www.stuurman.com/blog/2026-11-11-six-access-points-seven-vlans-unifi-home-network-plan/" rel="noopener noreferrer"&gt;www.stuurman.com/blog/2026-11-11-six-access-points-seven-vlans-unifi-home-network-plan/&lt;/a&gt; by Ed Stuurman.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>networking</category>
      <category>security</category>
      <category>hardware</category>
    </item>
  </channel>
</rss>
