ucloud-docs/Userguide.md

2.9 KiB

ucloud User Guide

Pre-requisite

  1. You need to have an Account at accounts.ungleich.ch. If you don't have it create one.

  2. Login and click on SHOW SEEDS button. On the next page it will show you your seed mentioned next to your user realm.

Installation

To install ucloud-cli you need to execute the following commands. Make sure you have Python 3.7 and pipenv installed.

  1. Clone ucloud-cli git repository. ucloud-cli is needed to talk with ucloud backend i.e create/delete/start/stop VM, attach network to VM etc.

    git clone https://code.ungleich.ch/ungleich-public/ucloud-cli.git
    
  2. Change your directory to recently cloned repository.

    cd ucloud-cli
    
  3. Install dependencies of ucloud-cli

    pipenv install
    
  4. Activate ucloud-cli

    pipenv shell
    
  5. Run the following command to ensure that you have successfully installed ucloud-cli

    python ucloud.py
    

    If the output looks somewhat similar to this then you have successfully installed ucloud-cli

    Usage: ucloud.py [OPTIONS] COMMAND [ARGS]...
    
    Options:
    --help  Show this message and exit.
    
    Commands:
    host
    image
    user
    vm
    

Examples

Create VM

  1. Create a file name specs.json and put your required VM's specification in it. Save it in ucloud-cli directory. A sample is given below.

    {
        "cpu": 2,
        "ram": "2GB",
        "hdd": "10GB"
    }
    
  2. Find out which image you want to use by running the following command. Image means the Operating System which you want to use in your VM.

    python ucloud.py image list --public
    

    It will show list of available images. Sample output

    {
        "253286ee-5a74-4747-808d-e47d7c3ce4ed": {
            "filename": "alpine.qcow2",
            "name": "alpine",
            "owner": "ahmedbilal-admin",
            "status": "CREATED",
            "store_name": "images",
            "visibility": "public"
        },
        "1245856ee-2345-4747-56798-ejdf72394d": {
            "filename": "devuan.qcow2",
            "name": "devuan",
            "owner": "ahmedbilal-admin",
            "status": "CREATED",
            "store_name": "images",
            "visibility": "public"
        }
    }
    
  3. Suppose, we want to create our VM with alpine Image. So, we would use uuid of alpine linux i.e 253286ee-5a74-4747-808d-e47d7c3ce4ed.

  4. Run the following command to create your VM.

    python ucloud vm create --name {YOUR_USERNAME} --realm {YOUR_REALM} --seed {YOUR_SEED} --specs specs.json --image_uuid 253286ee-5a74-4747-808d-e47d7c3ce4ed
    

    It will show something like the following

    {
        "message": "VM Creation Queued"
    }