Documentation
¶
Index ¶
- Constants
- Variables
- func DescribeEcsServicesForArns(awsSess *session.Session, serviceArns []*string, cluster string) ([]*ecs.Service, error)
- func DetachAndReplaceAsgInstances(awsSess *session.Session, asgName string, instancesToTerminate []*string)
- func GetAsg(awsSess *session.Session, asgName string) *autoscaling.Group
- func GetAsgNameForEcsCluster(awsSess *session.Session, cluster string) string
- func GetAsgServerCount(awsSess *session.Session, asgName string) (desired int64, min int64, max int64)
- func GetInstanceIDsForEcsCluster(awsSess *session.Session, clusterName string) []*string
- func GetInstanceIPsForEcsCluster(awsSess *session.Session, clusterName string) []string
- func GetInstanceListForAsg(awsSess *session.Session, asgName string) []*string
- func GetInstanceListForEcsCluster(awsSess *session.Session, clusterName string) []*ecs.ContainerInstance
- func GetInstanceTypeForAsg(awsSess *session.Session, asgName string) string
- func GetInstanceTypeFromLaunchConfiguration(awsSess *session.Session, launchConfigurationName string) string
- func GetInstanceTypeFromLaunchTemplate(awsSess *session.Session, launchTemplateName string) string
- func GetLargestDesiredCountFromEcsServices(ecsServices []*ecs.Service) int64
- func GetPendingEcsTasksCount(awsSess *session.Session, cluster string) int64
- func HowManyServersNeededForAsg(serverType string, resourcesNeeded ResourceSizes) int64
- func LambdaInvoke(awsSess *session.Session, functionName, payload string) (*lambda.InvokeOutput, error)
- func ListServicesForEcsCluster(awsSess *session.Session, cluster string) []*ecs.Service
- func RightSizeAsgForEcsCluster(awsSess *session.Session, cluster string, atLeastServiceDesiredCount bool) error
- func UpdateAsgServerCount(awsSess *session.Session, asgName string, serverCount int64) error
- type InstanceType
- type ResourceSizes
Constants ¶
View Source
const ( SingleCPUUnits int64 = 1024 MbInGb int64 = 1024 AgentSize int64 = 39 // memory consumed by the ECS agent )
Variables ¶
View Source
var InstanceTypes = map[string]InstanceType{ "t2.nano": { CPUUnits: 1 * SingleCPUUnits, MemoryMb: MbInGb/2 - AgentSize, }, "t2.micro": { CPUUnits: 1 * SingleCPUUnits, MemoryMb: 1*MbInGb - AgentSize, }, "t2.small": { CPUUnits: 1 * SingleCPUUnits, MemoryMb: 2*MbInGb - AgentSize, }, "t2.medium": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: 4*MbInGb - AgentSize, }, "t2.large": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: 8*MbInGb - AgentSize, }, "t2.xlarge": { CPUUnits: 4 * SingleCPUUnits, MemoryMb: 16*MbInGb - AgentSize, }, "t2.2xlarge": { CPUUnits: 8 * SingleCPUUnits, MemoryMb: 32*MbInGb - AgentSize, }, "t3.nano": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: MbInGb/2 - AgentSize, }, "t3.micro": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: 1*MbInGb - AgentSize, }, "t3.small": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: 2*MbInGb - AgentSize, }, "t3.medium": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: 4*MbInGb - AgentSize, }, "t3.large": { CPUUnits: 2 * SingleCPUUnits, MemoryMb: 8*MbInGb - AgentSize, }, "t3.xlarge": { CPUUnits: 4 * SingleCPUUnits, MemoryMb: 16*MbInGb - AgentSize, }, "t3.2xlarge": { CPUUnits: 8 * SingleCPUUnits, MemoryMb: 32*MbInGb - AgentSize, }, }
Functions ¶
func GetAsgNameForEcsCluster ¶
func GetAsgServerCount ¶
func GetInstanceListForAsg ¶
func GetInstanceListForEcsCluster ¶
func GetInstanceListForEcsCluster(awsSess *session.Session, clusterName string) []*ecs.ContainerInstance
func GetInstanceTypeForAsg ¶
func GetPendingEcsTasksCount ¶
func HowManyServersNeededForAsg ¶
func HowManyServersNeededForAsg(serverType string, resourcesNeeded ResourceSizes) int64
HowManyServersNeededForAsg computes the theoretical number of servers needed based on the total resources needed, assuming near-perfect utilization of server resources. It does not take into account the "wasted" resources on an individual server when the free resources are not sufficient to place any of the desired containers.
func LambdaInvoke ¶
Types ¶
type InstanceType ¶
type ResourceSizes ¶ added in v0.2.0
type ResourceSizes struct {
TotalCPU int64
TotalMemory int64
LargestCPU int64
LargestMemory int64
SmallestCPU int64
SmallestMemory int64
}
func GetMemoryCpuNeededForEcsServices ¶
func GetMemoryCpuNeededForEcsServices(awsSess *session.Session, ecsServices []*ecs.Service) ResourceSizes
Click to show internal directories.
Click to hide internal directories.