Skip to content

SkyPilot - Run AI Workloads on Any Cloud Cheatsheet

SkyPilot - Run AI Workloads on Any Cloud Cheatsheet

SkyPilot runs AI and batch workloads on any cloud or Kubernetes cluster from a single YAML definition. Its core value for LLM work is economic: GPU availability and pricing vary wildly across providers and regions, and SkyPilot automatically finds the cheapest available capacity that meets your requirements, provisions it, syncs your code, runs the job, and tears everything down. It also handles spot-instance preemption with automatic recovery, which makes cheap interruptible GPUs practical for long training runs.

Installation

MethodCommand
pippip install "skypilot[all]"
Specific cloudspip install "skypilot[aws,gcp,kubernetes]"
Check credentialssky check
Verifysky --version

sky check reports which clouds you have working credentials for — SkyPilot only considers those.

Defining a Task

# train.yaml
resources:
  accelerators: A100:8
  use_spot: true
  any_of:
    - cloud: aws
    - cloud: gcp
    - cloud: kubernetes

num_nodes: 1

workdir: .

setup: |
  pip install -r requirements.txt

run: |
  torchrun --nproc_per_node=8 train.py --config configs/7b.yaml
FieldPurpose
resources.acceleratorsGPU type and count (A100:8, H100:4)
use_spotUse interruptible instances
any_of / orderedCandidate clouds/regions
workdirLocal dir synced to the cluster
setupRun once per cluster
runThe actual job
num_nodesMulti-node training

Core Commands

CommandDescription
sky launch -c mycluster train.yamlProvision and run
sky exec mycluster train.yamlRun again on an existing cluster
sky statusList clusters and costs
sky logs myclusterStream job logs
sky queue myclusterShow the job queue
sky down myclusterTerminate (stop paying)
sky stop myclusterStop but keep the disk

Managed Jobs (Spot with Recovery)

# Long training run on spot instances, auto-recovered on preemption
sky jobs launch -n llama-sft train.yaml
CommandPurpose
sky jobs launchSubmit a managed job
sky jobs queueList managed jobs
sky jobs logs -n NAMETail logs
sky jobs cancel -n NAMECancel

Managed jobs are the feature that makes spot GPUs usable for training: on preemption SkyPilot re-provisions elsewhere and resumes from your checkpoint, so a multi-day run survives interruptions.

Cost Optimization

MechanismEffect
Cross-cloud searchPicks the cheapest matching option
use_spot: trueOften 60–90% cheaper
sky show-gpusCurrent prices/availability by cloud
Autostopsky autostop -i 10 mycluster terminates idle clusters
sky downThe most important habit — idle GPUs are the main waste
# What A100 capacity exists and at what price?
sky show-gpus A100

Serving Models

# serve.yaml
service:
  readiness_probe: /v1/models
  replicas: 2

resources:
  accelerators: A100:1
  ports: 8000

run: |
  vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
sky serve up -n llm-api serve.yaml
sky serve status

SkyServe adds replicas, health checks, and autoscaling across clouds — useful for serving with vLLM on the cheapest available GPUs.

Kubernetes Backend

CapabilityNote
Existing clusterscloud: kubernetes targets your own K8s
MixedCombine on-prem K8s with cloud burst
GPU schedulingUses standard K8s GPU resources
No cloud credentials neededFor pure on-prem use

SkyPilot vs Alternatives

AspectSkyPilotRayCloud-native (SageMaker/Vertex)
Multi-cloudCore featurePossible, manualSingle vendor
Spot recoveryBuilt-inManualVaries
Lock-inNone (plain YAML)FrameworkHigh
Best forCheapest GPUs anywhereDistributed Python appsDeep single-cloud integration

Pairs with training stacks like Axolotl, TorchTitan, and serving via vLLM.

Resources