Skip to main content
A pod fits when you already have a command or image to run. For Python you want to call as a function or serve over HTTP, an endpoint needs less setup.

Define a pod

Save this as tools.py:
Pods are public by default. authorized=True makes the URL take the same bearer token as an endpoint.

Deploy it

lazycloud deploy runs the pod in the cloud and prints its URL. The vLLM example deploys a model server this way.
A deployed pod runs one container while it has connections and stops it after keep_warm seconds idle, 600 by default. keep_warm=-1 keeps one up at all times, which suits a model server that can’t wait for a cold start. Pods don’t autoscale, so more containers means a count:
The count holds until the next scale, and web.scale(n) does the same from Python.

Create an instance on demand

A pod can also run once without a deployment. With an access token in LAZYCLOUD_TOKEN, this starts an instance, fetches the directory listing, and stops it:
web.run("python", "--version") starts one with a different command. An instance has a url and terminate(), and lives for keep_warm seconds unless timeout_seconds says otherwise.

Pod options

env, secrets, volumes, and machine work as on every workload, and web.shell() opens a shell in a pod container.

TCP connections

tcp=True exposes a raw TCP port at a tls://hostname:port address. Clients connect with TLS and send that hostname as SNI. TCP pods are always public, so the server authenticates its own clients.

Stop and clean up

stop keeps the definition and delete removes it, like web.pause() and web.delete() in Python. A running deployment replaces any container you stop by hand, so stopping the deployment is what keeps a pod down.

Shared settings

Images, resources, and scaling.