Start and manage cloud instances.
Project description
Spare Cores Runner
Spare Cores Runner is a command-line tool and Python API designed to simplify the process of provisioning and managing cloud instances across various cloud providers. It leverages Pulumi to handle infrastructure-as-code and automate the creation and destruction of compute instances in your preferred cloud environment.
Spare Cores Runner (sc-runner from now on) is used by Spare Cores Inspector
to start up basic cloud instances with the required minimum configuration and environment to start the machine with a custom
cloud-init script, but it can also be used to simply start an instance with a given SSH key, making it available for basic
use cases.
Supported Cloud Providers and their Credentials
sc-runner uses the Spare Cores database to pre-fill the available configuration options, like what regions and instance
types are available for a given cloud provider.
To use a given cloud provider, you have to provide credentials for them, either by running it in an environment
where the underlying library can pick them up, or by specifying them through environment variables or command line options.
For more details, see the supported vendor's Pulumi integration:
Pulumi
As sc-runner uses Pulumi under the hood to manage the cloud providers, it'll need to have a Pulumi project.
You can configure Pulumi project-related settings either by specifying them using command line arguments, shown below:
sc-runner create --help
Usage: sc-runner create [OPTIONS] COMMAND [ARGS]...
Options:
--project-name TEXT Pulumi project name [default: runner]
--work-dir TEXT Pulumi work dir [default: /data/workdir]
--pulumi-home TEXT Pulumi home [default: /root/.pulumi]
--pulumi-backend-url TEXT Pulumi backend URL [default: file:///data/backend]
--stack-name TEXT Pulumi stack name, defaults to
{vendor}.{region}.{zone}.{instance_id} or similar
--help Show this message and exit.
Commands:
aws
azure
gcp
hcloud
ovh
upcloud
Or by setting the following environment variables:
- PULUMI_PROJECT_NAME
- PULUMI_WORK_DIR
- PULUMI_HOME
- PULUMI_BACKEND_URL
sc-runner should create the project on the first invocation, during which it'll create multiple stacks for each
vendor.region.zone.instance_id tuple. This allows concurrent creation of instances, supporting our
Spare Cores Inspector use case, where we start a given instance type once to collect data from them.
Usage
CLI examples
Create instances
Create and destroy a default t3.micro instance in the default VPC/subnet in AWS:
sc-runner create aws
sc-runner destroy aws
Create an Azure instance with a public key:
sc-runner create azure --instance Standard_DS1_v2 --public-key $(cat .ssh/id_ed25519.pub)
Create an AWS instance with public IP and an already stored SSH key named spare_cores:
sc-runner create aws --region us-west-2 --instance t4g.large --instance-opts '{"associate_public_ip_address": true,"key_name":"spare-cores"}' --public-key ""
Destroy instances
sc-runner destroy azure --instance Standard_DS1_v2
sc-runner destroy aws --region us-west-2 --instance t4g.large
You can also use destroy-stack instead of destroy, which performs a pulumi refresh first, synchronizing the underlying
cloud state with Pulumi's internal backend and destroying only what's really there (so it won't fail on already deleted
resources).
Cancelling Pulumi Locks
Sometimes Pulumi might leave a lock file in its state store, preventing further operations. With this command you can cancel those:
sc-runner cancel aws --region us-west-2 --instance t4g.large
Docker
sc-runner is available through a Docker image as well, which you can use with the following command:
docker run --rm -ti ghcr.io/sparecores/sc-runner:main --help
You'll have to set up the same environment variables or configure the cloud credentials for Pulumi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sparecores_runner-0.0.36.tar.gz.
File metadata
- Download URL: sparecores_runner-0.0.36.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c9d55c983114ce839e1c2ca893b90aaad1fa08d79886f748dfddf4118a4d6e2
|
|
| MD5 |
90357821f1233e09ac502d177a5b638f
|
|
| BLAKE2b-256 |
e21b94828edc5e3bdf9d523b1ce52df1bdd08810a2cb2e34a6068272f6693069
|
Provenance
The following attestation bundles were made for sparecores_runner-0.0.36.tar.gz:
Publisher:
release.yml on SpareCores/sc-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sparecores_runner-0.0.36.tar.gz -
Subject digest:
8c9d55c983114ce839e1c2ca893b90aaad1fa08d79886f748dfddf4118a4d6e2 - Sigstore transparency entry: 823111392
- Sigstore integration time:
-
Permalink:
SpareCores/sc-runner@5d6c2f22ef4afaff32159f90adfba5c0f09756ff -
Branch / Tag:
refs/tags/0.0.36 - Owner: https://github.com/SpareCores
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5d6c2f22ef4afaff32159f90adfba5c0f09756ff -
Trigger Event:
push
-
Statement type:
File details
Details for the file sparecores_runner-0.0.36-py3-none-any.whl.
File metadata
- Download URL: sparecores_runner-0.0.36-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
406789c446e58233d4f9aa3db28f9e9df3b5c166d562067e512457dec0b6f743
|
|
| MD5 |
6eb9461eef68e164d6da45d0de872171
|
|
| BLAKE2b-256 |
98eaad81ad77d0ba8591890ba5aa0bf3b5267d57f96ead306ecd637a036026c1
|
Provenance
The following attestation bundles were made for sparecores_runner-0.0.36-py3-none-any.whl:
Publisher:
release.yml on SpareCores/sc-runner
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sparecores_runner-0.0.36-py3-none-any.whl -
Subject digest:
406789c446e58233d4f9aa3db28f9e9df3b5c166d562067e512457dec0b6f743 - Sigstore transparency entry: 823111463
- Sigstore integration time:
-
Permalink:
SpareCores/sc-runner@5d6c2f22ef4afaff32159f90adfba5c0f09756ff -
Branch / Tag:
refs/tags/0.0.36 - Owner: https://github.com/SpareCores
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5d6c2f22ef4afaff32159f90adfba5c0f09756ff -
Trigger Event:
push
-
Statement type: