Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (props.cluster && props.vpc) {
throw new Error('You can only specify either vpc or cluster. Alternatively, you can leave both blank');
}
this.cluster = props.cluster || this.getDefaultCluster(this, props.vpc);
this.desiredCount = props.desiredCount || 1;
const internetFacing = props.publicLoadBalancer !== undefined ? props.publicLoadBalancer : true;
const lbProps = {
vpc: this.cluster.vpc,
internetFacing
};
this.loadBalancer = props.loadBalancer !== undefined ? props.loadBalancer : new NetworkLoadBalancer(this, 'LB', lbProps);
const targetProps = {
port: 80
};
this.listener = this.loadBalancer.addListener('PublicListener', { port: 80 });
this.targetGroup = this.listener.addTargets('ECS', targetProps);
if (typeof props.domainName !== 'undefined') {
if (typeof props.domainZone === 'undefined') {
throw new Error('A Route53 hosted domain zone name is required to configure the specified domain name');
}
new ARecord(this, "DNS", {
zone: props.domainZone,
recordName: props.domainName,