Compute¶
Compute is where you create and manage virtual machines (instances). Open Compute in the Console menu.
Before you launch¶
You need five things: an image to boot from, a flavor (the CPU and memory size), a network, a key pair for SSH access, and a security group that allows the traffic you need.
Important
VMs boot from a volume. Flavors on DiscoCloud have no root disk. The system disk is a volume that is created when you launch, and you choose its size. Pick a size large enough for the image (for Ubuntu, 10 GB or more).
Key pairs¶
A key pair lets you log in over SSH without a password.
- Open Compute > Key Pairs > Create Keypair.
- Enter a name and choose to create a new pair or import your own public key.
- If you created a new pair, download the private key now. It cannot be downloaded again.
On your computer, protect the downloaded key so SSH accepts it:
Security groups¶
A security group is a set of firewall rules for your instance. By default all inbound traffic is blocked, so create a group that allows SSH (and any other port you need) before you launch.
- Open Network > Security Groups > Create Security Group and enter a name.
- Open the group and go to its Rules tab, then choose Create Rule.
-
To allow SSH, create a rule with these settings:
- Protocol: Custom TCP Rule
- Direction: Ingress
- Ether Type: IPv4
- Port Type: Custom
- Port/Port Range:
22 - Remote Type: CIDR
- Remote IP Prefix:
0.0.0.0/0
-
Add more rules for any other ports you need, for example
80and443for a web server.
Tip
Do not open SSH (port 22) to every address if you can avoid it. Limit it to the addresses you connect from. Example: 192.168.10.10/32 (/32 means a single address).
More about security groups is in Networking.
Launch an instance¶
- Open Compute > Instances > Create Instance.
- In Specification, select a flavor.
- Choose a source image, for example the OS
ubuntu-cloud-22.04. - Set the system disk: leave the type as
__DEFAULT__and set the size of the instance's disk. - Choose the network:
vpcunless you have your own. If you do not have one, you can select a shared network. - Select the security group you created.
- Name the instance. Under Login Type choose Keypair and pick your key pair, or Password and set one.
- Check the summary and click Confirm.
Other options in the form, all optional:
| Option | What it does |
|---|---|
| Delete Volume on Instance Delete | When ticked, the system disk is deleted together with the instance. Leave it unticked if you want to keep the disk and reuse it |
| Data Disk | Creates an extra volume and attaches it at launch, so you do not have to create and attach one afterwards |
| Count | Creates several identical instances at once |
| Server Group | Keeps the instance together with, or apart from, others. See Server groups |
| User Data | A script that runs on first boot, for example to install packages. Cloud images support it through cloud-init |
| Hostname | The name the operating system uses inside the VM, if different from the instance name |
Tip
If you create the instance with a password instead of a key pair, the default username to log in is ubuntu.
The instance shows a status in the list. When it is Active, give it a floating IP to reach it from outside, then connect from your computer's terminal:
Manage an instance¶
Open Compute > Instances. Use the row menu, or click the instance's name to open its page, which also has tabs such as Console, Volumes, Interfaces and Monitoring.
| I want to... | Use |
|---|---|
| Start or stop it | Start or Stop |
| Restart it | Reboot, then choose a soft or hard reboot |
| Change its size | Resize, then choose the new flavor |
| Save a copy of its disk | Create Instance Snapshot |
| Open a console in the browser | Open the instance, then the Console tab |
| Add a disk | Attach Volume |
| Give it a public address | Associate Floating IP |
| Change its firewall rules | Manage Security Group |
| Rename it | Edit Instance |
| Set or reset the login password | Change Password. Works on images that support it (most cloud images do) |
| Reinstall the operating system | Rebuild Instance, then choose the image. All data on the system disk is lost; data volumes are kept |
| Make an image from it | Create Image. The image appears under Compute > Images and can launch new instances |
| Add or remove a network card | Attach Interface / Detach Interface |
| Delete it | Delete |
Note
Deleting an instance may not delete its disk. Whether the system volume is deleted with the instance depends on how it was created. Check Storage > Volumes after deleting, so you do not run out of quota on volumes you no longer need.
Images¶
DiscoCloud provides a small set of public images (see Images). To add your own, open Compute > Images > Create Image, choose the file and its format (for example qcow2), and set the operating system.
Cloud images from distributions (Ubuntu, Rocky, Debian and others) work well because they support cloud-init.
Share an image with another project¶
Your own images are private to your project. To let another project use one, choose Manage Access in the image's row menu and add the project. The other project then sees it under Compute > Images.
Instance snapshots¶
An instance snapshot captures the system disk of an instance at one moment. Use it to save a known-good state before a risky change, or to clone an instance.
- Create one with Create Instance Snapshot in the instance's row menu. It appears under Compute > Instance Snapshots.
- From the snapshot's row menu, Create Instance launches a new instance from it, and Create Volume makes a volume from it.
Snapshots count against your volume snapshot quota. Delete the ones you no longer need.
Server groups¶
A server group tells the cloud where to place its member instances relative to each other.
| Policy | Effect |
|---|---|
| Affinity | All members run on the same physical host. Fastest network between them, but one host failure stops them all |
| Anti-Affinity | Members run on different hosts. Use it for two web servers behind a load balancer, or database replicas |
| Soft-Affinity / Soft-Anti-Affinity | Same as above, but the instance still launches if the rule cannot be met |
Create one under Compute > Server Groups > Create Server Group, then choose it in the Server Group field when you launch an instance. A group's members are listed on its page. An instance cannot be moved into a group after launch.
Note
DiscoCloud currently runs on a single host, so Anti-Affinity cannot place members on different hosts yet. Set the policy now and it applies when more hosts are added.