All posts

Moving Lunch Train off AWS onto Cloudflare

Why we left AWS Free Tier and Google AI Studio for Cloudflare Workers, R2, D1, Workers AI, and AI Gateway.

Lindholmen Lunch Train shows daily lunch menus around Lindholmen. Scrapers + AI turn restaurant sites into JSON; the SPA and MCP read it.

Why we moved

  • AWS Free Tier ended. Monthly cost jumped almost 100%. Still under $10, but enough to notice.
  • Google AI Studio (free tier) was unreliable. Model flakiness caused multiple scrapes / matching incidents.
  • Cloudflare already covers a full-stack app: Workers, Static Assets, R2, D1, cron, Email Sending, Workers AI, AI Gateway.

Before vs after

Before

Before

Clients

  • Browser SPA on EC2
  • AI assistants MCP

AWS

  • EC2 + nginx SPA
  • S3 Menu JSON
  • Docker Lambdas Scraper · notifier · API
  • API Gateway + DynamoDB Subscriptions
  • SES Email
  • EventBridge Schedules

Google

  • AI Studio / Gemini Free tier · unreliable

Main flows

  • Menus
    LambdaGeminiS3SPA
  • Notifier
    S3GeminiSES
Figure 1. AWS stack plus Google AI Studio for menu structuring and matching.

After

After

Clients

  • Browser lunchtrain.se
  • AI assistants /mcp*

Cloudflare

  • Workers Assets SPA
  • R2 Menus · no egress fees
  • Workers + cron Scraper · API · notifier
  • D1 Subscriptions
  • Email Sending Notifications
  • Workers AI Via AI Gateway
  • AI Gateway Retries · usage insight
  • MCP Worker Assistants

Main flows

  • Menus
    WorkerAI GatewayWorkers AIR2SPA
  • Notifier
    R2 + D1AI GatewayEmail Sending
  • MCP
    AssistantsMCP WorkerR2
Figure 2. Cloudflare Developer Platform: Workers, R2, D1, Email Sending, Workers AI via AI Gateway.

Workers AI + AI Gateway

  • Scrapers and the notifier call models through AI Gateway into Workers AI (no Gemini keys in Lambdas).
  • Gateway gives retries, routing, and usage visibility we did not have with AI Studio alone.

What we gained

  • One platform: SPA, APIs, menus, scrapers, mail, AI.
  • Simpler architecture: fewer services, one deploy story.
  • AI usage insight: AI Gateway metrics and traces.
  • Region Earth: Workers run at the edge by default.
  • No R2 egress fees: menu JSON stays cheap to serve.