skip to content

Function Platforms Compared

The big function platforms differ in isolation, packaging, placement and limits. Interviewers ask which you would pick for a workload, why, and what a move between them costs.

on this pageshow

questions

5

What deployable unit do AWS Lambda, Azure Functions, Cloud Run and Cloudflare Workers each expect, and what does that unit decide for you?

level: juniorimportance: should knowfreq 48%

answer

  1. what you upload, not how it runs
  2. archive, image, app package, bundle
  3. event handler versus web server
  4. native libraries need an operating system

basics

~20 s

AWS Lambda takes a zip archive (optionally with layers) or a container image; Azure Functions a function-app package; Cloud Run any container image serving HTTP; Cloudflare Workers a script bundle or WebAssembly module. The unit decides which dependencies you can ship.

solid answer

~40 s

AWS Lambda accepts a zip archive (shared dependencies can go in layers) or a container image, but either way the code is an event handler: an image must carry a runtime client that pulls events from the platform. Azure Functions deploys a function app, a project of functions declaring triggers and bindings, with containers accepted on some hosting plans. Cloud Run takes any container image that listens on the port it is given, so the contract is plain HTTP. Cloudflare Workers takes a script bundle or a `WebAssembly` module that runs in a V8 isolate, with no operating system underneath. So the unit decides whether native libraries can ship, what contract the code must meet, and how much of the artifact survives a move to another platform.

go deeper

for a junior

Recall the four units: zip or image for AWS Lambda, function-app package for Azure Functions, container image for Cloud Run, script bundle or WebAssembly for Cloudflare Workers.

for a middle

Explain the contract behind each unit: an event handler pulled by a runtime client, a function with bindings, a plain HTTP server, or a fetch-style handler in an isolate.

for a senior

Show what the unit costs in production: native dependencies built for the right architecture, image scanning versus bundle size budgets, and adapters needed to reuse one artifact elsewhere.

for a principal

Treat the packaging unit as a portability decision: plain HTTP in a container keeps an exit open, while bindings and platform event shapes trade that exit for less glue code.

## Why the packaging unit is the first comparison Every function platform asks you to hand it *something*, and that something, the **packaging unit**, decides more than the build script. It fixes which dependencies you can ship (pure code only, or native libraries compiled for an operating system), what contract your code must satisfy (an event handler the platform calls, or a web server the platform sends HTTP to), and how much of the artifact survives a move to another platform. Four platforms dominate interview comparisons: **AWS Lambda**, **Azure Functions**, **Cloud Run** and **Cloudflare Workers**. Each also runs the unit inside a different isolation boundary, noted in one line below; how those boundaries behave at runtime is a separate subject. ## AWS Lambda: an archive or an image, still an event handler - **Zip archive**: your code plus its dependencies, with an entry point named by a handler setting such as `app.handler`. Shared dependencies can sit in **layers**, separate archives the platform unpacks into the execution environment beside your code. - **Container image**: an OCI image pushed to a registry. It can be larger than an archive and lets you install operating-system packages the usual way, but it must contain a **runtime interface client** that pulls the next event from the platform's runtime API and posts the result back. An ordinary web-server image does not run unchanged; it needs an adapter that turns each event into an HTTP request. - Either way the code runs in a **Firecracker microVM**, a lightweight virtual machine per execution environment, in the region you deploy to. ## Azure Functions: a function app with bindings The unit is a **function app**: a project holding one or more functions plus host configuration (a `host.json` file), deployed as a package. Each function declares a **trigger** and optional **input and output bindings**, so the platform's host process reads a queue message or writes a document on the function's behalf. Several hosting plans exist, from consumption-billed through pre-warmed to dedicated machines, and some of them also accept a container image. What isolates your code depends on the plan, so a fair comparison names the plan. ## Cloud Run: a container that listens on a port The unit is any **container image** whose process starts a server on the port the platform passes in an environment variable. There is no handler signature: the platform sends ordinary HTTP requests, or events delivered as HTTP, to the container. Each container instance runs inside a sandbox the provider manages. Because the contract is only "an image that serves HTTP", the same image usually runs on a laptop, on Kubernetes or on a Knative installation with little change. Cloud Functions in its current generation is built on the same machinery and hides the image behind a source-code deploy. ## Cloudflare Workers: a bundle for an isolate The unit is a **script bundle**, one or more modules produced by a bundler, or a **WebAssembly** module, uploaded once and distributed to the provider's edge locations. The code exports a fetch-style handler that receives a web-standard request object and returns a response. It runs in a **V8 isolate**, a lightweight sandbox inside a process shared with other tenants' isolates. There is no operating system to install packages into and no persistent local disk, and native binaries cannot be loaded, so every dependency must be pure script or compiled to WebAssembly. ## Side by side | Platform | Packaging unit | Code contract | Isolation boundary | Placement | |---|---|---|---|---| | AWS Lambda | zip archive with layers, or container image | handler called with an event object | Firecracker microVM | a region | | Azure Functions | function-app package; container on some plans | functions with triggers and bindings | depends on the hosting plan | a region | | Cloud Run | container image | HTTP server on a given port | sandboxed container instance | a region | | Cloudflare Workers | script bundle or WebAssembly | fetch-style handler | V8 isolate | edge locations | What follows from the table: 1. **Native dependencies** travel inside a container image on any platform that takes one, inside an archive only when compiled for the platform's operating system and CPU architecture, and not at all inside an isolate bundle. 2. **Portability** is highest where the contract is plain HTTP in a container and lowest where bindings or a platform-specific event shape are woven through the code. 3. **Build pipelines differ**: a registry and image scanning for containers, an archive or layer publish for zip packages, a bundler step and a size budget for isolate bundles. 4. **Every unit has a size ceiling**, and each platform sets its own; read the current documentation rather than carrying a figure from one platform to the next. ## What interviewers listen for A strong answer names the unit *and* its consequence. "AWS Lambda takes a zip" is recall; "an AWS Lambda container image is still an event handler, so our web-server image needs an adapter there, while Cloud Run would run it as it is" shows you have shipped one. The other common slip is treating the edge runtime as a smaller copy of the regional platforms: its unit is a bundle precisely because there is no operating system to hand you.

  • Why does an AWS Lambda container image still not behave like a Cloud Run image?
    An AWS Lambda image must implement the runtime API loop: a runtime interface client inside it fetches the next event and posts the result, so the code is an event handler, not a server. To run an ordinary web-server image there you add an adapter that turns each event into an HTTP request. Cloud Run simply sends HTTP to the port the container listens on.
  • What happens to a native image-processing library in each packaging unit?
    In a zip archive or layer it must be compiled for the platform's operating system and CPU architecture. In a container image you install it like any operating-system package. A script bundle for an isolate runtime cannot load native code at all, so you need a WebAssembly build of the library or a separate service that does the work.

Handing AWS Lambda a zip is giving a cook your recipe for their kitchen; handing Cloud Run an image is parking your own fully stocked food truck; handing Cloudflare Workers a bundle is sending a recipe to hundreds of tiny kiosks that only have the utensils already on the counter.

  • Any web-server container image runs unchanged on AWS Lambda.
  • A Cloudflare Workers bundle can include and execute a native binary.
  • Cloud Run requires a special handler signature in your code.
  • The packaging format is a build detail with no effect on portability.
  • Azure Functions isolation is the same whichever hosting plan you choose.
open as a page

Which function platform would you pick for an image-resizing API, and which for a geography-based redirect, and why?

level: middleimportance: should knowfreq 45%

basics

~20 s

An edge isolate runtime such as Cloudflare Workers suits the geography redirect, which needs only request metadata. Image resizing suits a regional platform such as Cloud Run or AWS Lambda, near the stored images and able to run native libraries.

open as a page

How do AWS Lambda, Cloud Run and Cloudflare Workers differ in limit and billing shape for a function that mostly waits on network calls?

level: middleimportance: should knowfreq 38%

basics

~20 s

AWS Lambda bills and limits wall-clock duration per invocation, so waiting is paid per request; Cloud Run bills instance time that concurrent requests share; Cloudflare Workers bills and limits CPU time, so waiting on the network costs almost nothing.

open as a page

What does porting a working function from AWS Lambda to Cloud Run or Cloudflare Workers cost beyond rewriting its handler?

level: seniorimportance: should knowfreq 32%

basics

~20 s

Rewriting the handler is the cheap part. The cost is re-wiring triggers and retry semantics, permissions, configuration and secrets, packaging, telemetry and templates, then re-testing under a new concurrency model and limits; Cloudflare Workers adds native-dependency and data-locality work.

open as a page

As a platform lead, how would you choose the function platform your organisation standardises on, and when would you allow a second one?

level: principalimportance: should knowfreq 24%

basics

~20 s

Standardise on the regional function platform of the cloud already holding your data, identity and network, with a paved road around it. Allow a second platform, such as an edge runtime, only for a workload class the default cannot serve, with an owner.

open as a page