How to use @aws-cdk/aws-certificatemanager - 7 common examples

To help you get started, we’ve selected a few @aws-cdk/aws-certificatemanager 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 / aws-cdk / packages / @aws-cdk / aws-ecs-patterns / lib / fargate / load-balanced-fargate-service-applet.ts View on Github external
constructor(scope: cdk.Construct, id: string, props: LoadBalancedFargateServiceAppletProps) {
    super(scope, id, props);

    const vpc = new Vpc(this, 'MyVpc', { maxAZs: 2 });
    const cluster = new Cluster(this, 'Cluster', { vpc });

    let domainZone;
    if (props.domainZone) {
      domainZone = new HostedZoneProvider(this, { domainName: props.domainZone }).findAndImport(this, 'Zone');
    }
    let certificate;
    if (props.certificate) {
      certificate = Certificate.fromCertificateArn(this, 'Cert', props.certificate);
    }

    // Instantiate Fargate Service with just cluster and image
    new LoadBalancedFargateService(this, "FargateService", {
      cluster,
      cpu: props.cpu,
      containerPort: props.containerPort,
      memoryMiB: props.memoryMiB,
      publicLoadBalancer: props.publicLoadBalancer,
      publicTasks: props.publicTasks,
      image: ContainerImage.fromRegistry(props.image),
      desiredCount: props.desiredCount,
      environment: props.environment,
      certificate,
      domainName: props.domainName,
      domainZone
github aws-samples / aws-reinvent-2019-trivia-game / trivia-backend / infra / cdk / ecs-service.ts View on Github external
const cluster = new Cluster(this, 'Cluster', {
      clusterName: props.domainName.replace(/\./g, '-'),
      vpc
    });

    // Configuration parameters
    const domainZone = HostedZone.fromLookup(this, 'Zone', { domainName: props.domainZone });
    const imageRepo = Repository.fromRepositoryName(this, 'Repo', 'reinvent-trivia-backend');
    const tag = (process.env.IMAGE_TAG) ? process.env.IMAGE_TAG : 'latest';
    const image = ContainerImage.fromEcrRepository(imageRepo, tag)

    // Lookup pre-existing TLS certificate
    const certificateArn = StringParameter.fromStringParameterAttributes(this, 'CertArnParameter', {
      parameterName: 'CertificateArn-' + props.domainName
    }).stringValue;
    const certificate = Certificate.fromCertificateArn(this, 'Cert', certificateArn);

    // Fargate service + load balancer
    new ApplicationLoadBalancedFargateService(this, 'Service', {
      cluster,
      taskImageOptions: { image },
      desiredCount: 3,
      domainName: props.domainName,
      domainZone,
      certificate
    });
  }
}
github seagull-js / seagull / packages / deploy-aws / src / seagull_stack.ts View on Github external
addNewCert(name: string, domains: string[]) {
    const domainName = domains[0]
    const altNames = domains.slice(1)
    const subjectAlternativeNames = altNames.length > 0 ? altNames : undefined
    const props: CM.CertificateProps = { domainName, subjectAlternativeNames }
    return new CM.Certificate(this, `${this.id}-${name}`, props)
  }
github jeshan / scale-your-cloudformation / lib / cdk-stack.js View on Github external
constructor(scope) {
        super(scope, 'scale-your-cloudformation');

        const domainName = 'scaleyourcloudformation.com';
        const cert = new Certificate(this, 'cert', {
            domainName,
            validationMethod: ValidationMethod.DNS,
        });

        const websiteBucket = new Bucket(this, 'WebsiteBucket', {
            domainName,
            removalPolicy: RemovalPolicy.DESTROY,
            websiteIndexDocument: 'index.html',
            websiteErrorDocument: 'error.html',
        });

        const originId = new CfnCloudFrontOriginAccessIdentity(
            this,
            'OriginAccessIdentity',
            {
                cloudFrontOriginAccessIdentityConfig: {
github seagull-js / seagull / packages / deploy / src / lib / cdk / certificates.ts View on Github external
export const addNewCert = (
  stack: Construct,
  name: string,
  domains: string[]
) => {
  const domainName = domains[0]
  const altNames = domains.slice(1)
  const subjectAlternativeNames = altNames.length ? altNames : undefined
  const props: CM.CertificateProps = { domainName, subjectAlternativeNames }
  return new CM.Certificate(stack, `${name}Certificate`, props).certificateArn
}
const noCertFound = `No Certificate found, that matches all domains. Make sure 
github aws / aws-cdk / packages / @aws-cdk / aws-ecs-patterns / lib / base / application-load-balanced-service-base.ts View on Github external
this.listener = this.loadBalancer.addListener('PublicListener', {
      protocol,
      open: true
    });
    this.targetGroup = this.listener.addTargets('ECS', targetProps);

    if (protocol === ApplicationProtocol.HTTPS) {
      if (typeof props.domainName === 'undefined' || typeof props.domainZone === 'undefined') {
        throw new Error('A domain name and zone is required when using the HTTPS protocol');
      }

      if (props.certificate !== undefined) {
        this.certificate = props.certificate;
      } else {
        this.certificate = new DnsValidatedCertificate(this, 'Certificate', {
          domainName: props.domainName,
          hostedZone: props.domainZone
        });
      }
    }
    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", {
github jeshan / scale-your-cloudformation / lib / cdk-stack.js View on Github external
constructor(scope) {
        super(scope, 'scale-your-cloudformation');

        const domainName = 'scaleyourcloudformation.com';
        const cert = new Certificate(this, 'cert', {
            domainName,
            validationMethod: ValidationMethod.DNS,
        });

        const websiteBucket = new Bucket(this, 'WebsiteBucket', {
            domainName,
            removalPolicy: RemovalPolicy.DESTROY,
            websiteIndexDocument: 'index.html',
            websiteErrorDocument: 'error.html',
        });

        const originId = new CfnCloudFrontOriginAccessIdentity(
            this,
            'OriginAccessIdentity',
            {
                cloudFrontOriginAccessIdentityConfig: {
                    comment: `CloudFront OriginAccessIdentity for ${websiteBucket.bucketName}`,
                },

@aws-cdk/aws-certificatemanager

The CDK Construct Library for AWS::CertificateManager

Apache-2.0
Latest version published 10 months ago

Package Health Score

70 / 100
Full package analysis