awsup

package
v1.4.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const BurstableCreditsToECUS float32 = 3.0 / 60.0

I believe one vCPU ~ 3 ECUS, and 60 CPU credits would be needed to use one vCPU for an hour

View Source
const MaxCreateTagsAttempts = 60
View Source
const MaxDescribeTagsAttempts = 60
View Source
const TagClusterName = "KubernetesCluster"

Variables

View Source
var MachineTypes []AWSMachineTypeInfo = []AWSMachineTypeInfo{

	{
		Name:           "t2.nano",
		MemoryGB:       0.5,
		ECU:            3 * BurstableCreditsToECUS,
		Cores:          1,
		EphemeralDisks: nil,
		Burstable:      true,
	},
	{
		Name:           "t2.micro",
		MemoryGB:       1,
		ECU:            6 * BurstableCreditsToECUS,
		Cores:          1,
		EphemeralDisks: nil,
		Burstable:      true,
	},
	{
		Name:           "t2.small",
		MemoryGB:       2,
		ECU:            12 * BurstableCreditsToECUS,
		Cores:          1,
		EphemeralDisks: nil,
		Burstable:      true,
	},
	{
		Name:           "t2.medium",
		MemoryGB:       4,
		ECU:            24 * BurstableCreditsToECUS,
		Cores:          2,
		EphemeralDisks: nil,
		Burstable:      true,
	},
	{
		Name:           "t2.large",
		MemoryGB:       8,
		ECU:            36 * BurstableCreditsToECUS,
		Cores:          2,
		EphemeralDisks: nil,
		Burstable:      true,
	},

	{
		Name:           "m3.medium",
		MemoryGB:       3.75,
		ECU:            3,
		Cores:          1,
		EphemeralDisks: []int{4},
	},
	{
		Name:           "m3.large",
		MemoryGB:       7.5,
		ECU:            6.5,
		Cores:          2,
		EphemeralDisks: []int{32},
	},
	{
		Name:           "m3.xlarge",
		MemoryGB:       15,
		ECU:            13,
		Cores:          4,
		EphemeralDisks: []int{40, 40},
	},
	{
		Name:           "m3.2xlarge",
		MemoryGB:       30,
		ECU:            26,
		Cores:          8,
		EphemeralDisks: []int{80, 80},
	},

	{
		Name:           "m4.large",
		MemoryGB:       8,
		ECU:            6.5,
		Cores:          2,
		EphemeralDisks: nil,
	},
	{
		Name:           "m4.xlarge",
		MemoryGB:       16,
		ECU:            13,
		Cores:          4,
		EphemeralDisks: nil,
	},
	{
		Name:           "m4.2xlarge",
		MemoryGB:       32,
		ECU:            26,
		Cores:          8,
		EphemeralDisks: nil,
	},
	{
		Name:           "m4.4xlarge",
		MemoryGB:       64,
		ECU:            53.5,
		Cores:          16,
		EphemeralDisks: nil,
	},
	{
		Name:           "m4.10xlarge",
		MemoryGB:       160,
		ECU:            124.5,
		Cores:          40,
		EphemeralDisks: nil,
	},

	{
		Name:           "c3.large",
		MemoryGB:       3.75,
		ECU:            7,
		Cores:          2,
		EphemeralDisks: []int{16, 16},
	},
	{
		Name:           "c3.xlarge",
		MemoryGB:       7.5,
		ECU:            14,
		Cores:          4,
		EphemeralDisks: []int{40, 40},
	},
	{
		Name:           "c3.2xlarge",
		MemoryGB:       15,
		ECU:            28,
		Cores:          8,
		EphemeralDisks: []int{80, 80},
	},
	{
		Name:           "c3.4xlarge",
		MemoryGB:       30,
		ECU:            55,
		Cores:          16,
		EphemeralDisks: []int{160, 160},
	},
	{
		Name:           "c3.8xlarge",
		MemoryGB:       60,
		ECU:            108,
		Cores:          32,
		EphemeralDisks: []int{320, 320},
	},

	{
		Name:           "c4.large",
		MemoryGB:       3.75,
		ECU:            8,
		Cores:          2,
		EphemeralDisks: nil,
	},
	{
		Name:           "c4.xlarge",
		MemoryGB:       7.5,
		ECU:            16,
		Cores:          4,
		EphemeralDisks: nil,
	},
	{
		Name:           "c4.2xlarge",
		MemoryGB:       15,
		ECU:            31,
		Cores:          8,
		EphemeralDisks: nil,
	},
	{
		Name:           "c4.4xlarge",
		MemoryGB:       30,
		ECU:            62,
		Cores:          16,
		EphemeralDisks: nil,
	},
	{
		Name:           "c4.8xlarge",
		MemoryGB:       60,
		ECU:            132,
		Cores:          32,
		EphemeralDisks: nil,
	},

	{
		Name:           "cc2.8xlarge",
		MemoryGB:       60.5,
		ECU:            88,
		Cores:          32,
		EphemeralDisks: []int{840, 840, 840, 840},
	},

	{
		Name:           "cg1.4xlarge",
		MemoryGB:       22.5,
		ECU:            33.5,
		Cores:          16,
		EphemeralDisks: []int{840, 840},
	},

	{
		Name:           "cr1.8xlarge",
		MemoryGB:       244.0,
		ECU:            88,
		Cores:          32,
		EphemeralDisks: []int{120, 120},
	},

	{
		Name:           "d2.xlarge",
		MemoryGB:       30.5,
		ECU:            14,
		Cores:          4,
		EphemeralDisks: []int{2000, 2000, 2000},
	},
	{
		Name:           "d2.2xlarge",
		MemoryGB:       61.0,
		ECU:            28,
		Cores:          8,
		EphemeralDisks: []int{2000, 2000, 2000, 2000, 2000, 2000},
	},
	{
		Name:     "d2.4xlarge",
		MemoryGB: 122.0,
		ECU:      56,
		Cores:    16,
		EphemeralDisks: []int{
			2000, 2000, 2000, 2000, 2000, 2000,
			2000, 2000, 2000, 2000, 2000, 2000,
		},
	},
	{
		Name:     "d2.8xlarge",
		MemoryGB: 244.0,
		ECU:      116,
		Cores:    36,
		EphemeralDisks: []int{
			2000, 2000, 2000, 2000, 2000, 2000,
			2000, 2000, 2000, 2000, 2000, 2000,
			2000, 2000, 2000, 2000, 2000, 2000,
			2000, 2000, 2000, 2000, 2000, 2000,
		},
	},

	{
		Name:           "g2.2xlarge",
		MemoryGB:       15,
		ECU:            26,
		Cores:          8,
		EphemeralDisks: []int{60},
	},
	{
		Name:           "g2.8xlarge",
		MemoryGB:       60,
		ECU:            104,
		Cores:          32,
		EphemeralDisks: []int{120, 120},
	},

	{
		Name:           "hi1.4xlarge",
		MemoryGB:       60.5,
		ECU:            35,
		Cores:          16,
		EphemeralDisks: []int{1024, 1024},
	},

	{
		Name:           "i2.xlarge",
		MemoryGB:       30.5,
		ECU:            14,
		Cores:          4,
		EphemeralDisks: []int{800},
	},
	{
		Name:           "i2.2xlarge",
		MemoryGB:       61,
		ECU:            27,
		Cores:          8,
		EphemeralDisks: []int{800, 800},
	},
	{
		Name:           "i2.4xlarge",
		MemoryGB:       122,
		ECU:            53,
		Cores:          16,
		EphemeralDisks: []int{800, 800, 800, 800},
	},
	{
		Name:           "i2.8xlarge",
		MemoryGB:       244,
		ECU:            104,
		Cores:          32,
		EphemeralDisks: []int{800, 800, 800, 800, 800, 800, 800, 800},
	},

	{
		Name:           "r3.large",
		MemoryGB:       15.25,
		ECU:            6.5,
		Cores:          2,
		EphemeralDisks: []int{32},
	},
	{
		Name:           "r3.xlarge",
		MemoryGB:       30.5,
		ECU:            13,
		Cores:          4,
		EphemeralDisks: []int{80},
	},
	{
		Name:           "r3.2xlarge",
		MemoryGB:       61,
		ECU:            26,
		Cores:          8,
		EphemeralDisks: []int{160},
	},
	{
		Name:           "r3.4xlarge",
		MemoryGB:       122,
		ECU:            52,
		Cores:          16,
		EphemeralDisks: []int{320},
	},
	{
		Name:           "r3.8xlarge",
		MemoryGB:       244,
		ECU:            104,
		Cores:          32,
		EphemeralDisks: []int{320, 320},
	},

	{
		Name:           "x1.32xlarge",
		MemoryGB:       1952,
		ECU:            349,
		Cores:          128,
		EphemeralDisks: []int{1920, 1920},
	},
}

Functions

func AWSErrorCode

func AWSErrorCode(err error) string

AWSErrorCode returns the aws error code, if it is an awserr.Error, otherwise ""

func AWSErrorMessage

func AWSErrorMessage(err error) string

AWSErrorMessage returns the aws error message, if it is an awserr.Error, otherwise ""

func FindASGTag

func FindASGTag(tags []*autoscaling.TagDescription, key string) (string, bool)

FindASGTag find the value of the tag with the specified key

func FindEC2Tag

func FindEC2Tag(tags []*ec2.Tag, key string) (string, bool)

FindEC2Tag find the value of the tag with the specified key

func FindELBTag

func FindELBTag(tags []*elb.Tag, key string) (string, bool)

FindELBTag find the value of the tag with the specified key

func NewEC2Filter

func NewEC2Filter(name string, values ...string) *ec2.Filter

func ValidateRegion

func ValidateRegion(region string) error

ValidateRegion checks that an AWS region name is valid

Types

type AWSAPITarget

type AWSAPITarget struct {
	Cloud *AWSCloud
}

func NewAWSAPITarget

func NewAWSAPITarget(cloud *AWSCloud) *AWSAPITarget

func (*AWSAPITarget) AddAWSTags

func (t *AWSAPITarget) AddAWSTags(id string, expected map[string]string) error

func (*AWSAPITarget) AddELBTags

func (t *AWSAPITarget) AddELBTags(loadBalancerName string, expected map[string]string) error

func (*AWSAPITarget) Finish

func (t *AWSAPITarget) Finish(taskMap map[string]fi.Task) error

func (*AWSAPITarget) WaitForInstanceRunning

func (t *AWSAPITarget) WaitForInstanceRunning(instanceID string) error

type AWSCloud

type AWSCloud struct {
	EC2         *ec2.EC2
	IAM         *iam.IAM
	ELB         *elb.ELB
	Autoscaling *autoscaling.AutoScaling
	Route53     *route53.Route53

	Region string
	// contains filtered or unexported fields
}

func NewAWSCloud

func NewAWSCloud(region string, tags map[string]string) (*AWSCloud, error)

func (*AWSCloud) AddAWSTags

func (c *AWSCloud) AddAWSTags(id string, expected map[string]string) error

func (*AWSCloud) AddTags

func (c *AWSCloud) AddTags(name *string, tags map[string]string)

func (*AWSCloud) BuildFilters

func (c *AWSCloud) BuildFilters(name *string) []*ec2.Filter

func (*AWSCloud) BuildTags

func (c *AWSCloud) BuildTags(name *string) map[string]string

func (*AWSCloud) CreateELBTags

func (c *AWSCloud) CreateELBTags(loadBalancerName string, tags map[string]string) error

CreateELBTags will add tags to the specified loadBalancer, retrying up to MaxCreateTagsAttempts times if it hits an eventual-consistency type error

func (*AWSCloud) CreateTags

func (c *AWSCloud) CreateTags(resourceId string, tags map[string]string) error

CreateTags will add tags to the specified resource, retrying up to MaxCreateTagsAttempts times if it hits an eventual-consistency type error

func (*AWSCloud) DeleteTags added in v1.10.0

func (c *AWSCloud) DeleteTags(resourceId string, tags map[string]string) error

DeleteTags will remove tags from the specified resource, retrying up to MaxCreateTagsAttempts times if it hits an eventual-consistency type error

func (*AWSCloud) DescribeInstance

func (t *AWSCloud) DescribeInstance(instanceID string) (*ec2.Instance, error)

DescribeInstance is a helper that queries for the specified instance by id

func (*AWSCloud) DescribeVPC

func (t *AWSCloud) DescribeVPC(vpcID string) (*ec2.Vpc, error)

DescribeVPC is a helper that queries for the specified vpc by id

func (*AWSCloud) FindDNSHostedZone

func (c *AWSCloud) FindDNSHostedZone(clusterDNSName string) (string, error)

func (*AWSCloud) GetELBTags

func (c *AWSCloud) GetELBTags(loadBalancerName string) (map[string]string, error)

func (*AWSCloud) GetTags

func (c *AWSCloud) GetTags(resourceId string) (map[string]string, error)

GetTags will fetch the tags for the specified resource, retrying (up to MaxDescribeTagsAttempts) if it hits an eventual-consistency type error

func (*AWSCloud) ProviderID

func (c *AWSCloud) ProviderID() fi.CloudProviderID

func (*AWSCloud) ResolveImage

func (c *AWSCloud) ResolveImage(name string) (*ec2.Image, error)

ResolveImage finds an AMI image based on the given name. The name can be one of: `ami-...` in which case it is presumed to be an id owner/name in which case we find the image with the specified name, owned by owner name in which case we find the image with the specified name, with the current owner

func (*AWSCloud) Tags

func (c *AWSCloud) Tags() map[string]string

func (*AWSCloud) ValidateZones

func (c *AWSCloud) ValidateZones(zones []string) error

ValidateZones checks that every zone in the sliced passed is recognized

type AWSMachineTypeInfo

type AWSMachineTypeInfo struct {
	Name           string
	MemoryGB       float32
	ECU            float32
	Cores          int
	EphemeralDisks []int
	Burstable      bool
}

func GetMachineTypeInfo

func GetMachineTypeInfo(machineType string) (*AWSMachineTypeInfo, error)

func (*AWSMachineTypeInfo) EphemeralDevices

func (m *AWSMachineTypeInfo) EphemeralDevices() []*EphemeralDevice

type EphemeralDevice

type EphemeralDevice struct {
	DeviceName  string
	VirtualName string
	SizeGB      int
}

Jump to

Keyboard shortcuts

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