Spot

EC2 instances can be launched as on-demand or spot.

On-demand instances are a great default choice as they are about 4x cheaper than GitHub-hosted runners without any restrictions.

But you can save between 65% and 90% more by switching to spot instances.

There is only one catch: AWS can interrupt them at any time with 2 minutes notice. This in turn means that, any job taking 2 minutes or less can never be interrupted by AWS and can always be safely run on spot instances.

Longer jobs should only be run on spot instances if it is acceptable for them to fail due to instance interruption. This can be mitigated, while still maintaining most of the savings, by splitting the longer jobs into interruptible parts on spot instances and non-interruptible parts on on-demand instances.

You could, for example, run compile and test tasks on spot instances and deploy the application using on-demand instances.

Note that AWS doesn’t charge you for spot instances interrupted less than 1 hour after launch , making most interrupted jobs free.

Prerequisite

In order to use spot instances, your AWS account must have the AWSServiceRoleForEC2Spot IAM service-linked role. If you have previously launched a spot instance using the AWS Console, this role will have automatically been created for you.

If not, you can easily create it manually using the AWS CLI or the IAM console .

Usage

By default, jobs uses on-demand instances (spot=false).

Add spot=auto to the runs-on: label to attempt to launch as spot and automatically fall back to on-demand if no spot capacity is available (recommended):

Alternatively, you can force also force the use spot instances (with no fallback) by appending spot=true:

Need help? We’re here for you at [email protected]

What's new? · Pricing · Docs · Security


© 2025 InfrastructureX GmbH
Terms of Service · Privacy Policy · Impressum
Sprinters is a registered trademark of InfrastructureX GmbH
Made with ♥️ in München