<< All versions
Skill v1.0.0
currentAutomated scan100/100foryourhealth111-pixel/vibe-skills/skypilot-multi-cloud-orchestration
──Details
PublishedSeptember 28, 2026 at 04:20 PM
Content Hashsha256:de1be4556d8a8f79...
Git SHAddcaa2affca9
──Files
Files (1 file, 9.4 KB)
SKILL.md9.4 KBactive
SKILL.md · 510 lines · 9.4 KB
name: skypilot-multi-cloud-orchestration description: Multi-cloud orchestration for ML workloads with automatic cost optimization. Use when you need to run training or batch jobs across multiple clouds, leverage spot instances with auto-recovery, or optimize GPU costs across providers. version: 1.0.0 author: Orchestra Research license: MIT tags: [Infrastructure, Multi-Cloud, Orchestration, GPU, Cost Optimization, SkyPilot] dependencies: [skypilot>=0.7.0]
SkyPilot Multi-Cloud Orchestration
Comprehensive guide to running ML workloads across clouds with automatic cost optimization using SkyPilot.
When to use SkyPilot
Use SkyPilot when:
- Running ML workloads across multiple clouds (AWS, GCP, Azure, etc.)
- Need cost optimization with automatic cloud/region selection
- Running long jobs on spot instances with auto-recovery
- Managing distributed multi-node training
- Want unified interface for 20+ cloud providers
- Need to avoid vendor lock-in
Key features:
- Multi-cloud: AWS, GCP, Azure, Kubernetes, Lambda, RunPod, 20+ providers
- Cost optimization: Automatic cheapest cloud/region selection
- Spot instances: 3-6x cost savings with automatic recovery
- Distributed training: Multi-node jobs with gang scheduling
- Managed jobs: Auto-recovery, checkpointing, fault tolerance
- Sky Serve: Model serving with autoscaling
Use alternatives instead:
- Modal: For simpler serverless GPU with Python-native API
- RunPod: For single-cloud persistent pods
- Kubernetes: For existing K8s infrastructure
- Ray: For pure Ray-based orchestration
Quick start
Installation
bash
pip install "skypilot[aws,gcp,azure,kubernetes]"# Verify cloud credentialssky check
Hello World
Create hello.yaml:
yaml
resources:accelerators: T4:1run: |nvidia-smiecho "Hello from SkyPilot!"
Launch:
bash
sky launch -c hello hello.yaml# SSH to clusterssh hello# Terminatesky down hello
Core concepts
Task YAML structure
yaml
# Task name (optional)name: my-task# Resource requirementsresources:cloud: aws # Optional: auto-select if omittedregion: us-west-2 # Optional: auto-select if omittedaccelerators: A100:4 # GPU type and countcpus: 8+ # Minimum CPUsmemory: 32+ # Minimum memory (GB)use_spot: true # Use spot instancesdisk_size: 256 # Disk size (GB)# Number of nodes for distributed trainingnum_nodes: 2# Working directory (synced to ~/sky_workdir)workdir: .# Setup commands (run once)setup: |pip install -r requirements.txt# Run commandsrun: |python train.py
Key commands
| Command | Purpose | |
|---|---|---|
sky launch | Launch cluster and run task | |
sky exec | Run task on existing cluster | |
sky status | Show cluster status | |
sky stop | Stop cluster (preserve state) | |
sky down | Terminate cluster | |
sky logs | View task logs | |
sky queue | Show job queue | |
sky jobs launch | Launch managed job | |
sky serve up | Deploy serving endpoint |
GPU configuration
Available accelerators
yaml
# NVIDIA GPUsaccelerators: T4:1accelerators: L4:1accelerators: A10G:1accelerators: L40S:1accelerators: A100:4accelerators: A100-80GB:8accelerators: H100:8# Cloud-specificaccelerators: V100:4 # AWS/GCPaccelerators: TPU-v4-8 # GCP TPUs
GPU fallbacks
yaml
resources:accelerators:H100: 8A100-80GB: 8A100: 8any_of:- cloud: gcp- cloud: aws- cloud: azure
Spot instances
yaml
resources:accelerators: A100:8use_spot: truespot_recovery: FAILOVER # Auto-recover on preemption
Cluster management
Launch and execute
bash
# Launch new clustersky launch -c mycluster task.yaml# Run on existing cluster (skip setup)sky exec mycluster another_task.yaml# Interactive SSHssh mycluster# Stream logssky logs mycluster
Autostop
yaml
resources:accelerators: A100:4autostop:idle_minutes: 30down: true # Terminate instead of stop
bash
# Set autostop via CLIsky autostop mycluster -i 30 --down
Cluster status
bash
# All clusterssky status# Detailed viewsky status -a
Distributed training
Multi-node setup
yaml
resources:accelerators: A100:8num_nodes: 4 # 4 nodes × 8 GPUs = 32 GPUs totalsetup: |pip install torch torchvisionrun: |torchrun \--nnodes=$SKYPILOT_NUM_NODES \--nproc_per_node=$SKYPILOT_NUM_GPUS_PER_NODE \--node_rank=$SKYPILOT_NODE_RANK \--master_addr=$(echo "$SKYPILOT_NODE_IPS" | head -n1) \--master_port=12355 \train.py
Environment variables
| Variable | Description | |
|---|---|---|
SKYPILOT_NODE_RANK | Node index (0 to num_nodes-1) | |
SKYPILOT_NODE_IPS | Newline-separated IP addresses | |
SKYPILOT_NUM_NODES | Total number of nodes | |
SKYPILOT_NUM_GPUS_PER_NODE | GPUs per node |
Head-node-only execution
bash
run: |if [ "${SKYPILOT_NODE_RANK}" == "0" ]; thenpython orchestrate.pyfi
Managed jobs
Spot recovery
bash
# Launch managed job with spot recoverysky jobs launch -n my-job train.yaml
Checkpointing
yaml
name: training-jobfile_mounts:/checkpoints:name: my-checkpointsstore: s3mode: MOUNTresources:accelerators: A100:8use_spot: truerun: |python train.py \--checkpoint-dir /checkpoints \--resume-from-latest
Job management
bash
# List jobssky jobs queue# View logssky jobs logs my-job# Cancel jobsky jobs cancel my-job
File mounts and storage
Local file sync
yaml
workdir: ./my-project # Synced to ~/sky_workdirfile_mounts:/data/config.yaml: ./config.yaml~/.vimrc: ~/.vimrc
Cloud storage
yaml
file_mounts:# Mount S3 bucket/datasets:source: s3://my-bucket/datasetsmode: MOUNT # Stream from S3# Copy GCS bucket/models:source: gs://my-bucket/modelsmode: COPY # Pre-fetch to disk# Cached mount (fast writes)/outputs:name: my-outputsstore: s3mode: MOUNT_CACHED
Storage modes
| Mode | Description | Best For | |
|---|---|---|---|
MOUNT | Stream from cloud | Large datasets, read-heavy | |
COPY | Pre-fetch to disk | Small files, random access | |
MOUNT_CACHED | Cache with async upload | Checkpoints, outputs |
Sky Serve (Model Serving)
Basic service
yaml
# service.yamlservice:readiness_probe: /healthreplica_policy:min_replicas: 1max_replicas: 10target_qps_per_replica: 2.0resources:accelerators: A100:1run: |python -m vllm.entrypoints.openai.api_server \--model meta-llama/Llama-2-7b-chat-hf \--port 8000
bash
# Deploysky serve up -n my-service service.yaml# Check statussky serve status# Get endpointsky serve status my-service
Autoscaling policies
yaml
service:replica_policy:min_replicas: 1max_replicas: 10target_qps_per_replica: 2.0upscale_delay_seconds: 60downscale_delay_seconds: 300load_balancing_policy: round_robin
Cost optimization
Automatic cloud selection
yaml
# SkyPilot finds cheapest optionresources:accelerators: A100:8# No cloud specified - auto-select cheapest
bash
# Show optimizer decisionsky launch task.yaml --dryrun
Cloud preferences
yaml
resources:accelerators: A100:8any_of:- cloud: gcpregion: us-central1- cloud: awsregion: us-east-1- cloud: azure
Environment variables
yaml
envs:HF_TOKEN: $HF_TOKEN # Inherited from local envWANDB_API_KEY: $WANDB_API_KEY# Or use secretssecrets:- HF_TOKEN- WANDB_API_KEY
Common workflows
Workflow 1: Fine-tuning with checkpoints
yaml
name: llm-finetunefile_mounts:/checkpoints:name: finetune-checkpointsstore: s3mode: MOUNT_CACHEDresources:accelerators: A100:8use_spot: truesetup: |pip install transformers acceleraterun: |python train.py \--checkpoint-dir /checkpoints \--resume
Workflow 2: Hyperparameter sweep
yaml
name: hp-sweep-${RUN_ID}envs:RUN_ID: 0LEARNING_RATE: 1e-4BATCH_SIZE: 32resources:accelerators: A100:1use_spot: truerun: |python train.py \--lr $LEARNING_RATE \--batch-size $BATCH_SIZE \--run-id $RUN_ID
bash
# Launch multiple jobsfor i in {1..10}; dosky jobs launch sweep.yaml \--env RUN_ID=$i \--env LEARNING_RATE=$(python -c "import random; print(10**random.uniform(-5,-3))")done
Debugging
bash
# SSH to clusterssh mycluster# View logssky logs mycluster# Check job queuesky queue mycluster# View managed job logssky jobs logs my-job
Common issues
| Issue | Solution | |
|---|---|---|
| Quota exceeded | Request quota increase, try different region | |
| Spot preemption | Use sky jobs launch for auto-recovery | |
| Slow file sync | Use MOUNT_CACHED mode for outputs | |
| GPU not available | Use any_of for fallback clouds |
References
- [Advanced Usage](references/advanced-usage.md) - Multi-cloud, optimization, production patterns
- [Troubleshooting](references/troubleshooting.md) - Common issues and solutions
Resources
- Documentation: https://docs.skypilot.co
- GitHub: https://github.com/skypilot-org/skypilot
- Slack: https://slack.skypilot.co
- Examples: https://github.com/skypilot-org/skypilot/tree/master/examples