Hermes Wiki
LocalzDocs/Service-Based-Cost-Analysis

Service Based Cost Analysis

Assumptions: Phase 2 (Kubernetes in production), DEV (1) + UAT (1) + PROD (2) clusters, ~500 sellers / 10k buyers / 50k listings, moderate traffic, no OpenAI / Claude usage yet, self-host everything possible inside Kubernetes, managed only where operationally dangerous to self-host (DBs, Kafka). AWS first.


High-level truth

At this scale, your cost is dominated by:

  1. Kubernetes worker nodes
  2. PostgreSQL + replicas
  3. Kafka
  4. Elasticsearch/OpenSearch
  5. Network + storage

Everything else (Clerk, SendGrid, Sentry) is noise — rounding errors compared to infra.


Core Infrastructure (AWS example)

1. EKS Clusters (DEV + UAT + PROD×2)

DEV: 2 × t3.medium nodes ($70/mo) UAT: 2 × t3.medium nodes ($70/mo) PROD: 4 × t3.large nodes (~$400/mo) EKS control planes: ~$150/mo

Kubernetes subtotal: ~$700/month

2. PostgreSQL (primary + read replica)

Using RDS-style managed Postgres (db.m6g.large primary + db.m6g.large read replica, ~200GB storage)

~$350–450/month

3. MongoDB (managed or Atlas)

Replica set (3 nodes small-medium):

~$250–350/month

4. Kafka (MSK / managed Kafka)

Small production cluster: 3 brokers, moderate retention, heavy transactional events

~$400–600/month (Kafka is expensive. Always.)

5. Elasticsearch / OpenSearch (logs + analytics)

Small cluster: 3 data nodes, 100–200GB indexed logs/month

~$250–400/month

6. Object Storage

50k listings + images + backups (~300–500GB S3, lifecycle → Glacier for old data)

~$30–60/month (Very cheap.)

7. Container Registry + Artifacts

ECR + JFrog Artifactory

~$40–80/month

8. Network + Load Balancers + CDN

Ingress + egress + ALBs + CloudFront

~$100–200/month


SaaS Tools (all tiny compared to infra)

  • Clerk: ~$25–50/mo
  • Sentry: ~$25/mo
  • SendGrid: ~$15–30/mo
  • Twilio: ~$20–50/mo (usage based)
  • Firebase (FCM): free

Security / DevSecOps

Early-stage recommendation (use instead of enterprise tools):

  • GitHub Advanced Security
  • Trivy
  • OWASP ZAP

Almost free. Add Aqua/SonarQube managed later (~$150–400/mo when needed).


TOTAL Monthly Cost (realistic)

EKS + nodes                 $700
Postgres                    $400
MongoDB                     $300
Kafka                       $500
Elasticsearch               $300
Object storage               $50
Registry/artifacts           $60
Networking                  $150
SaaS (Clerk/Sentry/etc)     $100
Security tooling            $150
--------------------------------
TOTAL ≈                   $2,700 / month

Annual Run Rate

~$32,000–36,000 USD/year

This is extremely reasonable for: 4 environments, Kubernetes, Kafka, Postgres replicas, Mongo replicas, full observability.


Founder reality check

At this scale:

  • infra: ~75%
  • SaaS tools: ~10%
  • "nice to have security": ~15%

CFO Advice: Your revenue target must be monthly infra × 3.

If infra = $2.7k → Target MRR = $8k+

That's: 500 sellers × $20/month = $10k. Very achievable.


Final Founder Summary

  • ~$3k/month to run Localz professionally
  • ~$35k/year infra burn
  • Break-even at ~400–500 sellers paying ~$20/mo

This is a very healthy indie SaaS profile.


Are 200GB PostgreSQL and 100-200GB Elasticsearch enough?

Short answer: your intuition is correct — logs will fill up fast; Postgres will not (if designed properly).

PostgreSQL — 200 GB is MORE than enough (for 12–24 months)

Postgres should store only business-critical, normalized data:

Entity Count Avg row size Storage
Users (buyers+sellers) 10,500 1–2 KB ~20 MB
Listings 50,000 2–3 KB ~150 MB
Orders / bookings (1 yr) ~500k 2–3 KB ~1.5 GB
Payments / invoices ~500k 2–3 KB ~1.5 GB
Reviews ~200k 1 KB ~200 MB
Indexes ~1× data ~3–4 GB
TOTAL (1 year) <10 GB

Even with 3–5 years of data, heavy indexing, replicas, and migrations:

  • 50–80 GB actual data
  • 200 GB gives massive headroom

You will hit CPU / IOPS limits long before storage.

Elasticsearch / OpenSearch — 100–200 GB will fill in weeks, not months

Very realistic math:

50 pods × 10 MB/day = 500 MB/day
= ~15 GB/month (DEV alone)

Now multiply:
DEV + UAT + PROD×2 ≈ 4×
= ~60 GB/month

And this is BEFORE: HTTP access logs, Ingress logs, Kafka consumer logs, Search logs, Auth logs, Payment logs.

100–200 GB = 1–3 months max (if traffic spikes → days).

What strong teams actually do

A. Split logs by tier:

  1. Hot logs (Elasticsearch) — Retention: 7–14 days. Purpose: debugging, incidents.
  2. Warm logs (S3) — Retention: 90–180 days. Format: JSON / Parquet. Query via Athena when needed.
  3. Cold logs (Glacier) — Retention: 1–7 years. Compliance only. Almost free.

Never keep long-term logs in Elasticsearch. Ever.

B. Mandatory ILM (Index Lifecycle Management)

HOT   → 7 days (SSD)
WARM  → 14 days (cheap EBS)
DELETE → after 21–30 days

This alone saves 60–70% cost.

C. Reduce log volume

  1. Default log level = INFO
  2. ERROR only in PROD for stable services
  3. Sample noisy logs (e.g. search queries)
  4. No request/response body logging by default

This can cut log size by 3–5×.

Store Recommended Alert at
PostgreSQL 100–200 GB 70%
Elasticsearch 300–500 GB (with ILM + S3 offload)
Object Storage (S3) Grows fast, but cheap. Expect 1–3 TB/year

Founder-grade rule of thumb

Databases are for truth. Search engines are for speed. Object storage is for history.

If you mix them → cost explosion.

Final answer

  • Postgres 200 GB → totally fine for years
  • Elasticsearch 100–200 GB → NOT enough
  • ⚠️ Logs will fill ES in 1–2 months
  • ✅ Use ILM + S3 + Glacier
  • ✅ Treat ES as short-term cache, not storage
Hermes Wiki