CLI for exploring AWS EC2 Spot inventory. Inspect AWS Spot instance types, saving, price, and interruption frequency.

docker Go Report Card Docker Pulls

spotinfo

The spotinfo is a command-line tool that helps you determine AWS Spot instance types with the least chance of interruption and provides the savings you get over on-demand rates.

You should weigh your application’s tolerance for interruption and your cost saving goals when selecting a Spot instance. The lower your interruption rate, the longer your Spot instances are likely to run.

Usage

With spotinfo command you can get a filtered and sorted list of Spot instance types as a plain text, json, pretty table or CSV format.

spotinfo --help
NAME:
   spotinfo - spotinfo CLI

USAGE:
   spotinfo [global options] command [command options] [arguments...]

VERSION:
   1.0.0

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --type value    EC2 instance type (can be RE2 regexp patten)
   --os value      instance operating system (windows/linux) (default: "linux")
   --region value  AWS region (default: "us-east-1")
   --output value  format output: number|text|json|table|csv (default: "table")
   --cpu value     filter: minimal vCPU cores (default: 0)
   --memory value  filter: minimal memory GiB (default: 0)
   --price value   filter: maximum price per hour (default: 0)
   --sort value    sort results by interruption|type|savings|price (default: "interruption")
   --help, -h      show help (default: false)
   --version, -v   print the version (default: false)

Data Sources

The spotinfo uses the following data sources to get updated information about AWS EC2 Spot instances:

  1. AWS Spot Advisor JSON file, maintained/updated by AWS team
  2. AWS Spot Pricing callback JS file, maintained/updated by AWS team

The spotinfo also includes embedded (during the build) copies of the above files, and thus can continue to work, even if there is no network connectivity, or these files are not available, for any reason.

Example

Get all Graviton2 Linux Spot instances in the AWS Oregon (us-west-2) region, with CPU cores > 8 and memory > 64gb, sorted by type, and output the result in a table format.

Run spotinfo CLI

# run binary
spotinfo --type="^.(6g)(\S)*" --cpu=8 --memory=64 --region=us-west-2 --os=linux --output=table --sort=type

# OR run Docker image
docker run -it --rm ghcr.io/alexei-led/spotinfo --type="^.(6g)(\S)*" --cpu=8 --memory=64 --region=us-west-2 --os=linux --output=table --sort=type

Output:

┌───────────────┬──────┬────────────┬────────────────────────┬───────────────────────────┬──────────┐
│ INSTANCE INFO │ VCPU │ MEMORY GIB │ SAVINGS OVER ON-DEMAND │ FREQUENCY OF INTERRUPTION │ USD/HOUR │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ c6g.12xlarge  │   48 │         96 │                    50% │ <5%                       │   0.8113 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ c6g.16xlarge  │   64 │        128 │                    50% │ <5%                       │   1.0818 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ c6g.8xlarge   │   32 │         64 │                    50% │ <5%                       │   0.5409 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ m6g.12xlarge  │   48 │        192 │                    54% │ <5%                       │   0.8519 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ m6g.16xlarge  │   64 │        256 │                    54% │ <5%                       │   1.1358 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ m6g.4xlarge   │   16 │         64 │                    54% │ <5%                       │    0.284 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ m6g.8xlarge   │   32 │        128 │                    54% │ <5%                       │   0.5679 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ m6gd.8xlarge  │   32 │        128 │                    61% │ <5%                       │   0.5679 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6g.12xlarge  │   48 │        384 │                    63% │ <5%                       │   0.8924 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6g.16xlarge  │   64 │        512 │                    63% │ <5%                       │   1.1899 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6g.2xlarge   │    8 │         64 │                    63% │ <5%                       │   0.1487 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6g.4xlarge   │   16 │        128 │                    63% │ <5%                       │   0.2975 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6g.8xlarge   │   32 │        256 │                    63% │ <5%                       │    0.595 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6g.metal     │   64 │        512 │                    63% │ <5%                       │   1.1899 │
├───────────────┼──────┼────────────┼────────────────────────┼───────────────────────────┼──────────┤
│ r6gd.4xlarge  │   16 │        128 │                    68% │ 15-20%                    │   0.2975 │
└───────────────┴──────┴────────────┴────────────────────────┴───────────────────────────┴──────────┘

Docker Image

The spotinfo uses Docker both as a CI tool and for releasing the final spotinfo Multi-Architecture Docker image (scratch with updated ca-credentials package).

Public Docker Image ghcr.io/alexei-led/spotinfo

docker pull ghcr.io/alexei-led/spotinfo:latest

Build Instructions

Makefile

The spotinfo Makefile is used for task automation only: compile, lint, test, etc. The project requires Go version 1.16+.

> make help
all              Build program binary
check_deps       Verify the system has all dependencies installed
test-bench       Run benchmarks
test-short       Run only short tests
test-verbose     Run tests in verbose mode with coverage reporting
test-race        Run tests with race detector
check test tests Run tests
test-xml         Run tests with xUnit output
test-coverage    Run coverage tests
lint             Run golangci-lint
mockgen          Run mockery to re/generate mocks for all interfaces
fmt              Run gofmt on all source files
clean            Cleanup everything

Continuous Integration

The GitHub action docker is used for the spotinfo CI.

Build with Docker

Use Docker buildx plugin to build multi-architecture Docker image.

docker buildx build --platform=linux/arm64,linux/amd64 -t spotinfo -f Dockerfile .

Required GitHub secrets

Please specify the following GitHub secrets:

  1. DOCKER_USERNAME - Docker Registry username
  2. DOCKER_PASSWORD - Docker Registry password or token
  3. CR_PAT - Current GitHub Personal Access Token (with write/read packages permission)
  4. DOCKER_REGISTRY - optional; Docker Registry name, default to docker.io
  5. DOCKER_REPOSITORY - optional; Docker image repository name, default to $GITHUB_REPOSITORY (i.e. user/repo)

Additional secret to create GitHub Release:

  1. RELEASE_TOKEN - GitHub Personal Access Token (with repo scope)
Owner
Alexei Ledenev
Kubernetes, Docker, AWS, GCP, Golang
Alexei Ledenev
Similar Resources

A collection of CLI argument types for the Go `flag` package.

flagvar A collection of CLI argument types for the flag package. import "github.com/sgreben/flagvar" Or just copy & paste what you need. It's public d

Sep 26, 2022

CLI tool to convert many common document types to plane text.

Textify. CLI tool to convert many common document types to plane text. Goals. SO many different document types exist today. PDFs, EPUB books, Microsof

Nov 19, 2021

Package varflag implements command-line flag parsing into vars.Variables for easy type handling with additional flag types.

varflag Package flag implements command-line flag parsing into vars.Variables for easy type handling with additional flag types. varflag Flags String

Aug 2, 2022

Marshallable - Make generic data types marshallable

Marshallable Make generic data types marshallable! Features Implement methods: S

Feb 15, 2022

A CLI tool to manage and streamline AWS ECS deployments

Outback CLI 🦘 About The Project Outback is CLI tool written in Go to help streamline the process of deploying containerized applications to AWS Elast

Dec 8, 2021

A Mighty CLI for AWS

A Mighty CLI for AWS

awless is a powerful, innovative and small surface command line interface (CLI) to manage Amazon Web Services. Twitter | Wiki | Changelog Why awless a

Dec 31, 2022

Opinionated CLI app for AWS SSO made in Golang!

Opinionated CLI app for AWS SSO made in Golang!

aws-sso-creds AWS SSO Creds Table of Contents About The Project Built With Instalation Static From source Usage Contributing License Contact Acknowled

Aug 17, 2022

List of serverless functions for AWS S3. Easy deploy with Vercel CLI

List of serverless functions for AWS S3. Easy deploy with Vercel CLI

Jan 22, 2022

Go-file-downloader-ftctl - A file downloader cli built using golang. Makes use of cobra for building the cli and go concurrent feature to download files.

ftctl This is a file downloader cli written in Golang which uses the concurrent feature of go to download files. The cli is built using cobra. How to

Jan 2, 2022
Comments
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

Dev-spaces - A CLI to help creating development environments using AWS Spot Instances

This is a CLI to help creating on-demand development spaces using EC2 Spot Intances.

Nov 9, 2022
Inspect-descriptor-set - Example protobuf descriptor set inspector CLI tool

Quick little example of parsing a protobuf descriptor file. ❯ go run main.go -f

Jan 25, 2022
Redis inventory is a tool to analyse Redis memory usage by key patterns and displaying it hierarchically
Redis inventory is a tool to analyse Redis memory usage by key patterns and displaying it hierarchically

Redis inventory is a tool to analyse Redis memory usage by key patterns and displaying it hierarchically. The name is inspired by "Disk Inventory X" tool doing similar analysis for disk usage.

Dec 11, 2022
Go library for Parsing Ansible inventory files

aini Go library for Parsing Ansible inventory files. We are trying to follow the logic of Ansible parser as close as possible. Documentation on ansibl

Jan 5, 2023
Wishbox - Wishlist using netbox as inventory source

Wishbox Generate a wishlist directory based on your netbox inventory. How does i

Nov 6, 2022
A tool for exploring each layer in a docker image
A tool for exploring each layer in a docker image

dive A tool for exploring a docker image, layer contents, and discovering ways to shrink the size of your Docker/OCI image. To analyze a Docker image

Jan 9, 2023
Go Coverage in Shell: a tool for exploring Go Coverage reports from the command line
Go Coverage in Shell: a tool for exploring Go Coverage reports from the command line

Go Coverage in Shell: a tool for exploring Go Coverage reports from the command line

Dec 31, 2022
Tools for exploring OpenVG
Tools for exploring OpenVG

Testbed for exploring OpenVG on the Raspberry Pi. First program Here is the graphics equivalent of "hello, world" // first OpenVG program // Anthony S

Dec 30, 2022
This plugin will analyse the JFrog Platform instance and provide the non conformance against the best practices based on the predefines rules.

hello-frog About this plugin This plugin is a template and a functioning example for a basic JFrog CLI plugin. This README shows the expected structur

Nov 30, 2021
CLI tool to update ~/.aws/config with all accounts and permission sets defined in AWS SSO

aws-sso-profiles Generate or update ~/.aws/config with a profile for each SSO account you have access to, by using an existing AWS SSO session. Bootst

Nov 3, 2022