Deployment Platform
Choose where code runs — VMs, containers, functions, or PaaS — based on the workload shape and team capacity.
Why
The deployment platform determines your ops model: VMs (you patch everything), containers (you patch the image), functions (you patch nothing), PaaS (you patch nothing + vendor handles scaling). The right choice depends on the workload: long-running stateful services want VMs/containers, bursty event-driven workloads want functions, simple web apps want PaaS. The wrong choice means either too much ops (functions for a long-running DB) or too much abstraction (VMs for a 50-line webhook). The platform also determines cost at scale: functions are cheap at low volume and expensive at high volume, VMs are the opposite. Match the platform to the workload, not the other way around.
When
At service creation. Takes half a day. Revisit if ops burden or cost is wrong for the workload.
How
1. Characterize the workload: - Long-running + stateful → VM or container - Long-running + stateless → container (Fargate/ECS/GKE) - Bursty + event-driven + <100ms cold-start OK → function (Lambda) - Simple web app, no special needs → PaaS (Render/Railway/App Runner) 2. Assess team capacity: can we operate VMs? containers? or need fully managed? 3. Estimate cost at expected scale (functions win low, containers win high) 4. Consider polyglot: different services may suit different platforms 5. Prefer the simplest platform that handles the workload — PaaS > containers > VMs 6. Document the platform per service + the reasoning (workload shape + team capacity)
Example
Services and platforms: 1. Postgres DB (stateful, long-running) → RDS (managed VM) — no other option 2. API server (stateless, long-running, 24/7) → Fargate (containers) — cost-effective at 24/7 3. Image resizer (bursty, event-driven, 100ms cold-start OK) → Lambda — scales to zero 4. Internal admin (simple web, low traffic) → App Runner (PaaS) — zero ops 5. ML batch (long-running, GPU) → EC2 spot (VM) — GPU + cost Mix is correct: each workload on the platform that fits it. Forcing all to Lambda: #2 costs 5x, #1/#5 impossible. Forcing all to VM: #3/#4 carry idle cost + ops burden.
Common Problems
- ⚠Using functions for long-running services — Lambda is priced per-100ms and a 24/7 service costs 5-10x on Lambda vs containers; match the platform to the duty cycle.
Best Practices
- ✓Default to containers for services and functions for event handlers — this split covers 90% of workloads with the right cost/ops trade-off.
- ✓Re-evaluate the platform as the workload matures — a Lambda that made sense at 100 req/day may be 5x the cost at 100k req/day; plan to migrate.