Building a serverless AI agent platform on AWS for $0.01/month with Claude Code

Project Overview
Serverless OpenClaw is a full-stack serverless AI agent platform built entirely through conversational prompts to Claude Code over 29 hours across 5 weeks. The platform runs the OpenClaw AI agent on-demand on AWS with a React web chat UI and Telegram bot, deploying the entire infrastructure with a single cdk deploy command.
Technical Details
Cost Optimization: The project reduced monthly costs from a typical ~$70+ serverless setup down to $0.01/month on Lambda with zero idle costs. Specific eliminations include:
- NAT Gateway: -$32/month
- ALB (Application Load Balancer): -$18/month
- Fargate always-on: -$15/month
- Interface VPC Endpoints: -$7/month each
- Provisioned DynamoDB: Variable savings
Performance Metrics:
- Cold start: 1.35s (Lambda), 0.12s warm
- Total AWS cost during development: ~$0.25
- Monthly running cost: ~$0.01 (Lambda)
Code Quality:
- Unit tests: 233
- E2E tests: 35
- CDK stacks: 8
- TypeScript packages: 6 (monorepo)
Development Process
The entire project was built without manual coding—just prompts, reviews, and course corrections. Claude Code was used for:
- Architecture design: "Design a serverless platform that costs under $1/month" → Claude Code produced the PRD, CDK stacks, network design
- TDD workflow: Claude Code wrote tests first, then implementation (233 tests before a single deploy)
- Debugging sessions: Docker build failures, cold start optimization (68s → 1.35s), WebSocket auth issues
- Phase 2 migration: Moved from Fargate to Lambda Container Image mid-project, including S3 session persistence and smart routing
The prompts were originally in Korean, and Claude Code handled bilingual development seamlessly.
Tech Stack
TypeScript monorepo (6 packages) on AWS using: CDK for IaC, API Gateway (WebSocket + REST), Lambda + Fargate Spot for compute, DynamoDB, S3, Cognito auth, CloudFront + React SPA, Telegram Bot API. Multi-LLM support via Anthropic API and Amazon Bedrock.
Practical Patterns
API Gateway instead of ALB: Saves $18+/month. WebSocket + REST on API Gateway with Lambda handlers.
Tutorial Structure
The 7-chapter "vibe coding" tutorial documents every prompt, failure, and fix:
- Chapter 1: The $1/Month Challenge (~2h) - PRD, architecture design, cost analysis
- Chapter 2: MVP in a Weekend (~8h) - 10-step Phase 1, CDK stacks, TDD
- Chapter 3: Deployment Reality Check (~4h) - Docker, secrets, auth, first real deploy
- Chapter 4: The Cold Start Battle (~6h) - Docker optimization, CPU tuning, pre-warming
- Chapter 5: Lambda Migration (~4h) - Phase 2, embedded agent, S3 sessions
- Chapter 6: Smart Routing (~3h) - Lambda/Fargate hybrid, cold start preview
- Chapter 7: Release Automation (~2h) - Skills, parallel review, GitHub releases
Each chapter includes: the actual prompt given → what Claude Code did → what broke → how we fixed it → lessons learned → reproducible commands.
📖 Read the full source: r/ClaudeAI
👀 See Also

Practical AI Coding Strategies from 1000 Hours of Experience
A Reddit post outlines specific prompting levels and workflow strategies for using AI coding agents effectively, including treating AI as a junior developer, phased implementation, and using instruction files.

Cron Jobs vs Heartbeat: Optimizing OpenClaw Token Usage and Execution Consistency
A senior developer shares practical tips on using Cron jobs instead of Heartbeat to reduce token usage and improve execution consistency in OpenClaw, with concrete examples and a shell script method.
Grok Bot's Hidden Lock-In: No Memory Export, 20-Run History Ceiling, Shared Cloud Machine
Building real workflows on Grok Bot? xAI's own docs reveal hard limits: no memory export, 20-run routine history, shared cloud computer. Leaving means rebuilding from zero.

Five Common OpenClaw Configuration Issues That Inflate API Costs
A Reddit post identifies five configuration problems in OpenClaw setups that lead to excessive API credit consumption, including using expensive models for routine tasks, missing budget limits, open gateways, unmanaged memory, and unaudited skills.