Skip to content

Commit

Permalink
Merge pull request #2 from schematic-energy/ndabas/alb-to-nlb
Browse files Browse the repository at this point in the history
Switch to Network Load Balancing; allow access to the Metastore from workers
  • Loading branch information
levand authored Mar 17, 2020
2 parents dc0c1db + 5f0f334 commit 9dfdd57
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions coordinator.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,46 +174,66 @@ sudo su ec2-user /home/ec2-user/run.sh ${ctx.env} s3://${configBucket}/presto/co
let asgCtx = new PulumiContext({tags: tagMaps}, ctx.opts);

let lb = ctx.r(aws.lb.LoadBalancer, `scio-coordinator-${ctx.env}`, {
loadBalancerType: "application",
loadBalancerType: "network",
internal: true,
subnets: ctx.cfg.requireObject('subnets'),
securityGroups: [securityGroup.id],
vpcId: ctx.cfg.require('vpcId'),
zoneId: ctx.cfg.require('route53ZoneId')
});

let tg = ctx.r(aws.lb.TargetGroup, `scio-coordinator-${ctx.env}`, {
port: 8080,
protocol: "HTTP",
protocol: "TCP",
vpcId: ctx.cfg.require('vpcId'),
targetType: "instance",
deregistrationDelay: 10,
stickiness: {
enabled: false,
type: "lb_cookie"
},
healthCheck: {
protocol: "HTTP",
port: 80,
enabled: true,
interval: 30,
timeout: 10,
path: "/cgi-bin/healthcheck.sh",
healthy_threshold: 2,
unhealthy_threshold: 2,
matcher: "200-299"
unhealthy_threshold: 2
}
});

let metastoreTg = ctx.r(aws.lb.TargetGroup, `scio-metastore-${ctx.env}`, {
port: 9083,
protocol: "TCP",
vpcId: ctx.cfg.require('vpcId'),
targetType: "instance",
deregistrationDelay: 10
});

ctx.r(aws.lb.Listener, `scio-8080-${ctx.env}`, {
loadBalancerArn: lb.arn,
port: 8080,
protocol: "HTTP",
protocol: "TCP",
defaultActions: [{
type: "forward",
targetGroupArn: tg.arn
}]
});

ctx.r(aws.lb.Listener, `scio-9083-${ctx.env}`, {
loadBalancerArn: lb.arn,
port: 9083,
protocol: "TCP",
defaultActions: [{
type: "forward",
targetGroupArn: metastoreTg.arn
}]
});

let asg = asgCtx.r(aws.autoscaling.Group, "coordinator", {
name: `scio-coordinator-${ctx.env}`,
vpcZoneIdentifiers: ctx.cfg.requireObject('subnets'),
targetGroupArns: [tg],
targetGroupArns: [tg, metastoreTg],
launchConfiguration: launchCfg,
minSize: 1,
maxSize: 1,
Expand Down

0 comments on commit 9dfdd57

Please sign in to comment.