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

Slash Claude costs 60x by offloading mechanical tasks to DeepSeek V4 Flash via MCP
A Reddit user cut Claude API spend 60x by routing file classification, JSON reformatting, and field extraction to DeepSeek V4 Flash via a simple MCP tool and a CLAUDE.md deny-list rule.

Running OpenClaw Locally with Ollama to Avoid API Costs
A Reddit user shares their experience switching from API-based OpenClaw to running it locally with Ollama, eliminating API costs while maintaining workflows. They created a step-by-step installation video guide.

Designing Constraints for Production-Grade AI Agent Reliability
A Reddit post details a constraint-based approach to using Claude for complex codebase operations, emphasizing explicit failure mode enumeration, phased execution with checkpoints, and anti-shortcut rules to achieve zero broken builds when removing 140 files.
