Skip to content

Spot instances

What are spot instances?

Spot instances are a purchasing option that allows you to take advantage of unused EC2 capacity in the AWS cloud.

This can result in significant cost savings, often up to 90% off the on-demand price.

However, spot instances are not guaranteed to be available at all times and can be terminated by AWS if the capacity is needed for on-demand instances.

Should I use spot pricing?

In practice, spot instance termination is extremely rare for instances that have been running for less than 1h, making it ideal for all CI workflows that last less than 1h, and which do not trigger critical side-effects, such as deployments jobs.

Also note that AWS will not bill you for any interrupted instance if it was running for less than 1h, which explains why interruptions for short-lived instances are very rare. AWS is clever enough to just reject the spot instance request if it knows that capacity is at a critical level.

See this AWS help page for more details.

Disable spot pricing

By default, RunsOn will always attempt to request an instance using spot pricing, and will default to using on-demand pricing if no instance can be started using spot pricing.

Therefore there is no real disadvantage to using spot pricing, except a slight delay if RunsOn has to cycle through multiple instance types to find one available.

The only situation where you might want to disable spot pricing is:

  • for critical workflows that cannot be interrupted (e.g. deployment jobs).
  • if you require a specific instance type, which is often out of capacity, so as to avoid a few seconds delay at launch.

Disabling spot pricing can be done by using the spot=false label on your runs-on definition:

job: Test
runs-on: runs-on,runner=2cpu-linux,spot=false