How to use @aws-cdk/aws-route53-targets - 7 common examples

To help you get started, we’ve selected a few @aws-cdk/aws-route53-targets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / aws-reinvent-2019-trivia-game / trivia-backend / infra / codedeploy-blue-green / infra-setup.ts View on Github external
const certificateArn = StringParameter.fromStringParameterAttributes(this, 'CertArnParameter', {
      parameterName: 'CertificateArn-' + props.domainName
    }).stringValue;

    // Load balancer
    const loadBalancer = new ApplicationLoadBalancer(this, 'ServiceLB', {
      vpc,
      internetFacing: true
    });
    serviceSG.connections.allowFrom(loadBalancer, Port.tcp(80));

    const domainZone = HostedZone.fromLookup(this, 'Zone', { domainName: props.domainZone });
    new ARecord(this, "DNS", {
      zone: domainZone,
      recordName: props.domainName,
      target: AddressRecordTarget.fromAlias(new LoadBalancerTarget(loadBalancer)),
    });

    // Primary traffic listener
    const listener = loadBalancer.addListener('PublicListener', {
      port: 443,
      open: true,
      certificateArns: [certificateArn]
    });

    // Second listener for test traffic
    let testListener = loadBalancer.addListener('TestListener', {
      port: 9002, // port for testing
      protocol: ApplicationProtocol.HTTPS,
      open: true,
      certificateArns: [certificateArn]
    });
github fogfish / aws-cdk-pure / hoc / src / gateway.ts View on Github external
const ApiDNS  = (): dns.ARecordProps => ({
    recordName: site(props),
    target: {aliasTarget: new target.ApiGateway(restapi)},
    ttl: cdk.Duration.seconds(60),
    zone,
  })
  return iaac(ApiDNS)
github fogfish / aws-cdk-pure / hoc / src / staticweb.ts View on Github external
const SiteDNS  = (): dns.ARecordProps => ({
    recordName: site(props),
    target: {aliasTarget: new target.ApiGateway(restapi)},
    ttl: cdk.Duration.seconds(60),
    zone,
  })
  return iaac(SiteDNS)
github fogfish / aws-cdk-pure / hoc / src / staticweb.ts View on Github external
const SiteDNS  = (): dns.ARecordProps => ({
    recordName: site(props),
    target: {aliasTarget: new target.CloudFrontTarget(cloud)},
    ttl: cdk.Duration.seconds(60),
    zone,
  })
  return iaac(SiteDNS)
github cloudcomponents / cdk-components / packages / cdk-static-website / src / static-website.ts View on Github external
},
            ],
            aliasConfiguration,
        };

        this.distribution = new CloudFrontWebDistribution(
            this,
            'WebSiteDistribution',
            distibutionConfig,
        );

        if (aliasConfiguration) {
            new WebsiteAliasRecord(this, 'WebsiteAliasRecord', {
                domainName: aliasConfiguration.domainName,
                recordNames: aliasConfiguration.names,
                target: new CloudFrontTarget(this.distribution),
            });
        }
    }
github aws / aws-cdk / packages / @aws-cdk / aws-ecs-patterns / lib / base / network-load-balanced-service-base.ts View on Github external
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,
        target: AddressRecordTarget.fromAlias(new LoadBalancerTarget(this.loadBalancer)),
      });
    }

    new cdk.CfnOutput(this, 'LoadBalancerDNS', { value: this.loadBalancer.loadBalancerDnsName });
  }
github aws / aws-cdk / packages / @aws-cdk / aws-ecs-patterns / lib / base / application-load-balanced-service-base.ts View on Github external
}
    }
    if (this.certificate !== undefined) {
      this.listener.addCertificateArns('Arns', [this.certificate.certificateArn]);
    }

    let domainName = this.loadBalancer.loadBalancerDnsName;
    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');
      }

      const record = new ARecord(this, "DNS", {
        zone: props.domainZone,
        recordName: props.domainName,
        target: AddressRecordTarget.fromAlias(new LoadBalancerTarget(this.loadBalancer)),
      });

      domainName = record.domainName;
    }

    new cdk.CfnOutput(this, 'LoadBalancerDNS', { value: this.loadBalancer.loadBalancerDnsName });
    new cdk.CfnOutput(this, 'ServiceURL', { value: protocol.toLowerCase() + '://' + domainName });
  }

@aws-cdk/aws-route53-targets

The CDK Construct Library for AWS Route53 Alias Targets

Apache-2.0
Latest version published 11 months ago

Package Health Score

67 / 100
Full package analysis