PRODUCTS AND SUPPORT


How to get Techlatest Stable Diffusion on AWS




This section describes how to launch and connect to Techlatest Stable Diffusion on Amazon Web Services (AWS).


    Note: Stable diffusion requires a lot of processing, so a GPU instance is recommended. If a user wants to use a CPU instance due to the high price of GPU instances, they should use instances with a higher CPU.
    GPU's are not available in some zones and for some instance types.

    Below are recommended VM configuration requirements:

    • GPU VM : g4dn.xlarge (4 vcpu 16gb memory) configuration
    • CPU VM : t2.xlarge (4vcpu, 16gb ram)
    • For CPU, its the minimum spec but more cpu is preferred.

    Note: GPU instance will perform 10 times or more faster when processing request compared to CPU instance . Typical GPU instance will take 1-2 minutes to render images compared to 10-20 minutes by CPU instance, hence GPU instances are preferred.

    1. Open Stable Diffusion VM listing on AWS marketplace

    2. /img/aws/stable-diffusion/marketplace.png

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

      • /img/aws/stable-diffusion/region.png

      • Choose Action: You can launch it through EC2 or from Website.(Let's choose Launch from website)

      • /img/aws/stable-diffusion/launch.png

      • Optionally change the EC2 instance type. (This defaults to t2.medium instance type, 4 vCPUs and 16 GB RAM.)

      • Optionally change the network name and subnetwork names.

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

      • Select the Security Group. Be sure that whichever Security Group you specify have ports 22 (for SSH), 3389 (for RDP) and 80 (for HTTP) exposed.
      • 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/SG.png

      • Click on Launch..
        Stable Diffusion will begin deploying.
    1. A summary page displays.To see this instance on EC2 Console click on EC2 Console link.

    2. /img/aws/stable-diffusion/deployed.png

    3. On the EC2 Console page, instance is up and running. To connect to this instance through putty, copy the IPv4 Public IP Address

    4. /img/aws/stable-diffusion/public-ip.png

    5. Open putty, paste the IP address and browse your private key you downloaded while deploying the VM, by going to SSH->Auth , click on Open. Enter ubuntu as userid

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

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

    7. Once connected, change the password for ubuntu user using below command

    8. sudo passwd ubuntu

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

    9. 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

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

    11. This will connect you to the VM's desktop environment. Provide the username (e.g "ubuntu") and the password set in the above "Reset password" step to authenticate. Click OK

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

    13. Now you are connected to the out of box Stable Diffusion environment via Windows Machine.

    14. /img/aws/stable-diffusion/rdp-desktop.png

    15. 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.


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

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

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

    19. 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

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

    21. Now you are connected to out of box Stable Diffusion environment via Linux machine.

    22. /img/aws/stable-diffusion/rdp-desktop.png

    1. To access the Stable Diffusion GUI via browser, Copy the public IP of the vm in the browser and hit enter.
    2. Note: Please use http and not https in the URL.
      Please Note that for the first time, it will take 2-3 minutes to launch the app in the browser. So if GUI is not coming please try after few minutes.

      Note: CPU instances take time to launch the Web UI. To verify if Stable Diffusion Web UI is launched, Please run below command in the terminal.
      curl http://127.0.0.1:7860
      If the output returns curl: (7) Failed to connect to 127.0.0.1 port 7860: Connection refused as shown below , then keep running above curl command till html output is found.

      /img/aws/stable-diffusion/failed-curl-output.png

      If this command returns html data as shown below, then Web UI is up and running.

      /img/aws/stable-diffusion/success-curl-output.png

      /img/azure/stable-diffusion/stable-diffusion-gui-homepage.png

    3. The Stable Diffusion GUI comes with lots of options and settings. The first window shows text to image page. Provide the Prompt and click on Generate button and wait till it finishes.

    4. /img/azure/stable-diffusion/stable-diffusion-gui.png

    5. Output Images can be seen in the Image Browser tab. Click on Image browser and click on first page to load the images.

    6. /img/azure/stable-diffusion/image-browser-gallery.png

    7. In Image Browser, click on any image to see the details of it.

    8. /img/azure/stable-diffusion/image-browser.png

    9. To change any settings, go to Settings tab.

    10. /img/azure/stable-diffusion/settings.png

    11. Web UI also provides you the option to add extensions. Navigate to extensions tab, go to available and select load from URL. It will list all the available extensions.

    12. /img/azure/stable-diffusion/extensions.png

    13. For more information on how to use the GUI, Go to Stable Diffusion Web UI
    14. The images created from GUI are stored under /home/ubuntu/setup/stable-diffusion/output directory.
      To access this directory, connect to VM's Desktop environment as explained above, and navigate to home -> ubuntu -> stable-diffusion -> output directory.

    15. /img/aws/stable-diffusion/output-location.png

    16. You can also access the sourcecode of the Stable Diffusion. It is available under sourcecode folder on Desktop.

    17. /img/gcp/stable-diffusion/source-code-folder-on-desktop.png

      /img/aws/stable-diffusion/sourcecode-folder.png

      Credits: