惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
Recent Announcements
Recent Announcements
雷峰网
雷峰网
Last Week in AI
Last Week in AI
I
InfoQ
Google DeepMind News
Google DeepMind News
GbyAI
GbyAI
The Cloudflare Blog
aimingoo的专栏
aimingoo的专栏
量子位
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Blog — PlanetScale
Blog — PlanetScale
F
Full Disclosure
D
DataBreaches.Net
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
MyScale Blog
MyScale Blog
美团技术团队
V
V2EX
Jina AI
Jina AI
T
The Blog of Author Tim Ferriss
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
腾讯CDC
Vercel News
Vercel News
A
About on SuperTechFans
J
Java Code Geeks
Martin Fowler
Martin Fowler
V
Visual Studio Blog
博客园_首页
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
U
Unit 42
Engineering at Meta
Engineering at Meta
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I Built a Serverless VPN on Lambda MicroVMs — 12 Builds, 5 Dead Ends, 1 Working Architecture
Vivek V. · 2026-06-27 · via DEV Community

TL;DR

I built a personal VPN using AWS Lambda MicroVMs. Your traffic exits from AWS. When you disconnect, the MicroVM terminates — zero cost, nothing running. When you reconnect, a fresh MicroVM launches in about 20 seconds.

./vpn.sh start   # All Mac traffic now exits from AWS
./vpn.sh stop    # Back to your real IP

Here is what I learned across 12 image builds — dead ends, kernel limitations, and what finally worked.


The Idea

Lambda MicroVMs launched in June 2026 (4 days ago). They are Firecracker VMs with:

  • Full Linux OS — your own binaries, eBPF, iptables, network namespaces
  • Suspend/resume — state preserved on snapshot, resumes in ~1s per GB (or terminate for zero ongoing cost)
  • Hardware-level isolation — every session gets its own sandbox
  • Per-second billing — ~$0.13/hr for a 2GB ARM64 (Graviton) instance
  • 8-hour max lifetime (active + suspended combined)

I wanted to run a VPN inside one. Connect when I need privacy. Disconnect and pay nothing for compute. Resume instantly when I reconnect.

Took 12 image builds to get there.


What I Tried (and Failed)

Attempt 1: NAT Gateway Replacement (The Original Idea)

This is actually where the project started. I was paying $32/mo for a NAT Gateway and thought: what if a MicroVM running nftables could replace it? Serverless NAT. Pay only when traffic flows.

Why it failed: Lambda MicroVMs cannot act as VPC route targets. Their networking is ingress-only (HTTPS + JWT). Other VPC resources cannot route through a MicroVM. The VPC egress connector gives the MicroVM its own internet access. It does not make it a transit device.

That killed the NAT idea. But it made me think — if I cannot route VPC traffic through it, what about routing my own laptop's traffic through it? That is how Serverless VPN was born.

Attempt 2: VPC Egress Connector

I created a VPC, subnets, security groups, and a network connector. One hour wasted.

MicroVMs have INTERNET_EGRESS by default. The connector is only needed for reaching private VPC resources (RDS, internal NLBs). For a VPN that exits to the public internet, default egress works fine.

Attempt 3: Kernel WireGuard

$ ip link add wg0 type wireguard
Error: Unknown device type.

The MicroVM kernel does not have wireguard.ko. Setting additionalOsCapabilities: ["ALL"] does not help. "ALL capabilities" means Linux capabilities (CAP_NET_ADMIN, etc.). Not kernel modules. The Firecracker kernel is compiled by AWS. You cannot load modules.

Attempt 4: Boringtun (Userspace WireGuard)

Failed to initialize tunnel
error: Socket(Os { code: 19, kind: Uncategorized, message: "No such device" })

Even after mknod /dev/net/tun c 10 200, the kernel has no TUN driver. CONFIG_TUN is not compiled in. The device node exists in the filesystem, but nothing in the kernel backs it.

eBPF works because CONFIG_BPF=y is in the kernel. TUN is not. This is a kernel config choice, not a permissions issue.

Attempt 5: Boringtun Daemonize

BoringTun failed to start

Boringtun forks by default. The Firecracker environment blocks fork() in daemon mode. Fix: --foreground flag. But TUN still does not work, so this was moot.

Always use --foreground for any daemon process in MicroVMs.


What Actually Works

veth + SOCKS5 Proxy

Credit to Aidan Steele (AWS Serverless Hero) who pointed me towards veth pairs. He had already built a Kubernetes cluster across MicroVMs — multiple pods per MicroVM, all using veth + network namespaces. No TUN needed.

The kernel supports veth pairs, network namespaces, iptables, and IP forwarding. Just not TUN.

Final architecture:

Mac → wstunnel (WSS) → MicroVM:8080 → microsocks (SOCKS5) → internet (AWS IP)

No TUN. No WireGuard kernel module. No VPC. Just:

  • wstunnel — WebSocket tunnel. Wraps TCP in WSS for MicroVM ingress.
  • microsocks — 20KB SOCKS5 proxy. Routes traffic to the internet.
  • iptables MASQUERADE — NATs traffic out the MicroVM's eth0.
  • macOS networksetup — Sets system-wide SOCKS proxy.

The 12-Build Journey

Build What Changed Result
v1 Kernel WireGuard ❌ Unknown device type
v2–v4 Fixed S3 access, IAM propagation ❌ Access denied → fixed
v5 Added additionalOsCapabilities: ALL ✅ ip_forward works
v6 Added boringtun (pre-built binary) ❌ Binary was HTML 404 page
v7 Multi-stage Docker build ❌ Multi-stage FROM not supported
v8 Single-stage Rust compile ✅ Built, but ENODEV on TUN
v9 ALL caps + microvmHooks enabled ✅ /run hook fires
v10 mknod /dev/net/tun + boringtun --foreground ❌ ENODEV (no CONFIG_TUN)
v11 Better error logging Confirmed: no TUN driver
v12 Filed AWS support ticket Waiting on CONFIG_TUN
v13 veth + microsocks + wstunnel Working

Gotchas

1. update-microvm-image Strips Settings

additionalOsCapabilities and hooks are lost when you call update-microvm-image. Always create a fresh image with a new name.

2. API Version Prefixes

  • Lambda MicroVMs: /2025-09-09/ (service: lambda)
  • Network Connectors: /2026-04-04/ (service: lambda-core)
  • Both use the same host: lambda.us-east-1.amazonaws.com

3. boto3 Does Not Have the Service Model

Lambda Python 3.12 runtime ships boto3 that does not know lambda-microvms. Use SigV4-signed raw HTTP or update the CLI.

4. Do Not Setup Networking in /ready Hook

/ready runs during image build. Networking capabilities may not be fully available. Only do filesystem ops. Real networking goes in /run hook.

5. ALL Capabilities ≠ Kernel Modules

additionalOsCapabilities: ["ALL"] grants Linux capabilities. It does NOT:

  • Load kernel modules
  • Enable CONFIG_TUN or CONFIG_WIREGUARD

It DOES enable: sysctl, iptables, ip link (veth/bridge), eBPF, network namespaces.

6. Hooks Must Be Set at Image Creation

--hooks '{"microvmHooks":{"run":"ENABLED","runTimeoutInSeconds":60}}'

If you forget this, /run never fires and your VPN never starts.

7. wstunnel Version Compatibility

Server v10.1.0 and client v10.5.5 may crash. Match versions exactly.

8. 8-Hour Max Lifetime

MicroVM terminates after 8 hours (active + suspended combined). Run ./vpn.sh start again when it expires.

9. Token Expiry (60 min max)

Auth tokens expire. The WebSocket connection persists after initial auth, but reconnection needs a fresh token.


The Final Stack

./vpn.sh start
    ↓
aws lambda-microvms run-microvm (image: serverless-vpn-v13)
    ↓
MicroVM launches from snapshot (~20s)
    ↓
/run hook fires:
  - Creates veth pair + network namespace
  - Enables ip_forward
  - iptables MASQUERADE
  - Starts microsocks (SOCKS5 on :1080)
  - Starts wstunnel server (WSS on :8080)
    ↓
wstunnel client on Mac connects via WSS
    ↓
networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 1081
    ↓
ALL TCP TRAFFIC → SOCKS5 → WSS → MicroVM → AWS IP


Cost

State Cost
Connected (browsing) ~$0.13/hr (2GB ARM64 MicroVM)
Disconnected (terminated) $0 — nothing running, no storage
Each session start ~20s cold start from snapshot
Data transfer out $0.09/GB (standard AWS egress)
Typical month (2hr/day) ~$8 AWS costs + $5 software
Light usage (1hr/day) ~$5 AWS costs + $5 software

The MicroVM can burst up to 4x baseline (8GB/4vCPU) during peak usage at peak rates.


How to Deploy

Option 1: Subscribe on AWS Marketplace (10 minutes)

The full stack is available on AWS Marketplace with a 7-day free trial. One-click CloudFormation deploy, no servers to manage.

Serverless VPN on AWS Marketplace

Option 2: Build It Yourself (under 1 hour)

This blog documents every gotcha I hit. Point Kiro or any AI coding agent at this post plus the Lambda MicroVM Skill and it will scaffold the stack. The gotchas above are what take weeks to discover on your own.

You need:

  • AWS CLI v2.27+ (brew upgrade awscli — required for lambda-microvms commands)
  • wstunnel (brew install wstunnel)
  • AWS account with Lambda MicroVM access (us-east-1, us-east-2, us-west-2, eu-west-1, ap-northeast-1)

Multi-Region

# Run setup once per region (builds the MicroVM image there)
REGION=ap-northeast-1 ./vpn.sh setup  # One-time per region
REGION=ap-northeast-1 ./vpn.sh start  # Tokyo

REGION=eu-west-1 ./vpn.sh setup
REGION=eu-west-1 ./vpn.sh start       # Ireland

Your IP appears from that country. Each region requires a one-time setup (image build is regional). Available in us-east-1, us-east-2, us-west-2, eu-west-1, and ap-northeast-1.


Good to Know

  • Session VPN, not 24/7 — designed for work sessions, not always-on. Use for privacy during active browsing.
  • SOCKS5 proxy — routes TCP traffic (web, APIs). Does not tunnel UDP or raw IP (gaming, VoIP) like a full WireGuard VPN.
  • Runs on Graviton (ARM64) — Amazon Linux 2023 base.
  • macOS and Linux — Windows supported via WSL2.
  • Your own instance — dedicated MicroVM in your AWS account. No shared servers. No traffic logging.
  • CloudTrail auditable — all operations logged in your account.

What's Next

  1. CONFIG_TUN support — I have filed an AWS support ticket requesting TUN/TAP in the Firecracker guest kernel. If AWS adds it, microsocks gets swapped for WireGuard (proper full-tunnel VPN with UDP support).
  2. UDP tunneling — currently SOCKS5 handles TCP only. WireGuard would fix this.
  3. Auto-token refresh — re-auth before 60-min expiry for long sessions.

Reference