How to Run Stable Diffusion in the Cloud (2026 Guide)

Learn how to run Stable Diffusion and ComfyUI in the cloud. Step-by-step guide to GPU instances, network volumes, port forwarding, and model weights.

On this page

To run Stable Diffusion in the cloud, you provision a cloud GPU instance equipped with at least 16 GB to 24 GB of VRAM, attach a persistent network storage volume for model checkpoints, launch a pre-configured ComfyUI or Automatic1111 Docker container, and access the interface over an encrypted HTTP proxy port.[source][source] Cloud GPU instances allow rendering generative images and diffusion video workflows without hardware thermal limits or local workstation constraints.[source]

Key takeaways

  • Cloud GPU instances provide on-demand access to high-VRAM cards like the NVIDIA RTX 4090 and L40S for running modern generative media models.[source]
  • Attaching persistent network volumes is critical to preserve downloaded model checkpoints, custom LoRAs, and generated images across pod restarts.[source]
  • Pre-built cloud templates expose standard web interface ports, including port 8188 for ComfyUI and port 7860 for Automatic1111.[source]
  • Stopping a GPU instance halts active compute charges while retaining network volume data for future generation sessions.[source]
  • Teams building automated generation pipelines can transition from persistent web interfaces to serverless API workers.[source]

Prerequisites and GPU hardware sizing

Before launching a cloud instance, determine your memory requirements based on the model architectures and checkpoint formats you plan to execute:

Model Architecture Minimum Recommended VRAM Recommended Cloud GPU SKU Precision Formats Supported
Stable Diffusion 1.5 8 GB VRAM RTX 3080 / RTX 4080 FP16, INT8
SDXL 1.0 (Base + Refiner) 12 GB to 16 GB VRAM RTX 4090 / L4 FP16, FP8
Stable Diffusion 3.5 Large 16 GB to 24 GB VRAM RTX 4090 / A10G FP16, FP8, GGUF
FLUX.1 Dev / Schnell 24 GB VRAM RTX 4090 / L40S FP16, FP8, NF4
Generative Video (CogVideoX) 24 GB to 48 GB VRAM L40S / A100 80GB FP16, BF16

For detailed memory footprint formulas and precision trade-offs across FP16, FP8, and GGUF quantization formats, see our complete FLUX and Stable Diffusion VRAM requirements guide.

To compare hourly rental rates across cloud providers offering NVIDIA RTX 4090 and data-center GPUs, check our best RTX 4090 cloud guide and the interactive GPU lookup index.

How to run Stable Diffusion in the cloud step by step

graph TD Step1["Step 1: Create Persistent Network Volume"] --> Step2["Step 2: Deploy Cloud GPU Pod with Docker Template"] Step2 --> Step3["Step 3: Connect to WebUI via HTTP Proxy Port"] Step3 --> Step4["Step 4: Download Checkpoints and Custom Nodes"] Step4 --> Step5["Step 5: Generate Media & Manage Instance State"]

Step 1: Create a persistent network volume

Cloud GPU instances are ephemeral by default. When a pod terminates, its local container storage disk is wiped.[source] To prevent re-downloading 10 GB to 50 GB of model weights on every session, you must provision persistent storage:

  1. Navigate to the storage management section of your cloud provider console (such as RunPod Storage or Vast.ai persistent volumes).[source][source]
  2. Select your preferred data center region (for example, US-East, US-West, or EU-Central).[source]
  3. Allocate sufficient disk capacity. A base allocation of 50 GB to 100 GB accommodates base checkpoints, LoRA adapters, control nets, and output directories.[source]
  4. Note the mount path assigned to the volume (commonly /runpod-volume or /workspace).[source]

Step 2: Deploy a cloud GPU pod with a pre-configured template

Deploying an official template eliminates manual installation of CUDA drivers, Python virtual environments, PyTorch runtimes, and xFormers optimizations:[source]

  1. Select a GPU tier suitable for your workload. An NVIDIA RTX 4090 with 24 GB VRAM or an L40S with 48 GB VRAM delivers fast diffusion steps and supports high batch sizes.[source]
  2. Choose a verified container template:
    • ComfyUI Template: Optimized for node-based graph workflows, advanced control nets, and FLUX.1 generation.[source]
    • Automatic1111 WebUI Template: Optimized for traditional prompt interfaces, inpainting, and extensions.[source]
  3. Attach your persistent network volume created in Step 1 to the deployment configuration.[source]
  4. Launch the pod on an on-demand or secure cloud tier to ensure persistent execution without spot interruption risks.[source]

Step 3: Connect to the web interface via HTTP proxy or SSH tunnel

Once the container finishes initialization, the cloud platform routes web traffic through an encrypted proxy service:[source]

graph LR Browser["Client Web Browser"] --> Proxy["Cloud HTTPS Proxy Gateway"] Proxy --> P8188["Port 8188: ComfyUI Web Dashboard"] Proxy --> P7860["Port 7860: Automatic1111 / Forge WebUI"] Proxy --> P8888["Port 8888: Jupyter Lab Terminal"]
  1. Locate the Connect or HTTP Services button on your active instance card in the dashboard.[source]
  2. Click the port link corresponding to your web interface:
    • Port 8188: ComfyUI web dashboard.[source]
    • Port 7860: Automatic1111 / Forge WebUI.[source]
    • Port 8888: Jupyter Lab environment for file management and terminal access.[source]
  3. If connecting via direct SSH or TensorDock virtual machines, establish an SSH local port forwarding tunnel:[source]
    BASH
    ssh -L 8188:127.0.0.1:8188 root@<INSTANCE_IP> -p <SSH_PORT>
    Then open http://127.0.0.1:8188 in your local web browser.[source]

Step 4: Download model checkpoints and configure custom nodes

Use high-speed command-line download tools inside the pod terminal or Jupyter Lab to download model weights directly from Hugging Face or Civitai in seconds:[source]

BASH
# Navigate to the persistent model directory
cd /runpod-volume/ComfyUI/models/checkpoints

# Download model checkpoint using aria2 for multi-threaded speed
aria2c -x 16 -s 16 "https://huggingface.co/.../model.safetensors"

To configure ComfyUI to read from your persistent volume permanently, edit the extra_model_paths.yaml configuration file:[source]

YAML
runpod_storage:
    base_path: /runpod-volume/models
    checkpoints: checkpoints
    clip: clip
    vae: vae
    loras: loras
    controlnet: controlnet

Step 5: Manage instance lifecycle to optimize costs

To avoid paying for unutilized compute hours when you finish generating images:[source]

  1. Stop the Pod: Stopping the instance releases the physical GPU back to the pool and halts hourly compute billing.[source] You pay only a minimal monthly storage fee for the data retained on your network volume.[source]
  2. Resume the Pod: When you return, launch a new pod in the same data center region and re-attach your existing network volume. All your custom nodes, workflows, and checkpoints remain intact.[source]
  3. Terminate: Terminate the pod and delete the volume only when you want to permanently discard the environment and remove all stored data.[source]

For broader cost optimization strategies across spot instances and autoscaling, read our comprehensive how to optimize GPU cloud costs guide and review our best GPU cloud for Stable Diffusion roundup.

Serverless execution for production diffusion APIs

If you are building an automated application (such as a SaaS image generator, Discord bot, or mobile app) rather than using a manual browser UI, running a continuous persistent GPU pod creates idle cost waste.[source]

Serverless GPU platforms allow executing ComfyUI workflows headlessly via JSON API calls with per-second billing and scale-to-zero automation.[source]

Hosting Approach User Interface & Access Billing Architecture Ideal Production Use Case
Persistent Pods Interactive WebUI (ComfyUI / A1111) Flat continuous hourly rental Prompt engineering, manual workflow design, and digital art R&D[source]
Serverless Endpoints Programmatic REST / JSON API Per-second execution rate (Scale to Zero) Customer-facing SaaS apps, Discord bots, and automated pipelines[source]

To evaluate top serverless options and compute breakeven economics, review our comparison of the best serverless GPU cloud platforms and check our RunPod review.

Troubleshooting common cloud setup mistakes

1. Bad Gateway (502) on web interface port

  • Cause: The container was launched, but ComfyUI or Automatic1111 is still downloading initial dependencies or compiling Python packages.[source]
  • Resolution: Open the pod container logs or Jupyter Lab terminal. Wait two to three minutes until the log outputs confirmation that the HTTP server is listening on port 8188.[source]

2. CUDA out of memory (OOM) errors during generation

  • Cause: The diffusion model checkpoint, text encoder, or latent upscaling resolution exceeds the physical VRAM capacity of the GPU.[source]
  • Resolution: Enable FP8 precision weights or launch ComfyUI with the --lowvram or --gpu-only optimization flags.[source] For 1024x1024 base generations with high-step upscalers, upgrade from a 16 GB card to a 24 GB RTX 4090 or 48 GB L40S instance.[source]

3. Missing checkpoints after pod restart

  • Cause: Model checkpoints were saved to the ephemeral root container disk (/workspace or /root) rather than the attached network volume mount directory.[source]
  • Resolution: Always verify that your download scripts write directly into your persistent storage path (such as /runpod-volume).[source]

For detailed information on our research standards, sourcing policies, and data validation rules, review the GPU Picks methodology.

Frequently asked questions

How much does it cost to run Stable Diffusion in the cloud?

Hourly rates depend on the GPU tier and deployment model.[source] An NVIDIA RTX 4090 with 24 GB VRAM typically rents on community and cloud platforms for modest hourly rates, while serverless endpoints bill strictly per second for active rendering time.[source][source] You can compare current rates across verified providers in our GPU lookup tool.

Which cloud GPU is best for Stable Diffusion and FLUX.1?

The NVIDIA RTX 4090 with 24 GB VRAM is the standard recommendation for Stable Diffusion XL and FLUX.1 Dev.[source] It provides high tensor compute performance and sufficient memory to load FP16 or FP8 checkpoints alongside text encoders without running into out of memory errors.[source]

Will my models be deleted when I stop my cloud GPU pod?

No, your models and custom nodes will not be deleted if they are stored on an attached persistent network volume.[source] Stopping the instance releases the physical GPU and halts compute billing while preserving your stored files for future sessions.[source] Files stored on the ephemeral container disk, however, are wiped upon termination.[source]

Can I use custom ComfyUI nodes on cloud GPU providers?

Yes, pre-configured cloud templates provide full root terminal access and Jupyter Lab support.[source] You can install ComfyUI Manager, clone Git repositories into your custom nodes directory, and install Python requirements directly inside the container.[source]

What is the difference between running ComfyUI on a persistent pod versus serverless?

A persistent pod runs a continuous web browser interface with flat hourly billing, making it ideal for interactive prompt tuning, workflow experimentation, and digital art generation.[source] Serverless endpoints execute workflows programmatically via API calls with per-second billing and automatic scale-to-zero capabilities, making them optimal for production applications.[source]

Sources

  1. RunPod ComfyUI Deployment and HTTP Proxy Guide (opens in a new tab) , RunPod primary Accessed August 14, 2026
  2. RunPod Network Volumes and Persistent Storage Architecture (opens in a new tab) , RunPod primary Accessed August 14, 2026
  3. ComfyUI Official GitHub Repository and CLI Configuration (opens in a new tab) , Comfy Org primary Accessed August 14, 2026
  4. Vast.ai Cloud GPU Instance Templates and Docker Deployment (opens in a new tab) , Vast.ai primary Accessed August 14, 2026
  5. TensorDock Virtual Machine Deployment and Port Forwarding (opens in a new tab) , TensorDock primary Accessed August 14, 2026

Reviewed and edited by Ahmad Nugraha