onDemandToRiEc2

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const IndexPrefixOdToRiEC2Report = "od-to-ri-ec2-reports"
View Source
const TemplateNameOdToRiEC2Report = "od-to-ri-ec2-reports"
View Source
const TemplateOdToRiEc2Report = `` /* 3526-byte string literal not displayed */
View Source
const TypeOdToRiEC2Report = "od-to-ri-ec2-report"

Variables

View Source
var (
	HoursPerMonth = 730.0
)
View Source
var (
	// PreviousToCurrentGeneration maps previous generation instance type to current
	// generation instance types
	PreviousToCurrentGeneration = map[string]string{
		"t1.micro":    "t3.nano",
		"m3.medium":   "m5.large",
		"m3.large":    "m5.large",
		"m3.xlarge":   "m5.xlarge",
		"m3.2xlarge":  "m5.2xlarge",
		"m1.small":    "t2.small",
		"m1.medium":   "t2.medium",
		"m1.large":    "m5.large",
		"m1.xlarge":   "m5.xlarge",
		"m2.xlarge":   "r5.large",
		"m2.2xlarge":  "r5.xlarge",
		"m2.4xlarge":  "r5.2xlarge",
		"r3.large":    "r5.large",
		"r3.xlarge":   "r5.xlarge",
		"r3.2xlarge":  "r5.2xlarge",
		"r3.4xlarge":  "r5.4xlarge",
		"r3.8xlarge":  "r4.8xlarge",
		"cr1.8xlarge": "r4.8xlarge",
		"c3.large":    "c5.large",
		"c3.xlarge":   "c5.xlarge",
		"c3.2xlarge":  "c5.2xlarge",
		"c3.4xlarge":  "c5.4xlarge",
		"c3.8xlarge":  "c5.9xlarge",
		"c1.medium":   "c5.large",
		"c1.xlarge":   "c5.2xlarge",
		"cc2.8xlarge": "c5.9xlarge",
		"i2.xlarge":   "i3.xlarge",
		"i2.2xlarge":  "i3.2xlarge",
		"i2.4xlarge":  "i3.4xlarge",
		"i2.8xlarge":  "i3.8xlarge",
		"hs1.8xlarge": "i3.8xlarge",
		"g2.2xlarge":  "g3.4xlarge",
		"g2.8xlarge":  "g3.8xlarge",
	}
)

Functions

func IngestOdToRiEc2Result

func IngestOdToRiEc2Result(ctx context.Context, aa aws.AwsAccount, report OdToRiEc2Report) error

IngestOdToRiEc2Result saves a OdToRiEc2Report into elasticsearch

func RunOnDemandToRiEc2

func RunOnDemandToRiEc2(ctx context.Context, aa aws.AwsAccount) error

RunOnDemandToRiEc2 generates a report listing the unreserved instances and the savings that can be done by buying reservations The result is saved into ES

Types

type Cost

type Cost struct {
	PerUnit float64 `json:"perUnit"`
	Total   float64 `json:"total"`
}

type InstancesSpecs

type InstancesSpecs struct {
	Region        string       `json:"region"`
	Type          string       `json:"instanceType"`
	Platform      string       `json:"platform"`
	InstanceCount int          `json:"instanceCount"`
	OnDemand      OnDemandCost `json:"onDemand"`
	Reservation   struct {
		Type      string          `json:"type"`
		OneYear   ReservationCost `json:"oneYear"`
		ThreeYear ReservationCost `json:"threeYears"`
	} `json:"reservation"`
}

InstancesSpecs stores the costs calculated for a given region/instance/platform combination

type OdToRiEc2Report

type OdToRiEc2Report struct {
	Account     string            `json:"account"`
	ReportDate  time.Time         `json:"reportDate"`
	OnDemand    OnDemandTotalCost `json:"onDemand"`
	Reservation struct {
		OneYear   ReservationTotalCost `json:"oneYear"`
		ThreeYear ReservationTotalCost `json:"threeYears"`
	} `json:"reservation"`
	Instances []InstancesSpecs `json:"instances"`
}

OdToRiEc2Report stores all the on demand to RI EC2 report infos

type OnDemandCost

type OnDemandCost struct {
	Monthly    Cost `json:"monthly"`
	OneYear    Cost `json:"oneYear"`
	ThreeYears Cost `json:"threeYears"`
}

type OnDemandTotalCost

type OnDemandTotalCost struct {
	MonthlyTotal    float64 `json:"monthly"`
	OneYearTotal    float64 `json:"oneYear"`
	ThreeYearsTotal float64 `json:"threeYears"`
}

type ReservationCost

type ReservationCost struct {
	Monthly Cost `json:"monthly"`
	Global  Cost `json:"global"`
	Saving  Cost `json:"saving"`
}

type ReservationTotalCost

type ReservationTotalCost struct {
	MonthlyTotal float64 `json:"monthly"`
	GlobalTotal  float64 `json:"global"`
	SavingTotal  float64 `json:"saving"`
}

Jump to

Keyboard shortcuts

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