System Design/
Lesson

A beautifully designed architecture that costs $5,000/month when the budget is $500 is not a good architecture, it is a fantasy. Cost estimation is a design constraint that shapes every decision.

The 3 pillars of cloud cost

Cloud billing comes down to three things: compute, storage, and data transfer. If you understand these three, you can estimate any system.

Compute (CPU/RAM)

AWS example (us-east-1):

TypevCPURAMCost/monthBest for
t3.micro21 GB~$8Testing, very light workloads
t3.small22 GB~TABLE6Dev environments, low-traffic apps
t3.medium24 GB~$32Small production workloads
t3.large28 GB~$62Medium production workloads
c6i.large24 GB~$70CPU-intensive tasks (compute-optimized)
m6i.xlarge416 GB~TABLE40Memory-heavy apps (general purpose)

Rules of thumb:

  • Development: t3.small/medium (burstable, fine for low traffic)
  • Production small: t3.large
  • Production medium: c6i/m6i instances (consistent performance)

The "t" instances are burstable: they accumulate CPU credits when idle and spend them during spikes. If your CPU is consistently above 30%, switch to a "c" or "m" instance.

AI pitfall
AI-generated cost estimates almost always suggest on-demand pricing. Spot instances save 60-70% on non-critical workloads. Reserved instances or savings plans save 30-40% on predictable servers. Always ask AI: "What would this cost with spot or reserved pricing?"

Storage

Types and costs:

TypeCost/GB/monthLatencyUse case
S3 Standard$0.023100-200msFrequently accessed files
S3 Infrequent Access$0.0125100-200msBackups, older data
S3 Glacier$0.004Minutes to hoursArchives, compliance data
EBS (SSD gp3)$0.081-5msDatabases, application storage
RDS storage$0.115+1-5msManaged database storage

Storage costs seem small ($0.023/GB means 1 TB = $23), but storage grows over time and rarely shrinks. After a year, you can easily accumulate 10-50 TB.

The hidden cost is operations. S3 charges $0.005 per 1,000 PUTs and $0.0004 per 1,000 GETs. An app serving 1 million images/day pays $12/month just in GET fees, on top of storage and transfer.

Data transfer

This is where budgets go to die.

  • Inbound (ingress): generally free
  • Outbound (egress): $0.09/GB on AWS
  • Between AWS regions: $0.02/GB
  • Between availability zones (same region): $0.01/GB

Example: A mobile app with 10K users, 10MB/user/day of data

  • 10K x 10MB x 30 days = 3 TB/month
  • Cost: 3,000 GB x $0.09 = $270/month just in data transfer

Good to know
Cloudflare, Backblaze B2, and some newer providers offer free or very cheap egress. This is why many companies put Cloudflare in front of AWS, Cloudflare's bandwidth is essentially free.
02

The hidden costs nobody mentions

Hidden costTypical monthly amountWhy it surprises you
CloudWatch/monitoringTABLE0-50Log ingestion charges pile up
Load balancer$20-30Fixed cost even with zero traffic
NAT Gateway$30-100Required if private subnets need internet access
DNS (Route 53)$2-5Per hosted zone + per query
Secrets Manager$5-20$0.40 per secret per month
Backups (RDS snapshots)10-20% of DB costAutomatic but not free

NAT Gateways deserve special mention: $0.045/hour (~$32/month) plus $0.045/GB processed. For a system making many outbound APIWhat is api?A set of rules that lets one program talk to another, usually over the internet, by sending requests and getting responses. calls, this single component can cost more than your servers.

03

Estimation template

For a system with:

  • 2 web servers (t3.medium)
  • 1 RDS database (db.t3.medium)
  • 100 GB S3 storage
  • 500 GB data transfer/month

Compute:
- 2 × t3.medium × $32 = $64
- 1 × db.t3.medium × $65 = $65

Storage:
- 100 GB S3 × $0.023 = $2.30
- 50 GB EBS (OS + logs) × $0.08 = $4

Data Transfer:
- 500 GB × $0.09 = $45

Other:
- Load balancer: $20
- CloudWatch/logs: CODE_BLOCK0
- Backups (20% of RDS): CODE_BLOCK3
- NAT Gateway: $32

TOTAL: ~$255/month (~$3,060/year)

Always add a 30% buffer. A $255 estimate becomes $332, still cheaper than being surprised by a $400 bill.

04

Estimation tools

  • AWS Calculator: calculator.aws
  • GCP Pricing Calculator: cloud.google.com/products/calculator
  • Azure Pricing Calculator: azure.microsoft.com/pricing/calculator
  • Infracost: Open-source tool that estimates costs from Terraform code
05

Common optimizations

ProblemSolutionSavings
Servers idle at nightAuto-scaling or spot instances30-70%
Heavy images/videosCDN (CloudFront) + compression50-80%
Overloaded DBRead replicas, caching (Redis)40-60%
Infinite logsRetention policy (30d to 7d)60-80%
High egress costsCloudflare in front of S3/origin70-90%
Predictable workloadsReserved instances / savings plans30-60%
06

Alternatives to AWS for startups

PlatformCompute costEgressBest for
RailwayFrom $5/monthIncludedQuick deploys, small apps
RenderFrom $7/monthIncludedStatic sites + APIs
Fly.ioFrom $2/month$0.02/GBEdge deployment, low latency
HetznerFrom $4/month20 TB includedEuropean projects, raw VPS
DigitalOceanFrom $6/month1 TB includedSimple cloud, good docs
Edge case
Free tier traps are real. AWS gives 750 hours of t2.micro/month for 12 months, then billing kicks in silently. Set up billing alerts from day one.