vastai-migration-deep-dive

1
0
Source

Execute Vast.ai major re-architecture and migration strategies with strangler fig pattern. Use when migrating to or from Vast.ai, performing major version upgrades, or re-platforming existing integrations to Vast.ai. Trigger with phrases like "migrate vastai", "vastai migration", "switch to vastai", "vastai replatform", "vastai upgrade major".

Install

mkdir -p .claude/skills/vastai-migration-deep-dive && curl -L -o skill.zip "https://mcp.directory/api/skills/download/4104" && unzip -o skill.zip -d .claude/skills/vastai-migration-deep-dive && rm skill.zip

Installs to .claude/skills/vastai-migration-deep-dive

About this skill

Vast.ai Migration Deep Dive

Current State

!vastai --version 2>/dev/null || echo 'vastai CLI not installed' !pip show vastai 2>/dev/null | grep Version || echo 'N/A'

Overview

Migrate GPU workloads to Vast.ai from hyperscaler providers (AWS, GCP, Azure) or other GPU clouds (Lambda, RunPod, CoreWeave). Also covers migrating between GPU types on Vast.ai and the reverse migration away from Vast.ai.

Prerequisites

  • Existing GPU workload with Docker image
  • Understanding of current GPU costs and utilization
  • Checkpoint-based training pipeline (for training migrations)

Instructions

Step 1: Cost Comparison Analysis

# Compare your current GPU costs against Vast.ai marketplace prices
PROVIDER_COSTS = {
    "aws_p4d.24xlarge":      {"gpu": "A100 40GB", "gpus": 8, "hourly": 32.77},
    "aws_p3.2xlarge":        {"gpu": "V100 16GB", "gpus": 1, "hourly": 3.06},
    "gcp_a2-highgpu-1g":     {"gpu": "A100 40GB", "gpus": 1, "hourly": 3.67},
    "azure_NC24ads_A100_v4": {"gpu": "A100 80GB", "gpus": 1, "hourly": 3.67},
    "lambda_1xA100":         {"gpu": "A100",      "gpus": 1, "hourly": 1.25},
}

VASTAI_TYPICAL = {
    "RTX_4090":  0.20,
    "A100":      1.50,
    "H100_SXM":  3.00,
}

def savings_analysis(current_provider, current_hourly, vastai_gpu, vastai_hourly):
    monthly_current = current_hourly * 730  # hours/month
    monthly_vastai = vastai_hourly * 730
    savings = monthly_current - monthly_vastai
    pct = (savings / monthly_current) * 100
    print(f"Current ({current_provider}): ${monthly_current:,.0f}/mo")
    print(f"Vast.ai ({vastai_gpu}): ${monthly_vastai:,.0f}/mo")
    print(f"Savings: ${savings:,.0f}/mo ({pct:.0f}%)")

savings_analysis("AWS p3.2xlarge", 3.06, "RTX_4090", 0.20)
# Output: Savings: $2,088/mo (93%)

Step 2: Docker Image Migration

# Most Docker images work unchanged on Vast.ai
# Key differences:
# - Vast.ai instances run as root
# - /workspace is the default working directory
# - SSH access (not IAM roles) for authentication

# Adapt your existing Dockerfile
cat << 'DOCKERFILE' > Dockerfile.vastai
FROM your-existing-image:latest

# Vast.ai instances use /workspace by default
WORKDIR /workspace

# Install any Vast.ai-specific tools
RUN pip install boto3  # for S3 checkpoint uploads

# Copy training code
COPY src/ /workspace/src/
COPY configs/ /workspace/configs/

CMD ["python", "src/train.py"]
DOCKERFILE

docker build -t ghcr.io/org/training:vastai -f Dockerfile.vastai .
docker push ghcr.io/org/training:vastai

Step 3: Adapt Cloud Storage Credentials

# On AWS/GCP: IAM roles provide automatic credentials
# On Vast.ai: Pass credentials explicitly via environment variables

# Create instance with env vars for cloud storage access
vastai create instance $OFFER_ID \
  --image ghcr.io/org/training:vastai \
  --disk 100 \
  --env "AWS_ACCESS_KEY_ID=AKIA... AWS_SECRET_ACCESS_KEY=... AWS_DEFAULT_REGION=us-east-1"

Step 4: Migration Validation

#!/bin/bash
set -euo pipefail
echo "Migration Validation Checklist"

# 1. Docker image runs on Vast.ai
vastai create instance $OFFER_ID --image ghcr.io/org/training:vastai --disk 50
# Wait for running...

# 2. GPU access works
ssh -p $PORT root@$HOST "nvidia-smi && python -c 'import torch; print(torch.cuda.is_available())'"

# 3. Cloud storage works
ssh -p $PORT root@$HOST "aws s3 ls s3://your-bucket/ | head -5"

# 4. Training runs and saves checkpoints
ssh -p $PORT root@$HOST "cd /workspace && python src/train.py --epochs 1 --checkpoint-dir /workspace/ckpt"

# 5. Checkpoints uploaded to cloud storage
ssh -p $PORT root@$HOST "aws s3 sync /workspace/ckpt/ s3://your-bucket/ckpt/"

# 6. Clean up
vastai destroy instance $INSTANCE_ID
echo "Migration validation complete"

Step 5: Rollback Plan

## Rollback Procedure
1. Stop all Vast.ai instances: `vastai show instances` → `vastai destroy instance ID`
2. Re-provision on original cloud provider
3. Resume training from cloud-stored checkpoint
4. Vast.ai Docker image remains available for future retry

Migration Comparison

FactorAWS/GCP/AzureVast.ai
PricingFixed, premiumVariable, 50-90% cheaper
GPU availabilityOn-demand guaranteedMarketplace (may sell out)
SLA99.9% uptimeNo SLA (spot instances)
IAM rolesNativeManual credential passing
NetworkingVPC, private subnetsPublic SSH only
StorageEBS/PD attachedLocal disk + cloud storage
SupportEnterprise supportCommunity/email

Output

  • Cost savings analysis comparing providers
  • Adapted Docker image for Vast.ai
  • Cloud credential migration pattern
  • Validation script for migration testing
  • Rollback procedure

Error Handling

ErrorCauseSolution
Docker image incompatibleRelies on IAM roles or cloud-specific APIsPass credentials via env vars
CUDA version mismatchDifferent CUDA on Vast.ai hostsFilter by cuda_max_good in search
Data transfer too slowLarge dataset over public internetStage data in cloud storage, download on instance
No matching offersSpecific GPU unavailableTry alternative GPU type or wait for availability

Resources

Next Steps

Review vastai-reference-architecture for best-practice project structure.

Examples

AWS to Vast.ai: Replace p3.2xlarge ($3.06/hr) with RTX 4090 ($0.20/hr) for a 93% cost reduction. Adapt the Dockerfile to pass AWS credentials via env vars for S3 checkpoint access.

Hybrid approach: Use Vast.ai for experimentation and hyperparameter search (cheap GPUs), then run final training on AWS for SLA guarantees.

svg-icon-generator

jeremylongshore

Svg Icon Generator - Auto-activating skill for Visual Content. Triggers on: svg icon generator, svg icon generator Part of the Visual Content skill category.

6814

d2-diagram-creator

jeremylongshore

D2 Diagram Creator - Auto-activating skill for Visual Content. Triggers on: d2 diagram creator, d2 diagram creator Part of the Visual Content skill category.

2412

performing-penetration-testing

jeremylongshore

This skill enables automated penetration testing of web applications. It uses the penetration-tester plugin to identify vulnerabilities, including OWASP Top 10 threats, and suggests exploitation techniques. Use this skill when the user requests a "penetration test", "pentest", "vulnerability assessment", or asks to "exploit" a web application. It provides comprehensive reporting on identified security flaws.

379

designing-database-schemas

jeremylongshore

Design and visualize efficient database schemas, normalize data, map relationships, and generate ERD diagrams and SQL statements.

978

performing-security-audits

jeremylongshore

This skill allows Claude to conduct comprehensive security audits of code, infrastructure, and configurations. It leverages various tools within the security-pro-pack plugin, including vulnerability scanning, compliance checking, cryptography review, and infrastructure security analysis. Use this skill when a user requests a "security audit," "vulnerability assessment," "compliance review," or any task involving identifying and mitigating security risks. It helps to ensure code and systems adhere to security best practices and compliance standards.

86

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

965

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318399

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

340397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

452339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.