← all posts
engineering2026-05-06 · Orion Jones

Why Lander runs every customer on Fargate Spot (and saves 70%)

How we got per-customer compute cost down to $2.70/month per task by leaning on AWS Fargate Spot pricing. Trade-offs, eviction handling, and when on-demand is worth it.

Fargate on-demand for a 0.25 vCPU + 0.5 GB RAM task costs $8.88/month. Fargate Spot for the same task costs $2.70/month. That's a 70% discount in exchange for AWS's right to evict the task with 2 minutes notice if they need the capacity.

Every customer environment on Lander runs on Fargate Spot by default. Here's why, and how we handle the trade-off.

The eviction math

Fargate Spot evictions happen at roughly 5%/month per task in our region (us-west-2). When AWS reclaims capacity, your task gets a SIGTERM, has 2 minutes to drain in-flight requests, then is killed.

ECS detects the kill and starts a replacement task immediately. The replacement task takes 30-90 seconds to come up: pull image from ECR, register with the ALB target group, pass health checks, start receiving traffic.

So in expectation: ~5% of customer tasks experience a 30-90 second downtime once per month.

For a hobby/portfolio site, that's invisible. For a paid SaaS app at peak traffic, it can be a problem.

The trade-off framing

If you're charging $25/mo for a Fargate-backed plan, here's the math:

  • Spot: Fargate cost $2.70 + ALB amortized $2.50 + bandwidth ~$1 = ~$6.20 cost. ~75% gross margin.
  • On-demand: Fargate cost $8.88 + ALB $2.50 + bandwidth $1 = ~$12.40 cost. ~50% gross margin.

For Lander's Hobby plan, Spot is the obvious call. The 5%/mo eviction rate is acceptable for the price tier; customers who can't tolerate evictions upgrade to Pro+ which we run on-demand.

How we handle evictions cleanly

ECS does most of the work, but two things matter:

1. ALB target group health checks. When Fargate starts the eviction (sends SIGTERM), AWS automatically deregisters the task from the ALB target group. New requests route to surviving tasks during the 2-minute drain window.

In our case there's only one task per customer, so during eviction the ALB returns 503 until the replacement task is healthy. That's the 30-90 second window.

2. Container shutdown handling. Customer apps need to handle SIGTERM gracefully. Most frameworks do (Next.js, FastAPI, Express). Some don't.

We add a buildtime check: if the customer's container doesn't have a CMD that handles signals, we wrap it in tini (a tiny init that forwards signals).

When to use on-demand

Pro and Team tiers run on-demand. The contract is "always-on." We charge enough on those tiers ($75-200) that on-demand pricing still leaves 75-80% gross margin.

The decision criteria for any task:

  • Free or Hobby tier: Spot. Acceptable trade-off at the price.
  • Pro+: On-demand. Customers expect zero-downtime.
  • Critical platform infrastructure (control plane, ALB pool managers, Postgres): On-demand. Don't risk eviction of the management plane.
  • Batch / build / non-real-time workloads: Spot. Eviction rebooting a build is fine.

What I got wrong initially

When I first wrote Lander's cost model, I used $8.88/task in the calculations. The displayed margin in /admin showed -71% (way negative) because the model treated every customer as on-demand.

Real cost was $2.70/task because the CDK template defaults to Spot. The dashboard was lying about losses for weeks.

Lesson: derive your cost model from the actual CDK definitions, not from a hardcoded constant.

Operational notes

  • AWS Compute Savings Plans stack on top of Spot pricing. Once you have predictable monthly Fargate-hours (~10 customers in), commit to a 1-year savings plan for another 30% off.
  • Spot capacity in us-west-2 is generally available. Other regions can have intermittent spot exhaustion. If you see ECS PendingTask events, your region has temporary capacity issues. Fall back to on-demand temporarily.
  • Spot does not support Windows containers. Lander only runs Linux, so this doesn't matter for us.

Spot pricing is the single biggest reason Lander can charge $25/mo for a real Fargate-backed dynamic site while competitors charge $20-40 with shared serverless. The eviction trade-off is real but priced into the plan tiers.

Try Lander's Hobby plan (lander.host/onboard) and see how it feels. We'll move you to on-demand on Pro+ if you upgrade.

Stop reading. Start shipping.

free plan · no credit card · commercial use OK$ deploy now → lander.host