Setting up your first virtual machine
Create your first instance in CSC cPouta. This guide walks you through generating an SSH key, assigning it to your instance, creating a security group with rules for SSH, HTTP and HTTPS, assigning a floating IP and connecting to your new machine with SSH
NOTE: If this guide is not working for you or feels outdated, please refer to the official CSC documentation on creating a virtual machine
Prerequisites#
- PuTTY (Windows) or Terminal (Linux/macOS)
- CSC project (Create new project and enable cPouta)
- cPouta (Login when cPouta is enabled and active)
Instructions for installing virtual machine(s) in cPouta#
Here is what we will do:
- Generate an SSH key and add it to our cPouta account. You can only login to your virtual machine using SSH keys, password based login is not supported. Adding an SSH key is an important step when creating your virtual machine. If you forget assigning an SSH key to your virtual machine during instance creation, you will not be able to access the machine. If that happens, destroy and re-create the entire instance.
- Create a virtual machine
- Associate a floating IP to the machine. By default, your machine gets a private (localhost) IP address. We need a public IP address so that the machine is publicly accessible, otherwise you can not connect to it via SSH
- Create a new security group, enable port 22 for SSH connections and ports 80 and 443 for HTTP and HTTPS, and assign our virtual machine to this security group
1. Generating SSH keys using PuTTYgen and importing the public key to cPouta#
Open the PuTTY Key Generator and select Key -> Parameters for saving key files.

The PPK file version is set to 3 by default, and it should work with the Rocky Linux distribution we are using. If it doesn't work, change the version to 2 and create a new key with that setting.

Generate a public/private key pair and add a passphrase. Feel free to change the Key comment line to, for example, a description of the device this key belongs to, like laptop or desktop, if you want to. Copy the public key to your clipboard and save the private key.
NOTE: Depending on the encryption system used, the public key can be rather long. Make sure to copy the whole thing, it ends with the same comment that's written on the Key comment section!

In cPouta, go to Compute -> Key Pairs and select Import Public Key.

Give the key pair a name, select the key type (SSH Key), and paste the public key from your clipboard into the public key field.
NOTE: If you are using multiple keys across multiple devices, it is advisable to give the key pair a recognizable name so you know what device it belongs to.

2. Creating a security group in cPouta#
cPouta already has a Default security group, but it is a good practice not to edit it. Instead, you need to create a new one. Go to Network -> Security Groups and select Create Security Group, give it a name and click Create Security Group.

Next, select Manage Rules on the security group you just created, it opens up a following page. Select Add Rule.

From the Rule dropdown menu, select SSH and click on Add.

This creates an ingress rule for port 22 (SSH). Do the same task for HTTP and HTTPS. After adding all three rules, the Manage Rules page should look like this:

With that, you have successfully created a new security group with rules for inbound SSH, HTTP and HTTPS requests. Remember to select it in upcoming setups.
3. Create a virtual machine#
Head over to Rocky Linux downloads and download the latest cloud image (QCOW2).

After the download has completed, head over to Compute -> Images and select Create Image.

Give the image a name, select the QCOW2 image you downloaded, select the correct format and finally click on Create Image. This process might take a minute or two to finish.

After the process has completed, you should be able to find the new Rocky Linux image listed in Compute -> Images. Click on Launch to begin the creation of a virtual machine.

In the first tab, give your virtual machine instance a name.

Next, move to the Flavor tab and select the amount of resources for your machine. For most use cases, a standard.small instance is more than enough. How many and how big your instance can be depends on the resources required by the software you are installing and the resources available to your CSC project. For this demonstration, we will go with standard.large.

Next, move to the Security Groups tab and select the security group you made earlier. This allows you to control the machine via SSH and eventually access PrestaShop hosted on the machine via a browser.

Finally, move to the Key Pair tab and select the key pair you set up earlier. You can only select one key pair, additional SSH keys must be added manually in the virtual machine's ~/.ssh/authorized_keys file.

Now, click on Launch Instance to start the creation. After a short while you should be able to see a created instance in Compute -> Instances.

Before you can access the machine via SSH, you need to associate a floating IP address to it. This is done by selecting Associate Floating IP from the dropdown menu in Actions column.

It brings you to the following page. Click on the + icon, then on the next page, simply click on Allocate IP and after it returns you to the first page, click on Associate.
NOTE: In the future, if you don't release the floating IP when deleting a virtual machine, you can choose an already allocated IP address from the dropdown menu next to the + icon, without needing to allocate. Read more about releasing addresses later in this chapter.



Now, you will see two IP addresses on your virtual machine. The latter of these is the IP you use to reach the machine via SSH. It is also the address referred to as floating ip in upcoming guides. NOTE: cPouta by default grants a maximum quota of 2 floating IP addresses to use.

NOTE FOR DELETING VIRTUAL MACHINES: When deleting virtual machines that have floating IPs associated with them, you can disassociate the addresses and release them through Disassociate Floating IP from the dropdown menu in Actions column. Check Release Floating IP and click on Disassociate. This makes it so that your future virtual machines can have their own unique floating IP addresses that have not been used yet. Otherwise new machines would need to use the same unreleased floating IP addresses.

4. Connect to a virtual machine via SSH with PuTTY#
Open PuTTY, go to Connection -> SSH -> Auth -> Credentials, and then browse to select your private key.

Navigate back to the Session tab, enter the floating IP address from cPouta, give the session a name, save the settings and open the connection.

PuTTY will alert of the host key not being cached for this server. Select Accept. Login as rocky and use the passphrase you made when creating the SSH keys with PuTTYgen. You have now SSH'd into your Rocky Linux virtual machine on cPouta. Typing exit will close the connection along with PuTTY.
