sparse-intern-71089
03/25/2021, 1:39 AMbillowy-army-68599
targetgroupattachment
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],
},
}
}
millions-furniture-75402
03/25/2021, 5:53 PMconst 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