Go back

Setup and installation of 'Comfy UI: Stable Diffusion AI Image Generation Made Simple' on AWS

This section describes how to launch and connect to Comfy UI: Stable Diffusion AI Image Generation Made Simple on Amazon Web Services (AWS).

  1. Open Comfy UI: Stable Diffusion AI Image Generation Made Simple VM listing on AWS marketplace

/img/aws/comfyui-vm/marketplace.png

  1. Click on Continue to subscribe.
  • Login with your credentials and follow the instruction.
  • Subscribe to the product and click on Continue to configuration button.
  • Select a Region where you want to launch the VM(such as US East (N.Virginia))

/img/aws/comfyui-vm/region.png

  • Click on Continue to Launch Button.
  • Choose Action: You can launch it through EC2 or from Website.(Let’s choose Launch from website)
  • Optionally change the EC2 instance type. This defaults to t2.xlarge instance type, 4 vCPUs and 16 GB RAM.
  • For optimal performance, Stable Diffusion requires significant processing power, which is best achieved with a GPU instance. However, if the cost of a GPU instance is prohibitive, a CPU instance with higher processing capacity may be used as an alternative.

Below are the recommended VM configuration:

  • GPU VM : g4dn.xlarge (4 vcpu 16gb memory, 1 NVIDIA GPU) configuration
  • CPU VM : t2.xlarge (4vcpu, 16gb ram)

For CPU, its the minimum spec but more cpu is preferred.

NOTE: While deploying the instance on GPU, if you encounter the quota exhaust error or you are unable to deploy the instance on GPU VM then please refer to our Request Quota on AWS Cloud Platform

/img/aws/comfyui-vm/launch.png

/img/aws/comfyui-vm/launch-gpu.png

  • Select the VPC and Subnet from the dropdown.

/img/aws/stable-diffusion/vpc.png

  • Create the Security Group based on default configuration which comes with the ports 22 (for SSH), 3389 (for RDP) and 443 (for HTTPS) exposed. Click on Create New based on Seller Settings.

    /img/aws/stable-diffusion/create-new-sg.png

  • Provide the Security group name and description. Save the changes.

    /img/aws/comfyui-vm/SG.png

  • Be sure to download the key-pair which is available by default, or you can create the new key-pair and download it.

    /img/aws/stable-diffusion/key-pair.png

  • Click on Launch when you are ready.

  • Comfy UI: Stable Diffusion AI Image Generation Made Simple will begin deploying.

  1. A summary page displays.To see this instance on EC2 Console click on EC2 Console link.

/img/aws/comfyui-vm/deployed.png

  1. To access the ComfyUI web interface, copy the public ip of the vm from VM’s details page and paste it in the browser using https://VM_Public_IP. Make sure to use https and not http.

/img/aws/comfyui-vm/public-ip.png

Browser will display a SSL certificate warning message. Accept the certificate warning and Continue.

/img/azure/comfyui-vm/browser-warning.png

By default, the ComfyUI’s default workflow will be automatically loaded after the start, as shown in the figure below.

/img/azure/comfyui-vm/comfyui.png

If the interface is blank or the default workflow is not loaded, please click on the Load default / Load default in the right corner menu to load the default workflow.

/img/azure/comfyui-vm/load-default.png

  1. Now you are connected to Comfy UI. By default the VM comes with SDXL Base 1.0 checkpoint model to get you started with the comfy UI.

/img/azure/comfyui-vm/sdxl-checkpoint.png

  1. To get started, provide the prompt in the Clip Text Encode (prompt) box with any extra condition in the below prompt box. Give the size of the image and the batch count. Provide other settings in Sampler.

/img/azure/comfyui-vm/prompt-settings.png

  1. Once you are ready to create your image, simply press Queue Prompt from right settings pane and watch your image getting generated.

Note: GPU instances generate images 10 times faster or more compared to CPU instances. Therefore, if you’re using a CPU instance, expect the process to take 10-15 minutes longer to complete.

/img/azure/comfyui-vm/queue-prompt.png

  1. You can check the extra options from the options given below the Queue Prompt button. Like history, view queue etc.

/img/azure/comfyui-vm/extra-options.png

  1. The images created from ComfyUI are stored under /home/ubuntu/setup/ComfyUI/output/ directory on the VM. To access this directory, follow below steps:

/img/azure/comfyui-vm/comfyui-output-directory.png

  1. To access the VM’s Desktop environment, first you need to SSH to this instance through putty. For that, copy the IPv4 Public IP Address

/img/aws/comfyui-vm/public-ip.png

  1. Open putty, paste the IP address and browse your private key you downloaded while deploying the VM, by going to SSH->Auth->Credentials, click on Open. In the terminal enter ubuntu as userid and hit enter.

/img/aws/desktop-linux/putty-01.png

/img/aws/nvidia-aiml/putty-02.png

/img/aws/comfyui-vm/ssh-login.png

  1. Once connected, change the password for ubuntu user using below command
sudo passwd ubuntu

/img/aws/stable-diffusion/ssh-login.png

  1. Now the password for ubuntu user is set, you can connect to the VM’s desktop environment from any local Windows Machine using RDP protocol or Linux Machine using Remmina.

    From your local windows machine, goto “start” menu, in the search box type and select “Remote desktop connection”. In the “Remote Desktop connection” wizard, copy the public IP address and click connect

/img/aws/desktop-linux/rdp.png

  1. This will connect you to the VM’s desktop environment. Provide the username ubuntu and the password set in the above “Reset password” step to authenticate. Click OK

/img/aws/stable-diffusion/rdp-login.png

  1. Now you are connected to the out of box Comfy UI: Stable Diffusion AI Image Generation Made Simple environment via Windows Machine.

/img/aws/comfyui-vm/rdp-desktop.png

  1. To connect using RDP via Linux machine, first note the external IP of the VM from VM details page,then from your local Linux machine, goto menu, in the search box type and select “Remmina”.

Note: If you don’t have Remmina installed on your Linux machine, first Install Remmina as per your linux distribution.

/img/gcp/common/remmina-search.png

  1. In the “Remmina Remote Desktop Client” wizard, select the RDP option from dropdown and paste the external ip and click enter.

/img/gcp/common/remmina-external-ip.png

  1. This will connect you to the VM’s desktop environment. Provide ubuntu as the userid and the password set in above reset password step to authenticate. Click OK

/img/gcp/common/remmina-rdp-login.png

  1. Now you are connected to out of box Comfy UI: Stable Diffusion AI Image Generation Made Simple environment via Linux machine.

/img/aws/comfyui-vm/rdp-desktop.png

  1. From VM’s Desktop, you can access the Output Images by navigating to /home/ubuntu/setup/ComfyUI/output/ directory.

/img/azure/comfyui-vm/comfyui-output-directory.png

Please refer to How to download and use custom models page for more details on using additional models with this VM.

For more information, please visit ComfyUI Official Documentation

Go back