ec2

package
v0.0.0-...-9f55c91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package ec2 contains functions for inspecting EC2 instance types and searching for a similar instance types.

Index

Constants

View Source
const (
	OnDemandMarketType = "on-demand"
	SpotMarketType     = "spot"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// IgnoreFamily ignore instance family
	IgnoreFamily bool
	// IgnoreGeneration ignore instance generation
	IgnoreGeneration bool
	// MultiplyFactorUpper a multiplier for the upper limit of the VCPU size
	MultiplyFactorUpper int
	// MultiplyFactorUpper a multiplier for the lower limit of the VCPU size
	MultiplyFactorLower int
}

A Config is used for tuning the EC2 similarity algorithm

type InstanceDescriber

type InstanceDescriber interface {
	GetInstanceDetails(ctx context.Context, ltSpec *autoscaling.LaunchTemplateSpecification) (*InstanceDetails, error)
}

InstanceDescriber contains methods for extracting and inspecting instance types

func NewInstanceDescriber

func NewInstanceDescriber(role sts.AssumeRoleInRegion) InstanceDescriber

NewInstanceDescriber create new InstanceDescriber

type InstanceDetails

type InstanceDetails struct {
	TypeName   string
	MarketType string
}

type InstanceTypeWeight

type InstanceTypeWeight struct {
	// InstanceType instance type name, like `m5.4xlarge`
	InstanceType string
	// Weight instance weight for MixedInstancePolicy; equal to the VCPU number
	Weight int
}

InstanceTypeWeight EC2 instance type record that contains type name and weight (equal to the VCPU number)

func GetSimilarTypes

func GetSimilarTypes(instanceType string, config Config) []InstanceTypeWeight

GetSimilarTypes find EC2 instances, that are similar to the specified EC2 instance type. The algorithm compares between instance types over multiple dimensions. It returns a list of "similar" EC2 instance types (with weights)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL