wide-jackal-86020
03/25/2021, 1:39 AMconst helloService = new awsx.ecs.FargateService(...)
2. Load balancer const alb = new <http://awsx.lb|awsx.lb>.ApplicationLoadBalancer(...)
3. Listener export const backendListener = alb.createListener(...)
4. Target groups const helloTarget = alb.createTargetGroup()
5. Listener Rules: const helloRule = new <http://aws.lb|aws.lb>.ListenerRule()
My question is how can I connect the helloRule
to the helloService
?
For example, helloService1
should response to requests matches hellowRule1
, and helloService2
should response to requests matches helloRule2
.billowy-army-68599
03/25/2021, 1:48 AMtargetgroupattachment
https://www.pulumi.com/docs/reference/pkg/aws/applicationloadbalancing/targetgroupattachment/wide-jackal-86020
03/25/2021, 1:57 AMmillions-furniture-75402
03/25/2021, 5:51 PMconst appTargetGroup = new awsx.lb.ApplicationTargetGroup(`${appName}-tg`, {
deregistrationDelay: 0,
healthCheck: {
path: "/healthcheck",
port: "80",
protocol: "HTTP",
matcher: "200",
},
loadBalancer: alb,
port: 80,
protocol: "HTTP",
vpc: vpc,
});
const appListenerRule = new awsx.lb.ListenerRule(`${appName}-lr`, https, {
actions: [{
targetGroupArn: appTargetGroup.targetGroup.arn.apply(v => v),
type: "forward",
}],
conditions: [{
hostHeader: {
values: [`${appName}.*`],
},
}],
priority: 1,
});
ā¦
const appService = new awsx.ecs.FargateService(`${appName}-fargate-service`, {
taskDefinitionArgs: {
containers: {
[`${appName}-service`]: {
image: ...
...
portMappings: [appTargetGroup],
},
}
}
const lbSecurityGroup = new awsx.ec2.SecurityGroup(`${appName}-default-http-and-https`, {
vpc: vpc,
});
const alb = new awsx.lb.ApplicationLoadBalancer(`${appName}-lb`, {
accessLogs: {
bucket: logBucketId,
enabled: true,
prefix: appName,
},
external: true,
securityGroups: [lbSecurityGroup],
subnets: publicSubnetIds,
vpc: vpc,
});
const http = alb.createListener(`${appName}-http`, {
defaultAction: {
type: "redirect",
redirect: {
protocol: "HTTPS",
port: "443",
statusCode: "HTTP_301",
},
},
external: true,
port: 80,
protocol: "HTTP",
});
const https = alb.createListener(`${appName}-https`, {
certificateArn,
defaultActions: [{
fixedResponse: {
contentType: "text/plain",
messageBody: "404 Site Not Found",
statusCode: "404",
},
type: "fixed-response",
}],
external: true,
port: 443,
protocol: "HTTPS",
sslPolicy: "ELBSecurityPolicy-TLS-1-2-Ext-2018-06",
});
wide-jackal-86020
03/25/2021, 7:02 PM