// NewECSManager returns a new Manager implementation that: // // * Creates services with ECS. func NewECSManager(config ECSConfig) (*ECSManager, error) { c := ecsutil.NewClient(config.AWS) // Create the ECS Manager var pm ProcessManager = &ecsProcessManager{ cluster: config.Cluster, serviceRole: config.ServiceRole, ecs: c, } return &ECSManager{ cluster: config.Cluster, ProcessManager: pm, ecs: c, }, nil }
// NewLoadBalancedECSManager returns a new Manager implementation that: // // * Creates services with ECS. // * Creates internal or external ELBs for ECS services. // * Creates a CNAME record in route53 under the internal TLD. func NewLoadBalancedECSManager(config ECSConfig) (*ECSManager, error) { if err := validateLoadBalancedConfig(config); err != nil { return nil, err } c := ecsutil.NewClient(config.AWS) // Create the ECS Manager var pm ProcessManager = &ecsProcessManager{ cluster: config.Cluster, serviceRole: config.ServiceRole, ecs: c, } // Create the ELB Manager elb := lb.NewELBManager(config.AWS) elb.InternalSecurityGroupID = config.InternalSecurityGroupID elb.ExternalSecurityGroupID = config.ExternalSecurityGroupID elb.InternalSubnetIDs = config.InternalSubnetIDs elb.ExternalSubnetIDs = config.ExternalSubnetIDs // Compose the LB Manager var lbm lb.Manager = elb n := lb.NewRoute53Nameserver(config.AWS) n.ZoneID = config.ZoneID lbm = lb.WithCNAME(lbm, n) lbm = lb.WithLogging(lbm) pm = &LBProcessManager{ ProcessManager: pm, lb: lbm, } return &ECSManager{ cluster: config.Cluster, ProcessManager: pm, ecs: c, }, nil }