in iis-smbshare-sqlserver/typescript/lib/constructs/alb-stack.ts [33:79]
constructor(scope: cdk.Construct, id:string, props: cdk.StackProps, albProps: ALBProps) {
super(scope, id, props);
this.albSecurityGroup = new ec2.SecurityGroup(
scope,
`${albProps.prefix}-alb-sg`,
{
vpc: albProps.vpc,
allowAllOutbound: true,
securityGroupName: `${albProps.prefix}-alb-sg`,
}
);
if(albProps.certificateArn === ''){
this.albSecurityGroup.addIngressRule(
ec2.Peer.ipv4("0.0.0.0/0"),
ec2.Port.tcp(80),
'Allows HTTP access from outside world'
);
this.alb = new ApplicationLoadBalancer(
scope,
`${albProps.prefix}-alb`,
{
loadBalancerName: `${albProps.prefix}`,
vpc: albProps.vpc,
internetFacing: true,
securityGroup: this.albSecurityGroup
}
)
}
else{
this.albSecurityGroup.addIngressRule(
ec2.Peer.ipv4("0.0.0.0/0"),
ec2.Port.tcp(443),
'Allows HTTPS access from outside world'
);
this.alb = new ApplicationLoadBalancerStandardized(
scope,
`${albProps.prefix}-alb`,
{
loadBalancerName: `${albProps.prefix}`,
vpc: albProps.vpc,
internetFacing: true,
securityGroup: this.albSecurityGroup
}
);
}
new cdk.CfnOutput(scope, 'LoadBalancerDnsName', { value: this.alb.loadBalancerName });
}