Deploy Stable Diffusion WebUI on Alibaba Cloud Function Compute in One Command

This guide walks you through deploying the open‑source Stable Diffusion WebUI on Alibaba Cloud Function Compute using Serverless Devs, covering prerequisites, a single‑line deployment command, configuration details, access URL, and practical tips for handling GPU rendering and cold‑start latency.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
Deploy Stable Diffusion WebUI on Alibaba Cloud Function Compute in One Command

Prerequisites

Alibaba Cloud account with Function Compute (FC) enabled.

Container Registry (ACR) service activated.

Serverless Devs CLI installed locally.

Alibaba Cloud access keys configured for Serverless Devs.

One‑Line Deployment

Create a local directory (e.g., stable-diffusion) and add a s.yaml file with the following content:

edition: 1.0.0
name: fc-stable-diffusion
access: default
services:
  cn-shanghai-stable-diffusion-sd:
    component: devsapp/fc
    props:
      region: cn-shanghai
      service:
        description: stable-diffusion部署到函数计算
        internetAccess: true
        name: stable-diffusion
      function:
        handler: index.handler
        timeout: 600
        diskSize: 10240
        caPort: 7860
        instanceType: fc.gpu.tesla.1
        runtime: custom-container
        cpu: 8
        memorySize: 32768
        gpuMemorySize: 16384
        name: sd
        customContainerConfig:
          image: registry.cn-shanghai.aliyuncs.com/vipas/stable-diffusion-web:v2
          accelerationType: Default
          webServerMode: true
        triggers:
          - name: defaultTrigger
            type: http
            qualifier: LATEST
            config:
              methods: [GET, POST, PUT, DELETE]
              authType: anonymous
              disableURLInternet: false
        customDomains:
          - domainName: auto
            protocol: HTTP
            routeConfigs:
              - path: /*

Deploy Command

s deploy

Accessing the Service

After the deployment finishes (cold‑start includes pulling the container image), FC returns an HTTP endpoint similar to:

http://sd.stable-diffusion.xxxxxx.cn-shanghai.fc.devsapp.net

Replace xxxxxx with your own account UID. Opening the URL loads the Stable Diffusion WebUI where prompts can be entered to generate images.

Reference Repository

Stable Diffusion WebUI source: https://github.com/AUTOMATIC1111/stable-diffusion-webui

Limitations and Next Steps

The provided container image contains only the base model. Adding additional models requires rebuilding the image.

Cold‑start latency is typically 3–4 minutes because the container image must be pulled and the GPU runtime initialized.

Future improvements may include dynamic model loading, image‑layer caching, and techniques to reduce startup time.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud NativeServerlessStable DiffusionAI deploymentGPUFunction Compute
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.