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
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:
- Navigate to the storage management section of your cloud provider console (such as RunPod Storage or Vast.ai persistent volumes).[source][source]
- Select your preferred data center region (for example, US-East, US-West, or EU-Central).[source]
- Allocate sufficient disk capacity. A base allocation of 50 GB to 100 GB accommodates base checkpoints, LoRA adapters, control nets, and output directories.[source]
- Note the mount path assigned to the volume (commonly
/runpod-volumeor/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]
- 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]
- Choose a verified container template:
- Attach your persistent network volume created in Step 1 to the deployment configuration.[source]
- 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]
- Locate the Connect or HTTP Services button on your active instance card in the dashboard.[source]
- Click the port link corresponding to your web interface:
- If connecting via direct SSH or TensorDock virtual machines, establish an SSH local port forwarding tunnel:[source]
Then openBASH
ssh -L 8188:127.0.0.1:8188 root@<INSTANCE_IP> -p <SSH_PORT>http://127.0.0.1:8188in 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]
# 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]
runpod_storage:
base_path: /runpod-volume/models
checkpoints: checkpoints
clip: clip
vae: vae
loras: loras
controlnet: controlnetStep 5: Manage instance lifecycle to optimize costs
To avoid paying for unutilized compute hours when you finish generating images:[source]
- 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]
- 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]
- 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
--lowvramor--gpu-onlyoptimization 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 (
/workspaceor/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?
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?
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]