<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Prefetch on Build on AWS</title><link>https://buildonaws.lakil.org/tags/prefetch/</link><description>Recent content in Prefetch on Build on AWS</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 12 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://buildonaws.lakil.org/tags/prefetch/index.xml" rel="self" type="application/rss+xml"/><item><title>Building Data-Driven Speculation Rules with CloudWatch RUM, CloudFront Functions, and KVS</title><link>https://buildonaws.lakil.org/posts/data-driven-speculation-rules/</link><pubDate>Fri, 12 Jun 2026 00:00:00 +0000</pubDate><guid>https://buildonaws.lakil.org/posts/data-driven-speculation-rules/</guid><description>&lt;h1 id="building-data-driven-speculation-rules-with-cloudwatch-rum-cloudfront-functions-and-kvs"&gt;Building Data-Driven Speculation Rules with CloudWatch RUM, CloudFront Functions, and KVS&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Speculation Rules API lets browsers prefetch or prerender pages users are likely to visit next. The challenge is predicting &lt;em&gt;which&lt;/em&gt; pages. This post builds an automated pipeline: CloudWatch RUM collects real user navigation patterns, a daily Lambda job computes per-page top destinations and writes them to CloudFront KeyValueStore, and a CloudFront Function (viewer-response) injects a &lt;code&gt;Speculation-Rules&lt;/code&gt; response header dynamically. Pages without data get a safe default (pointer-down prefetch). The result: near-instant page transitions powered by real user behavior data, zero application code changes required. Full Terraform code included.&lt;/p&gt;</description></item></channel></rss>