sparse-intern-71089
09/12/2020, 5:41 PMbroad-gold-44713
09/12/2020, 7:57 PMvictorious-xylophone-55816
09/12/2020, 8:05 PMchilly-hairdresser-56259
09/12/2020, 10:07 PMchilly-hairdresser-56259
09/12/2020, 10:08 PMvictorious-xylophone-55816
09/13/2020, 7:31 PMapi
and frontend
, and two environments, staging
and production
.
I would create one Application Load Balancer (not NLB), and in Pulumi I would attach them all to this single ALB.
And then in my Pulumi handler, I could do something like:
type StackEnvironment = "staging" | "production"
const stack = pulumi.getStack() as StackEnvironment
const config = new pulumi.Config()
const domain = config.require("domain") // IE: <http://mysite.com|mysite.com>
// Create certificate for "<http://mysite.com|mysite.com>" with "subjectAlternativeNames: ['*.${domain}']"
// Create ALB here for "<http://mysite.com|mysite.com>"
// Create Fargate API service attached to ALB with Route53 Domain at "api.${stack}.${domain}"
// Create Fargate Frontend service attached to ALB with Route53 Domain at "frontend.${stack}.${domain}"
victorious-xylophone-55816
09/13/2020, 7:32 PM<http://api.staging.mysite.com|api.staging.mysite.com>
and <http://api.production.mysite.com|api.production.mysite.com>
etc all to the same ALB + single Certificate right? Based on Pulumi stackchilly-hairdresser-56259
09/13/2020, 10:33 PMvictorious-xylophone-55816
09/14/2020, 2:33 AMbroad-gold-44713
09/14/2020, 5:25 AMconst alb = new awsx.lb.ApplicationLoadBalancer(...)
const listener = alb.createListener(...) // one listener for my case
const cert = new aws.alb.ListenerCertificate(...) // repeat for each domain, or you could use a single wildcard
const targetGroup = alb.createTargetGroup(...) // repeat for each domain
const listenerRule = listener.addListenerRule(...) // repeat for each domain
const service = new awsx.ecs.FargateService(...) // repeat for each host, use loadBalancers to register service with targetGroup