Skip to content

ScienceCloud Training

🔧 Under Development

This page is under active development. Content is being updated as we prepare the new version of ScienceCloud for production. Some sections may be incomplete or subject to change.

The training program targets both ScienceCloud end-users like researchers as well as IT coordinators that provide services to their respective groups.

The program will cover a broad range of topics starting from the very basic introduction to ScienceCloud to a more complex and advanced use of the infrastructure.

As the number of attendees is limited, we recommend that you register well before the event. More information about the ScienceCloud training, including registration, can be found at this page.

If you would like a specific topic to be discussed and presented in one of our next training events, please contact Science IT.


Prepare for the Training

There are a few steps that every user must take before attending the Science IT training events. As such, please follow the instructions:


1. Verify access to ScienceCloud

As most of the training will be run on ScienceCloud, it is important that you have a valid access to the ScienceCloud Web Interface and to UZH internal network. To be authenticated in the ScienceCloud dashboard and APIs you muse use your USH shortname and "WEBPASS" credentials. In order to connect to ScienceCloud virtual machines used during the training you will need to be connected to a UZH network.

Connecting Off-Campus

If you plan to connect from outside UZH then you need to use the UZH VPN. Without the VPN you will not be able to connect to the virtual machines used in the training.


Please verify your credentials before the training begins:

  • Log in to https://identity.uzh.ch using your UZH full-name and password
  • You can manage the password for WEBPASS and/or VPN using the "change password" section
  • Once you are in the "Change Password" section, select only the password(s) you need to manage and submit the change password form

If you do not have access to ScienceCloud it will not be possible to login to the ScienceCloud dashboard.

More information on UZH credentials can be found here.

In case of trouble you can open a ticket at the UZH Self Service Portal.


2. Setup your work station

On the computer you will be using for the training (either your personal laptop or a campus workstation) you need to start:

  • A web browser
  • A local terminal / command line application
  • A UZH VPN connection if working remotely

3. Setup your SSH keypair before the course

Before the course you need to create an SSH keypair on the computer you will use for the training. Detailed instructions on generating SSH keys can be found here.


Introduction to ScienceCloud


Hands-on Exercises

1. Sign up for ScienceCloud

  • Get in touch with Science IT.

  • Has your user account been activated?

    • Open a web browser and go to https://cloud.science-it.uzh.ch (Javascript and cookies must be enabled).

    • Log in with your UZH webpass (the usual shortname and password).

Further info:

If you have signed up for the ScienceCloud Base training but are not part of any other ScienceCloud projects yet, the credentials will not work because your user account is not yet active. At the beginning of the training session, you will be added to the training project thus activating the user account.


2. Get access to your instances

An SSH key is required to login to your newly created instances. If you are unfamiliar with SSH keys, or if you need to create a new pair specifically for this training, you can follow the instructions here.

Once the generation process is complete, you can upload the SSH public key to ScienceCloud by following these steps:

  1. Log in to https://cloud.science-it.uzh.ch; ensure "UZH" is selected as the "Domain".
  2. From the main Project tab look under the Compute dropdown and click on the Key Pairs subpage, which shows the key pairs that are available for your project.
  3. Select Import Public Key and input your desired Key Pair Name; it's often recommended to use your UZH shortname on your primary device or another identifier that other project members will recognize as yours.
  4. Select "SSH Key" as the "Key Type", paste the content of your SSH public key in the Public Key text section, and click "Import Public Key".

For reference, your SSH public key will look something like:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBaVb7jqPwhxFvY8ZcZ4OQ8F0o9yNfP2t9JH6Jt0O2n7 user@host

On Linux/Mac/Windows10 the SSH public key is saved in a file named id_ed25519.pub by default (using our recommended key type) or another name that you inputted during the creation process; its default location is the ~/.ssh directory, but it is possible to create keys in different locations. You can confirm its creation by using the ls .ssh command from your home directory (~). To display its content so you can copy it into ScienceCloud use cat ~/.ssh/id_ed25519.pub.

More information about SSH keys can be found here.


3. Launch an instance

  1. Log in to https://cloud.science-it.uzh.ch; ensure "UZH" is selected as the "Domain".

  2. From the main Project tab look under the Compute dropdown and click on the Images subpage, which shows all of your available images when creating a VM instance.

  3. For the scope of the training look for the latest Ubuntu version. You can spot it as the name starts with '***' and it shows the highest distribution version and the latest build date; e.g., " ***Ubuntu 22.04 (2024-05-29) ". A complete list of the supported public images can be found at: Supported Images.

  4. Click Launch Instance.

  5. In the Launch Instance window specify the following values:

    1. Instance Name: Assign a name to the virtual machine.
    2. Instance Count: Optionally altered; used to launch multiple instances.
    3. From the Flavor tab: Specify the size of the instance to launch by clicking the corresponding + button. Check the flavors page for detailed information.
    4. Networks: Unless you have arranged for a public IP address, click the "↑" to select the uzh-only network.
    5. Key Pair: Check that your key pair is added to the instance.

Congratulation you've just launched your first instance on ScienceCloud!

Further info: If your instance does not launch correctly and ends up in an "error" status, you might want to check if the flavor is available on the ScienceCloud flavor availability report(which requires internal network or VPN). If the flavor is not available, delete the VM and try again with an available flavor.


4. Login to your instance

On Linux/Mac/Windows10 run SSH in terminal

The long way:

ssh -i ~/.ssh/id_ed25519 ubuntu@<your-instance-ip-address>
If you didn't use the default key pair name, then replace "id_ed25519" with the path of the private key.

One often used way to simplify ssh connections is to add the key to the ssh-agent, which provides you with streamlined ways to use your ssh key pair—e.g., to avoid inserting the passphrase of the private key each time you open a new connection.

To add a key pair to the ssh-agent on your machine run:

ssh-add <path-to-id_ed25519_rsa>
Finaly, obtain the instance IP address from the ScienceCloud dashboard and insert it here:
ssh ubuntu@<your-instance-ip-address>

Further info: Regarding usernames: The convention for default operating system usernames on ScienceCloud public images is straightforward: the username matches the distribution name; i.e., every flavor of Ubuntu has username "ubuntu", Debian distributions have "debian", CentOS has "centos", and so on.

See here for more information.


5. Install packages on a Debian/Ubuntu instance

Here are the steps to install a new software package or upgrade existing software packages on a Debian/Ubuntu system.

  • Before any updates or installations, update the list of packages known by your system using:
sudo apt update
  • To upgrade all the packages on your system (without installing extra packages or removing packages) run:
sudo apt upgrade

Hint

The upgrade process will eventually pause to request user input; for example, asking if you want to keep or replace a configuration file changed locally on the machine. In these cases, the right choice would be to keep the locally modified file, which is the default. In general it is correct and safe to choose the default option when prompted. This behavior can be chosen automatically by adding the "-y" argument to the upgrade command.


  • To install a package and all its dependencies on Ubuntu,
# If you are not sure about the package name or version,
# try to run a quick search on your repository using:
apt-cache search package_name
# Then install (e.g., `r-base`) using:
sudo apt install r-base
  • To remove a package from your system run:
sudo apt remove r-base

6. Attach a volume to the Instance

Create a volume

  1. Log in to https://cloud.science-it.uzh.ch; ensure "UZH" is selected as the "Domain".
  2. From the main Project tab look under the Volumes dropdown and click on the Volumes subpage.
  3. Click the "Create Volume" button.
  4. Specify Volume Name and Volume Size (in GiB).
  5. Press "Create Volume".

Attach Volume

To then use the volume, you must attach it to your VM of interest:

  1. From Volumes subpage, locate your volume in the dashboard.
  2. From drop-down arrow for your volume (next to Edit volume) click Manage attachments.
  3. From Attach to instance list choose your VM instance of interest for the volume.
  4. Press "Attach Volume".

Format and mount the volume

Once a volume is attached to a VM it becomes visible to the operating system but it is still in a "blank state". To make it useable, you need to identify and format it using the following steps:

Danger

⚠️ The format operation (step 2) should be performed only once when the volume is attached for the first time. Otherwise, the volume's data will be completely wiped!


  1. Get the name of the block device assigned to your volume: select in the Volume subpage dashboard look under the "Attached To" column for entries like /dev/vd<LETTER> or /dev/sd<LETTER> (where <LETTER> is a lowercase latin letter like a, b, etc.) You can also list all block devices attached to the VM instance by running the following command from your VM:
    lsblk
    
  2. ⚠️ Format your new disk into ext4 (recommended FS). See the "Danger" note above before running this command and change the device name accordingly.
    sudo mkfs.ext4 /dev/vd<LETTER>
    
  3. Using the same name of the block device your volume is assigned, mount the volume to a particular path (in this case /mnt) on your VM's filesystem:
sudo mount /dev/vd<LETTER> /mnt

  1. Check if the volume mounted correctly (you should see the block device name and mount path in the output):
    df -h
    
  2. Lastly, set the ownership of mounted volume to allow the ubuntu user read/write privileges (otherwise permissions will not operate correctly):
sudo chown -R ubuntu:ubuntu /mnt 

7. Copy data to your instance (and back)

On Linux/Mac/Windows10

Open a terminal on your machine and use scp.

Note

You must scp (or any other file transfer tool) from the machine where you have access to both the source file and the destination location.

Upload:

# Copy an example file "foo.txt" from
# your present working directory (on your local machine)
# to the `ubuntu` home directory
scp foo.txt ubuntu@<your-instance-ip-address>:~

Download:

# Copy an example file "foo.txt" from
# the `ubuntu` home directory to
# your present working directory (on your local machine) 
scp ubuntu@<your-instance-ip-address>:~/foo.txt ./

Further info: You might need to add the -i PATH_TO_YOUR_PRIVATE_KEY option if you have your key saved in a non-standard location and you have not added it yet with ssh-add.


Using FileZilla software

  1. Download FileZilla from here and install it.
  2. From the "File" menu select Site Manager; you can also press Ctrl+S or Command+S.
  3. Select New Site.
  4. Specify the "Host" as instance IP address.
  5. The "Port" input should only be necessary if you're performing a more custom procedure.
  6. The "Protocol" should be "SFTP - SSH File Transfer Protocol".
  7. For "Logon Type" choose "Key file".
  8. For "User" specify the username you when connecting (e.g., ubuntu).
  9. For "Key file" browse and select your private key file; it may prompt you to convert the key to an accepted format (see the note below).
  10. Finally, click the Connect button.
  11. Verify the host key fingerprints when prompted.
  12. Drag & drop files from your local machine to the instance using the paralell filesystem views.

Note

If your private key is in a default / .pem format, a new message will pop up to convert your key into .ppk which is supported by FileZilla. You can confirm this by clicking "Yes".

Warning

⚠️ Due to reported cases of malware being bundled with FileZilla software installers, only use the official FileZilla Project link above for downloading and installing FileZilla. Specifically: do not install FileZilla from an installer that contains the word "bundle" in its name.


8. Snapshot

Snapshots are a feature that allows users to capture an instance setup for future reuse. These snapshots are "disk-only" snapshots.

Create a snapshot

  1. Log in to https://cloud.science-it.uzh.ch; ensure "UZH" is selected as the "Domain".
  2. From the main Project tab look under the Compute dropdown and click on the Instances subpage.
  3. Select the instance you want to snapshot.
  4. Recommended: shut off the instance if possible (via the dropdown action menu) before snapshotting.
  5. Click on the "Create Snapshot" button for your VM instance of interest in the dashboard.
  6. Input a name for your snapshot when prompted then press Create Snapshot.
  7. Once the process has completed, the new snapshot will be displayed in the Images subpage.

Fit-for-a-purpose-snapshots/images: If you would like to have several pre-configured snapshots or images (i.e., VMs ready for a certain purpose), we encourage you to briefly contact us. We frequently have/had similar cases and may be able to simplify your task.


9. Protect your instance

You can prevent accidental instance(s) deletion by "locking" your instance. The relevant option can be found in the dropdown menu right next to your instance name in the Instances subpage.

Note

If you lock an instance no actions are possible on it. The error messages you will receive when trying are really generic, so do remember which instance you lock or try to unlock them from that same menu in case you notice some inexplicable behaviour.


10 Access specific ports on your VM

By default the only incoming connections allowed to your VM are via SSH. If you need to access different ports or services running on your VM like a webserver (i.e., open ports 80 and possibly 443) you need to follow these steps:

Create security group

  1. Log in to https://cloud.science-it.uzh.ch; ensure "UZH" is selected as the "Domain".
  2. From the main Project tab look under the Network dropdown and click on the Security Groups subpage.
  3. Click the "Create Security Group" button.
  4. Choose the Security Group Name and click Create Security Group.
  5. Click the Manage rules button corresponding to your security group of interest.
  6. Add a rule of your choice; for example, port 80 (for http traffic).

Apply a security group to a running virtual machine

  1. Log in to https://cloud.science-it.uzh.ch; ensure "UZH" is selected as the "Domain".
  2. From the main Project tab look under the Compute dropdown and click on the Instances subpage.
  3. Open the drop down menu next to your VM instane of interest and click "Edit Security Groups".
  4. Enable the newly created security group by clicking on the + sign next to the security group name.

Note

There is no reason to remove the default security group from your instance but if you decide to do so make sure you have all the rules you need in the newly created/selected security group.


Further topics

You can refer to the ScienceCloud User Guide for more information about the ScienceCloud architecture and as a segue to other documentation pages.

To get additional support you can always contact Science IT.