Spot instances on Creodias

Spot instances let you run jobs on spare cloud capacity at a lower price than regular instances. CloudFerro can terminate them when that capacity is needed, so use them for work that can save progress and resume or be repeated.

When to use spot instances

Spot instances suit jobs that process independent files, builds or tests that can run again, and temporary workers that take jobs from a queue. Keep the queue and job records outside the spot VM. Use regular instances for services that must stay available, such as the primary database. When comparing prices, allow for work you may need to repeat after an interruption.

For example, a worker processing Sentinel images can write each result to object storage and then mark that image as complete in the job record. If the worker stops halfway through the next image, a replacement worker can look up the unfinished image and retry it.

Advance notice of spot instance termination

An OpenStack server tag cannot tell you when the VM will stop. In particular, a callback_url tag containing a full HTTPS URL is invalid because the OpenStack Compute API forbids forward slashes in server tags. Changing the API version does not enable a callback or give a Kubernetes pod a countdown.

If your pod needs to save progress, have the application write checkpoints to storage outside the worker while it runs. Choose a checkpoint interval based on how much work you can afford to repeat. If a replacement pod starts on another worker, the application can read the last completed checkpoint and resume.

Understanding spot flavor names

The flavor determines whether the VM uses spot capacity and how much CPU, RAM and local disk it receives. For example, spot.eo2a.medium identifies a general-purpose AMD spot flavor. Read the name together with the specifications for the cloud where you plan to launch it.

Part of the name

What it means

spot.

An interruptible VM using spare cloud capacity. It can be terminated when that capacity is needed for regular instances.

eo2 in eo2 and eo2a

The general-purpose CPU family, suitable for restartable scripts, batch processing and worker jobs.

hm in hma

The high-memory family, intended for jobs that need more RAM per vCPU. For spot instances, the job must still tolerate interruption.

a in eo2a and hma

The AMD processor variant: eo2a is the general-purpose AMD family, and hma is the high-memory AMD family.

medium, large, xlarge, 2xlarge, etc.

A size label within the selected family. It does not specify a fixed amount of RAM or a fixed vCPU count across families and clouds. For example, 2xlarge does not mean two vCPUs.

Select your cloud below to compare flavor sizes. The RAM values from openstack flavor list have been converted from MiB to GiB and rounded to two decimal places where needed. Disk sizes are already in GiB.

Flavor

vCPUs

RAM (GiB)

Disk (GiB)

spot.eo2.medium

1

4

16

spot.eo2.large

2

8

32

spot.eo2.xlarge

4

16

64

spot.eo2.2xlarge

8

32

128

spot.eo2.3xlarge

16

64

256

spot.eo2.4xlarge

32

128

512

Prerequisites

No. 1 Horizon access

Sign in to Horizon with your Creodias account at https://horizon.cloudferro.com/auth/login/?next=/.

No. 2 Cloud and project

Select the project and cloud where you want to run the VM. The screenshot shows WAW3-2 selected in Horizon.

../_images/waw3-2-cloud-activated.png

No. 3 Project quota

Check that the project has enough quota for the VM, its vCPUs and its RAM. You can find your limits in Dashboard Overview – Project Quotas And Flavors Limits on Creodias.

No. 4 OpenStack CLI access for the command examples

You can create a VM in Horizon. To use the commands for inspecting flavors or tagging workers, install the OpenStack CLI for your operating system.

Authenticate the CLI to the same cloud and project by following How to activate OpenStack CLI access to Creodias cloud using one- or two-factor authentication.

Check your CLI session by listing the available flavors:

openstack flavor list

Look for flavor names with the spot. prefix.

No. 5 VM settings

Use the guide for your preferred method to prepare the image, network, key pair and other VM settings:

How to create spot instances

Step 1. Check the flavor

In Horizon, inspect the spot. flavors for the selected cloud. From the CLI, replace SPOT_FLAVOR_NAME with a full name from openstack flavor list and run:

openstack flavor show SPOT_FLAVOR_NAME

For a medium flavor, the examples above use spot.eo2.medium on WAW3-1, spot.hma.medium on WAW3-2 and spot.eo2a.medium on WAW4-1, FRA1-2, FRA1-3 and LCJ1-1. In the CLI output, look for cf:spot.instance set to True in properties. The example below shows that property on WAW3-2.

../_images/value_of_spot.png

Warning

Check the vCPU count, RAM and disk size before creating the VM. Flavors with similar names can have different specifications across clouds, and a regular flavor can differ from its spot counterpart.

Step 2. Create the instance

Follow the VM creation procedure from Prerequisite No. 5 using the image, network and key pair you prepared. In Horizon, select the spot flavor you checked in Step 1. The example below shows the flavor selection on WAW3-2.

../_images/spot_flavors_when_creating.png

In the CLI, pass the same flavor name with --flavor in your openstack server create command. Once the VM appears in the instance list, check that its flavor matches your selection.

../_images/spot_hma_created.png

Tag and find workers for a batch job

A server tag is a label you choose. For example, if several spot VMs process Sentinel images, give them the tag sentinel-batch. An operator or a monitoring script can then find the workers for that job with one command. The tag belongs to the OpenStack VM. Kubernetes pod labels are managed separately.

In the terminal authenticated to your cloud and project, find the name or ID of a worker:

openstack server list

Replace VM_NAME_OR_ID with that name or ID. Add the tag to each worker you want to include:

openstack --os-compute-api-version 2.26 server set --tag sentinel-batch VM_NAME_OR_ID

List the VMs in the current project that carry the tag:

openstack --os-compute-api-version 2.26 server list --tags sentinel-batch

Look for your worker in the output. You can check the tags on that VM directly:

openstack --os-compute-api-version 2.26 server show VM_NAME_OR_ID -c tags

The tags field should include sentinel-batch. Use Compute API version 2.26 or later to tag an existing VM or filter the server list. To apply the tag during creation, add --tag sentinel-batch to the complete openstack server create command from Prerequisite No. 5 and select version 2.52 or later with --os-compute-api-version. Both versions use the same tag format.

Quota, capacity and shelving

Spot and on-demand VMs count against the same project quota. Even if you have quota and a spot flavor appears in the list, there may be too little spare capacity to start the VM. On-demand VMs take priority and may still be available in that cloud.

You can temporarily shelve a spot VM. While it is shelved, you pay for the persistent storage it retains.

How to convert a spot instance to an on-demand instance

If your workload now needs a regular VM, plan the resize while you can still save progress outside the worker. Choose a compatible non-spot flavor and check that your project has enough quota and the cloud has capacity. The regular flavor’s price applies after conversion.

In Horizon, open the instance’s Resize Instance action and choose the regular flavor.

../_images/resize_instance.png

From the CLI, replace FLAVOR_NAME with the regular flavor name and INSTANCE_NAME with the VM name or ID. Request the resize, then check its status:

openstack server resize --flavor FLAVOR_NAME INSTANCE_NAME
openstack server show INSTANCE_NAME

When the status is VERIFY_RESIZE, check the VM and the application. If they work as expected, confirm the resize:

openstack server resize confirm INSTANCE_NAME

If the check fails, revert the resize:

openstack server resize revert INSTANCE_NAME

What to do next

To store worker results outside the VM, follow How to use Object Storage on Creodias. For the full Horizon resize procedure, see Resizing a virtual machine using OpenStack Horizon on Creodias.

The OpenStack Compute API reference lists the server tag rules. For lifecycle and billing information, see CloudFerro Spot Instances.