PaaS Free Tier
Alternative VPS — deploy via git push, ga perlu manage server.
PaaS (Platform-as-a-Service) cocok kalo lo ga mau urus systemd, nginx, dll. Kasih repo, mereka handle deployment.
Pros vs Cons PaaS
Pros : - Deploy via git push - Auto-scaling - Built-in monitoring & logs - HTTPS otomatis - No server management
Cons : - Resource lebih kebatas vs VPS - Vendor lock-in (perlu deploy ulang kalo pindah) - Cold starts (kalo idle) - Background workers biasanya bayar
Provider yang masih punya free tier
Railway
- $5 credit/bulan (cukup buat ~hobby bot trigger-based)
- 1 GB RAM, 1 GB disk
- Deploy via GitHub repo
Buat AI agent dengan tool execution : - Bisa, tapi ga continuous (credit habis dalam ~15 jam runtime/bulan) - Cocok buat bot scheduled (cron-based)
Render
- 1 web service free
- 512 MB RAM
- Spin down setelah 15 menit idle = ga cocok buat bot
Buat AI agent : ❌ jangan, karena spin down.
Fly.io
- 3 VM gratis (256 MB each)
- Persistent volume 3 GB
- 160 GB bandwidth
Buat AI agent : - Bisa kalo agent ringan - Pakai Dockerfile, deploy via flyctl deploy
Koyeb
- 1 nano instance gratis
- 256 MB RAM
- Tidak spin down
Buat AI agent : - Cocok buat bot kecil yang continuous - Pakai Docker / Buildpack
Replit
- Free tier dengan "Always-On" cuma bayar
- Tanpa Always-On: spin down
Buat AI agent : - Free tier ga cocok (spin down) - Replit Hosting paid $7/bulan worth it kalo lo udah comfortable di Replit IDE
Vercel
- Hobby tier free (untuk frontend)
- Serverless functions (1M invocations/month free)
- Bot continuous : ❌ serverless, max execution 10 detik per request
Buat AI agent : - Cuma cocok buat webhook handler yang fast - Ga cocok buat agentic loop yang multi-step
Cloudflare Workers
- 100K req/day free
- 10ms CPU per req
- KV storage 100K read/day
Buat AI agent : - Cuma cocok buat webhook router super ringan - Ga cocok buat heavy logic
Deploy pattern PaaS
Pattern 1: Dockerfile
Dockerfile:
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "main.py"]
requirements.txt:
python-telegram-bot==21.0
openai
python-dotenv
Deploy ke Fly.io:
flyctl auth login
flyctl launch # interactive setup
flyctl deploy
Pattern 2: Procfile (Railway/Koyeb)
Procfile:
worker: python main.py
Auto-detected oleh platform.
Pattern 3: GitHub-based deploy
- Push repo ke GitHub
- Sign up Render/Railway
- Connect GitHub
- Pilih repo
- Auto-deploy on push
Environment variable di PaaS
PaaS kasih dashboard buat set env var:
TELEGRAM_BOT_TOKEN=...
OPENAI_API_KEY=...
JANGAN commit .env ke repo. Tambah di .gitignore:
.env
credentials/
data/
Storage di PaaS
PaaS biasanya ephemeral filesystem — file yang lo bikin saat runtime ga persist setelah restart.
Solusi:
Option A: Persistent volume (kalo tersedia)
Fly.io: flyctl volumes create data --size 1
# fly.toml
[mounts]
source = "data"
destination = "/data"
Option B: Eksternal database
Pake managed DB:
- Supabase (Postgres, 500MB free)
- Neon (Postgres, 0.5GB free)
- PlanetScale (MySQL, 5GB free)
- MongoDB Atlas (512MB free)
- Firebase Firestore (1GB free)
Adapt agent storage:
# Memory di Postgres
import psycopg2
conn = psycopg2.connect(os.environ["DATABASE_URL"])
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS memory (id SERIAL, note TEXT, ts TIMESTAMP DEFAULT NOW())")
cur.execute("INSERT INTO memory (note) VALUES (%s)", (note_text,))
conn.commit()
Option C: S3 / R2 untuk file
import boto3
s3 = boto3.client('s3', endpoint_url=os.environ['S3_ENDPOINT'])
s3.put_object(Bucket='agent-data', Key='memory.json', Body=json.dumps(memory))
Cloudflare R2 free 10GB storage + 10M read/month = sangat cukup.
Latency considerations
| Source | Target | Latency |
|---|---|---|
| Indonesia | Singapore (Oracle) | 30-60ms |
| Indonesia | AWS us-east-1 | 250ms |
| Indonesia | GCP us-west1 | 200ms |
| Indonesia | Fly.io sin (Singapore) | 30-60ms |
| Indonesia | Render Frankfurt | 350ms |
Telegram bot latency tolerant (user OK kalo respon 2-5 detik), tapi kalo lo bikin web UI, pilih region terdekat.
Cost projection
Skenario: AI agent jalan 24/7 setelah free tier habis.
| Provider | Setup | Cost/bulan |
|---|---|---|
| Oracle Cloud | A1.Flex 4 OCPU 24GB | $0 forever (kalo ga di-suspend) |
| AWS | t3.micro after free tier | ~$10 |
| GCP | e2-micro after... still free | $0 forever (kalo policy ga ganti) |
| Hetzner | CX11 (paid) | $4.30 |
| Fly.io | Free + paid volume | $2-5 |
| Railway | Hobby plan | $5 |
| Render | Standard (always-on) | $7 |
| Koyeb | Standard | $5 |
| DigitalOcean | $4/mo droplet | $4-6 |
Trade-off PaaS vs VPS untuk agent
| Aspek | VPS (Oracle/AWS) | PaaS (Fly.io/Railway) |
|---|---|---|
| Setup time | 2-3 jam | 15-30 menit |
| Resource | Lebih besar | Lebih kecil |
| Cost long-term | Bisa $0 (Oracle) | Hampir selalu bayar |
| Maintenance | Manual (apt update, dll) | Otomatis |
| Storage | Persistent | Ephemeral (kecuali volume) |
| systemd / nginx | Setup manual | Built-in / abstracted |
| SSH access | Ya | Biasanya tidak (cuma logs) |
| Multi-platform | Bisa (banyak bot di 1 VPS) | Sulit (1 deploy per app) |
Saran :
- Start dengan VPS gratis (Oracle/AWS) kalo lo comfortable dengan terminal
- PaaS cocok kalo lo ga mau ribet, atau bot lo simple
Hybrid setup
Yang sering gua rekomen:
- Bot agent : VPS (Oracle/AWS) — long-running, full control
- Web dashboard agent : Vercel — frontend statis + serverless API
- Database : Supabase / Neon — managed Postgres, free tier
- Storage : Cloudflare R2 — backup, file attachment
Cost total: $0/bulan untuk small scale.
Migration path
Kalo lo udah pake free tier dan butuh upgrade:
Oracle (free) → Oracle paid VM → AWS / GCP production
Atau:
PaaS (free) → PaaS paid → VPS (kalo butuh control)
Plan migration dari awal — pakai env var, jangan hardcode IP, simpan state external. Migration jadi gampang.