constructor()

in lib/bootstrap/ab_testing_bootstrap.ts [26:57]


  constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const myBucket = new s3.Bucket(this, 'cdk-myBucket-deployment');
    const configBucket = new s3.Bucket(this, 'config-bucket-deployment');

    new s3deployment.BucketDeployment(this, "myDeployment", {
      sources: [s3deployment.Source.asset("./resources/website")],
      destinationBucket: myBucket,
    });

    const myDistribution = new cloudfront.Distribution(this, 'myDistribution', {
      defaultBehavior: { origin: new origins.S3Origin(myBucket), viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS},
      defaultRootObject : 'index.html',
      comment : 'AB Testing Workshop - Bootstrap'
    });

    myDistribution.addBehavior('/', new origins.S3Origin(myBucket), {
      viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
    });

    new cdk.CfnOutput(this, 'CloudFrontURL', {
      description: 'The CloudFront distribution URL',
      value: 'https://' + myDistribution.domainName,
    })

    new cdk.CfnOutput(this, 'ConfigBucketName', {
      description: 'The name of the bucket to store the configuration',
      value: configBucket.bucketName,
    })

  }