Cloud deployment options
Prerequisite: node-kubernetes-workload-design. Objective: Compare managed and self-hosted runtimes. Each example is independent. Tested with Node.js 22.16.0 on Linux. Save as main.mjs in a fresh disposable directory and run node main.mjs. These are static code blocks; external system behavior is not established by a local model.
How it works
A VM offers operating-system control but needs patching and supervision. Managed application platforms reduce host operations but may constrain ports, timeouts, filesystem persistence and supported runtimes. Functions often suit bounded request or event work; persistent connections and long background jobs require verified host capabilities. Separate durable storage from ephemeral instances, and plan workload identity, observability and rollback. Exact provider limits and prices are not verified here.
Compare fictional host constraints
import assert from 'node:assert/strict';const hosts=[{name:'function-model',maxSeconds:30,sockets:false},{name:'container-model',maxSeconds:600,sockets:true}];const suitable=hosts.filter(h=>h.sockets&&h.maxSeconds>=120).map(h=>h.name);assert.deepEqual(suitable,['container-model']);console.log(suitable[0]);Expected output:
container-modelThese invented limits illustrate requirements matching, not provider specifications.
Process a bounded synthetic event
import assert from 'node:assert/strict';function handle(event){if(event.kind!=='catalog.lookup'||typeof event.id!=='string'||!event.id)return {status:400};return {status:200,id:event.id};}assert.equal(handle({kind:'unknown'}).status,400);console.log(JSON.stringify(handle({kind:'catalog.lookup',id:'b1'})));Expected output:
{"status":200,"id":"b1"}This is application logic, not a provider-specific invocation contract.
Common mistake
Do not assume a filesystem write survives instance replacement or every Node core module is available on an edge runtime.
Practice
Pick a deployment model for a long-lived socket service and list two provider capabilities to verify.
Reference candidate: node-cloud-deployment-options-lookup (route unverified). Documentation anchors: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/. External versions and full integration are pending.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Cloud deployment options — knowledge check
Apply the lesson to a fresh scenario and explain the evidence boundary.
Which deployment property needs provider-specific checking?
Where should durable records be kept?
What does the fictional host filter prove?