Setup a Serverless Runtime

Serverless applications need a place to run — how do you set that up?

, updated

Serverless doesn’t mean there’s no server — it means your application isn’t resident for long periods. It’s spun up on demand, triggered by events, and torn down when idle. To develop and run serverless functions locally, you need a runtime that can simulate this ephemeral execution model.

Platform Options

Amazon Firecracker

Firecracker is Amazon’s open-source virtualization technology, originally built for AWS Lambda. It creates lightweight microVMs that boot in ~125ms with minimal overhead.

Key features:

  • MicroVM isolation with near-instant boot times
  • Resource isolation per function
  • Minimal overhead (the Firecracker process itself is ~5MB)

Firecracker is best for teams that want Lambda-like isolation on their own infrastructure.

Kubeless

Kubeless is a Kubernetes-native serverless framework. It uses Custom Resource Definitions (CRDs) to define functions and relies on Kubernetes for scheduling, autoscaling, and monitoring.

Key features:

  • Runs on any Kubernetes cluster
  • Supports Python, Node.js, Ruby, PHP, Go, and .NET
  • HTTP and event-based triggers (Kafka, NATS, etc.)
  • Functions are packaged as Docker images

Quick start:

# Install the kubeless controller on your cluster
kubectl create ns kubeless
kubectl apply -f https://github.com/kubeless/kubeless/releases/latest/kubeless.yaml

# Deploy a function
kubeless function deploy hello --runtime python3.9 \
  --handler hello.handler \
  --from-file hello.py

# Call it
kubeless function call hello

OpenFaaS

OpenFaaS makes it easy to deploy functions and microservices on any Kubernetes or Docker Swarm cluster.

Quick start:

# Install the CLI
curl -SLsf https://cli.openfaas.com | sh

# Deploy a function
faas-cli deploy --image ghcr.io/openfaas/alpine:latest --name hello

# Invoke it
echo "Hello" | faas-cli invoke hello

Knative

Knative provides serverless building blocks on top of Kubernetes, focusing on scale-to-zero and event-driven workloads. It’s backed by Google, Red Hat, and IBM.

Key features:

  • Scale to zero when idle
  • Eventing system for routing events to services
  • Works with any container, not just functions

Running Locally

LocalStack

LocalStack provides a fully functional local AWS cloud stack. It’s the easiest way to develop Lambda functions locally.

# Start LocalStack
docker run -d -p 4566:4566 localstack/localstack

# Create a Lambda function
awslocal lambda create-function \
  --function-name hello \
  --runtime python3.9 \
  --handler hello.handler \
  --zip-file fileb://function.zip

ElasticMQ

If you just need SQS-like queues locally, ElasticMQ is a lightweight, in-memory message queue server that implements the SQS API.

# Start ElasticMQ
docker run -d -p 9324:9324 softwaremill/elasticmq

Choosing a Runtime

Need Best Option
Lambda-like isolation on your own infra Firecracker
Already running Kubernetes Kubeless or Knative
Simple, any container, any orchestrator OpenFaaS
Local AWS development LocalStack
Just need SQS locally ElasticMQ

Start simple — LocalStack or Kubeless — and add complexity only when you need it.